We've launched a new support center at help.smartling.com. This site will continue to be maintained into January 2017. Please update your bookmarks.
Follow

Plurals

The following article applies to Global Delivery Network, Application Resource File, Business Document, and CMS Connector project types.

Many languages have multiple ways to express a plural form.

For example, English (Canada) has two plural forms:

  1. For 1 item

  2. For 0, 2, 3, 4, 5, 6... items

Whereas, Belarusian has three plural forms:

  1. For 1, 21, 31, 41, 51, 61... items

  2. For 2, 3, 4, 22, 23, 24... items

  3. For 0, 5, 6, 7, 8, 9... items

Smartling allows you to specify that a string is plural sensitive and that it requires translation to a number of plural forms (depending on the target languages).

Smartling currently supports plural forms in YAML, Gettext, QT TS Linguist, Android XML and iOS files.

To add translations for plural forms:

  1. Upload the file.

  2. The source strings appear at Translations > In Progress. A cascading pages icon marks plural strings. Mouseover to see all plural forms.

  3. For the plural sensitive string you want to modify, click Edit.

  4. The Translation Interface provides the correct number of plural forms depending on the target language.

  5. Add a translation for each form and click Save.

  6. You can copy down the content in the translation box, by clicking Copy this translation down to the rest of the plural forms.

  7. To save the translation, you must provide a translation for each plural form in the target language (Smartling does not allow partial translations).A shortcut is available to copy your translation into the other plural forms.

You can now download the file that includes the translated forms.

Workflow

All forms of the translation move through workflow together. For example, if an editor rejects the translation because there is a problem with one plural form, they reject all plural forms for the translation. A translator only needs to modify the form that requires re-translation, but all plural forms move through the workflow together.

Similarly, issues raised for the translation of plural sensitive strings apply to all the forms. If the issue only applies to a specific form, the text of the issue should specify the plural form.

When you download the translated file, the number of plural forms in the file depends on the target language and file format.

Plurals for Gettext Files

Plural sensitive forms for Gettext files are indicated by the source .pot file having a string marked 'msgid_plural', for example:

msgid “added %d item to cart”

msgid_plural “added %d items to cart”

msgstr[0] “”

msgstr[1] “”

Once translated, the downloaded .po file will have the plural forms needed for the target language and the appropriate language-specific headers. Smartling returns the PluralForm header in the top of the file (if it existed in the original file) that contains the correct plurals rules for that locale.

Note: Gettext files have limited support for some locales. For more information on Gettext plural forms, see: Additional functions for plural forms

Plurals for YAML Files

Plural sensitive forms for YAML files are indicated at the sub-key level. For example, the one and other keys in the following English source file indicate that the string is plural sensitive:

image_upload_timestamp:

 one: "uploaded %{num_secs} second ago"

 other: "uploaded %{num_secs} seconds ago"

You can turn off detection of plurals using the following directive: # smartling.plurals_detection = off

Plurals for QT TS Files

Plural sensitive forms for QT Linguist files are indicated by the source string having "numerus = "yes" " and the variations using the "numerusform" element with the "plurality" attribute. For example:

 

<message numerus="yes">
<source>%1 subtitle(s) extracted</source>
<translation>
<numerusform plurality="singular">%1 subtitle extracted</numerusform>
<numerusform plurality="plural">%1 subtitles extracted</numerusform>
</translation>
</message>

 

 

Plurals for Android Files

Plural sensitive forms for Android files are indicated by the source file having a string marked plurals, for example:

<plurals name="plural_strings2">

<item quantity="one">You have %s item in your cart.</item>

<item quantity="other">You have %s items in your cart.</item>

</plurals>

Smartling conforms to the Android standard for plurals: http://developer.android.com/guide/topics/resources/string-resource...

Plurals for iOS Files

While iOS files do not normally support plurals, Smartling has extended the format by developing an open source library to accommodate plurals.

Plural sensitive forms for iOS files are indicated by source files with strings in the following form:

KEY##{rule}

Where:

  • KEY is the original key string

  • rule is one of the plural forms: zero, one, two, few, many, other, and conforms to the CLDR specification on plural forms. Smartling loads a translation following rules as defined under CLDR.

For example, here are sample resource files for the key “%d songs found:”

en.lproj/Localizable.strings

/* Number of songs from search results */

"%d songs found##{one}" = "One song found";

"%d songs found##{other}" = "%d songs found";

ru.lproj/Localizable.strings

/* Number of songs from search results */

"%d songs found##{one}" = "Найдена одна песня";

"%d songs found##{few}" = "Найдено %d песни";

"%d songs found##{many}" = "Найдено %d песен";

"%d songs found##{other}" = "Найдено %d песен";

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request
Powered by Zendesk