• Documentation
  • Projects & Content
  • Working with Plurals and Genders

Working with Plurals and Genders

While Transifex does not natively support the ICU MessageFormat, the most important and frequently-used features of ICU can be supported, such as plurals, context and developer comments. Depending on the file format you use, you can access some or all of these features.

You can use PO files as a good way to work around this. It is one of the most popular file formats for localization, supported by many frameworks. It's quite powerful and we have a good support for it.

PO files can support context and also developer comments, if you want to bring that info straight from the source file. If, in addition to plurals, you have genders, you can use the context field (msgctxt) to indicate the gender. You can also use the developer comment (#.) to explicitly tell the translator how to translate the string.

Here is an example, showing the same source string but using the context to save two different entities in Transifex.

#. Please translate it as a MALE gender  
#: src/main.py:338  
msgctxt "male"  
msgid "Cousin"  
msgstr ""  

#. Please translate it as a FEMALE gender  
#: src/main.py:340  
msgctxt "female"  
msgid "Cousin"  
msgstr  
Pluralized strings can also be defined in a .po file as follows:

#: src/main.py:340  
msgid "plural"  
msgid_plural "plurals"  
msgstr[0] "1 plural"  
msgstr[1] "%d plurals"  

Pluralized strings can also be defined in a PO file as follows:

#: src/main.py:340  
msgid "plural"  
msgid_plural "plurals"  
msgstr[0] "1 plural"  
msgstr[1] "%d plurals"

How pluralized strings are handled by Transifex

The number of plural forms for each specific language are automatically identified and displayed in the Transifex editor. So, if a translator wants to submit a translation for a pluralized string, they have to translate all the available plural forms in order to be able to save the translation. Otherwise, the save button won't be enabled and the translation won't be submitted.

As an example, English has 2 plural forms ("one" and "other"). The source file will have two phrases, one for each plural form. On the other hand, Russian has 4 plural forms. So, after the translations are done, when you download the file from Transifex, your translation file will look as follows.

#: src/main.py:340
msgid "plural"
msgid_plural "plurals"
msgstr[0] "Ваш суд заканчивается в 1 день"
msgstr[1] "Ваш суд заканчивается в % @ дней"
msgstr[2] "Ваш суд заканчивается в % @ дней"
msgstr[3] "Ваш суд заканчивается в % @ дней"

Transifex is following ISO Standards and Unicode CLDR data for the supported languages, as you can read in our documentation.

You can also take a look at the rules we follow, for defining the plural forms, here.

Leveraging TM with Pluralized Strings

Transifex's Translation Memory functionality supports plural forms natively. Here is an idea on how to use the TM with plural-enabled entities.

  • Open the Transifex Editor, click on the Search box and filter source strings by “pluralized” to only see the phrases that are marked as pluralized.

    2.png#asset:3535

  • For each phrase you select, you will be able to see its various plural forms and toggle between them, such as "One" and "Other". On the right side of the translation box, you'll be able to see the TM suggestions for this entity's plural form.

  • To use a TM suggestion, click “Use this”, which will copy the TM entry into the translation box. You can now save the translation by clicking "Save".

    4.png#asset:3536