Texts often contain values that are filled in by your code: names, counts, dates. Continuous Translations understands the ICU message format, so translators can handle plurals and variants properly. Messages are stored as written.
What ICU looks like #
| Kind | Example |
|---|---|
| Variable | Hello {name} |
| Plural | {count, plural, one {# item} other {# items}} |
| Ordinal | {place, selectordinal, one {#st} two {#nd} few {#rd} other {#th}} |
| Select | {gender, select, female {She} male {He} other {They}} |
| Number | {amount, number} |
| Currency | {price, number, ::currency/EUR} |
| Date and time | {when, date, medium} and {when, time, short} |
In a plural, # stands for the number.
In the editor #
When a project’s string format is ICU (recommended), the editor understands these expressions:
- The key list marks keys that contain an expression (for example
plural) with a small label. - Above the source text, the ICU label opens an explanation of the variables and a live preview of the English and the target-language message for values you choose.
- Below the translation field a check tells you whether the placeholders survived.
static/screenshots/editor-icu-preview.pngPlaceholder check #
While you type, the editor compares your translation with the source and shows one of these messages under the field:
- The variable name, followed by placeholder intact.
- The variable name, followed by placeholder missing! when the translation leaves out a variable of the source.
- placeholder broken: check the curly braces when braces do not match.
- No ICU variables (or No placeholders) when the source has none.
The check is advice, it does not stop you from saving.
Write a source with ICU #
When a key has no source yet, managers see Add ICU next to the source field, which helps to insert an expression. Pick a Variable (an existing one, or New variable… with a name) and a Type: Plural, Select, Ordinal, Number, Currency, Date or Time. The expression is inserted with a starting point (for example one and other forms for a plural) that you can refine after confirming the source.
Managers can change the structure of an existing source with Edit ICU: variable names, plural forms, select options, and the style of dates, times, numbers and currencies.
Other string formats #
The String format of a project (Project settings → General) tells the editor which placeholders to look for:
| Setting | Editor behavior |
|---|---|
| ICU (recommended) | ICU expressions, preview, Add ICU and Edit ICU. |
| i18next | Placeholder check for i18next placeholders. |
| Fluent | Placeholder check for Fluent placeholders. |
| None | No placeholder check. |
The format only affects the checks in the editor. Texts are stored as written, whatever the format.