Homec4science

Make it more clear when a translation provides bad variants

Authored by epriestley <git@epriestley.com> on Mar 29 2016, 14:24.

Description

Make it more clear when a translation provides bad variants

Summary:
Ref T10688. When you have a translation like "I saw %s dog(s)", you can provide multiple variants in the translation file that are selected based on the argument's plurality or gender.

However, if you pass something which is not a number and not gendered, we can't use it to choose a variant (we have no idea which variant we should select for a phutil_tag() or arbitrary string).

An example of bad variant data is:

'%s touched %s %s time(s).' => array(
  array(
    '%s touched %s once.',
    '%s touched %s %s times.',
  )
)

This data intends to vary on the third parameter (the number of touches) but actually varies on the second parameter (the touched thing).

Unless that second parameter is a number or a person, this data is incorrect and tries to vary on a non-gendered, non-plural value.

The correct data uses an extra array to vary on the third parameter instead of the second parameter:

'%s touched %s %s time(s).' => array(
  array(
    array(
      '%s touched %s once.',
      '%s touched %s %s times.',
    )
  )
)

Test Plan: {F1195210}

Reviewers: lpriestley, chad

Reviewed By: chad

Maniphest Tasks: T10688

Differential Revision: https://secure.phabricator.com/D15545

Details

Committed
epriestley <git@epriestley.com>Mar 29 2016, 15:49
Pushed
aubortMar 17 2017, 12:03
Parents
rPHUb4f38af38480: Implement a stream iterator and hashing iterator
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHUc274930326c7: Make it more clear when a translation provides bad variants (authored by epriestley <git@epriestley.com>).Mar 29 2016, 15:49