Table of Contents |
---|
Page Properties | ||
---|---|---|
| ||
Introduction
As you might know, different languages have a different number of plural forms available for them. The simplest example is one month and many months in English, vs. one miesiąc, one and a half miesiąca, two-three-four miesiące, and many miesięcy in Polish. This is a challenge in localization if you want to localize your applications or web content and a sentence contains a number of items as a variable instead of as a specific number.
...
IMPORTANT! Keep in mind that enabling plurals in your filter template comes with the change in file naming convention. The code of the project’s target language is appended to the end of the source file name. This is expected behavior and cannot be changed in any way. |
---|
Determining the number of plurals for a particular language
...
Plurals syntax in particular file formats
JSON with ICU
Note |
---|
IMPORTANT! Note that the ICU syntax is only handled as plurals in JSON files! |
The ICU content is inside curly brackets. It starts with the name of a variable, which can be used in the segment, but does not have to. Then it specifies whether this is a selection of plurals or selection of some other fixed variables. Then it lists keywords and has the sentences in curly brackets immediately after each keyword.
...
Also see the content in XTM Workbench:
...
Info |
---|
To learn more about ICU plurals syntax in XTM Cloud, read the following article: ICU plurals syntax in XTM Cloud. |
Android XML
See the example Android XML file structure. The syntax is pretty self-explanatory.
...
Code Block | ||
---|---|---|
| ||
msgid "" msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: enUS\n" "Plural-Forms: nplurals=2; plural=n != 1;" #: sample #, python-format msgid "Selected %(num_items)s item" msgid_plural "Selected %(num_items)s items" msgstr[0] "" msgstr[1] "" msgid "" "I am a sample normal segment" msgstr "" |
Note |
---|
IMPORTANT! A PO file with plurals contains a Plural-Forms: (…) line in its metadata, and every segment with plurals must have an adequate line too. XTM Cloud uses this line to identify that the file contains plurals and exactly how many of them there are. On target generation, this line will be replaced with one that is appropriate for the target language. |
Plural forms will be activated in PO files straight away if XTM Cloud finds a Plural-Forms: (…) line in the file, as described above. Additionally, the msgid_plural element must be present for each segment that is supposed to be processed as plurals.
...