Manual
CLI
API
Log in Get started free

ICU messages and placeholders

Plurals, selects, numbers and dates in the ICU message format, and how the editor checks placeholders.

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 #

KindExample
VariableHello {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.

Placeholder 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:

SettingEditor behavior
ICU (recommended)ICU expressions, preview, Add ICU and Edit ICU.
i18nextPlaceholder check for i18next placeholders.
FluentPlaceholder check for Fluent placeholders.
NoneNo placeholder check.

The format only affects the checks in the editor. Texts are stored as written, whatever the format.