Plural forms
How plural strings are stored, translated and edited, with the right set of forms for every language.
Languages count differently. English needs two forms of "1 item" and "3 items"; Polish needs more; Japanese needs one. transglot stores a plural string as one form per plural category, using the standard CLDR categories (zero, one, two, few, many and other), and each language gets exactly the categories its own grammar uses.
Where plural keys come from
A key is a plural key when its source file says so. These formats carry plurals as separate forms:
| Format | How plurals are written |
|---|---|
| Android XML | <plurals> resources |
Apple .stringsdict and String Catalog (.xcstrings) | Plural variations |
| Flutter ARB | ICU plural messages |
| Gettext PO | msgid_plural entries |
| CSV and XLSX | One row per form, named key[category] |
You can also mark a key as plural by hand: turn on Plural key (one form per CLDR category) when you add or edit a key. A key can only be switched between plural and simple while it has no translations.
Formats without plural forms, such as JSON and YAML, can still hold plurals as ICU messages inside an ordinary string, for example {count, plural, one {# item} other {# items}}. Those are simple keys whose text contains the plural, and the quality checks read them according to the project's Message syntax setting, under Settings, then Checks. See File formats.
Translating plurals
- With Glossa. An AI translation of a plural key writes every form the target language needs, and the automatic checks flag a translation with the wrong set of forms.
- By hand. A plural key cannot be typed into a single box. In the editor, select Edit forms on the row in Table view, or Edit plural forms in Side by side view.
Edit the forms
Open the plural dialog
In the editor, choose the language and open the string's plural forms. The dialog is titled key: language plural forms.
Compare with the source
The source forms are shown at the top, one per category, "for comparison".
Fill in each form
There is one box per category the target language uses, labelled with the category name. As you type, problems such as a missing placeholder are listed under the boxes.
Save
Select Save.
In the table, a plural string shows each form on its own line, labelled with its category, and its key carries a plural chip.
Importing plurals
When you import or push a translation file, a plural entry is only written to a plural key, and a simple entry only to a simple key. An entry whose shape does not match the key is skipped and reported as a conflict, so a file can never silently turn a plural string into a simple one.