ICU Message Syntax

How Applanga handles ICU Message Syntax

Applanga now supports ICU Message Syntax. ICU Message Syntax is a set of components for software localization. It incorporates a special syntax that can be a part of strings for plurals, time, variables such as gender and other types of translations that may be switched based on context. It is often used in arb files, yaml, po and other file types.

Strings that are formatted with ICU syntax can have different options that are called “arguments”. Each argument is enclosed within {curly braces} and refers to a value included in the input data.

Applanga supports ICU Message syntax for the following types of arguments:

  • Plurals & Numbers
  • Time & Dates
  • Select

Table of Contents

  1. ICU Message Syntax in the Editor
  2. ICU Message Syntax and Translation Orders
  3. ICU Message Syntax Arguments

ICU Message Syntax in the Applanga Editor

When uploading strings to the Applanga dashboard, ICU syntax found within strings are included in the upload. ICU syntax is highlighted in gray in the Editor / String Management Interface.


Back to Top

ICU Message Syntax and Translation Orders

If content with ICU syntax is included in translation orders via the Applanga Order menu, the syntax is removed from the editable text. The TransPerfect translators will not be able to alter the ICU Message syntax, only the translate content in between. This prevents any accidental issues with the code such as the removal of a bracket. When translations are delivered, they will include the syntax placed at the most appropriate section by the translator.

If a key has ICU Message Syntax in the source value and it is completely missing or even just slightly different in the target value, the String Management Interface generates a warning. Users can filter to locate those strings with the missing variables filter - simply click the filter icon (1), then With Issues (2), and select Variable Missing (3).

The warning will indicate what is missing from the translated string:


Back to Top

ICU Message Syntax Arguments

Plurals

Plural type arguments are used to handle plural category variations as each language has its own rules for handling plurals. Pluralization uses CLDR rules for the given locale. Some languages have two forms, like English; some languages have only a single form; and some languages have multiple forms. Plural categories include:

  • Zero
  • one (singular)
  • two (dual)
  • few (paucal)
  • many (also used for fractions if they have a separate class)
  • other (required—general plural form—also used if the language only has a single form)

Example:

Note: plural type arguments with # notations won't work on Flutter, so we recommend that you avoid using them.

Numbers

The number type displays different values such as percentages and currency based on the locale conventions. This enables adjustment of the message output to the formats used for different locales.

Example:

Date & Time

Date and time types show date and time values according to the preferred formatting for a given locale. ICU message syntax supports predefined custom date formatting. There are four predefined date formats: short, medium, long, full.

Example:

Select

The Select type is often used to represent the appropriate gender-based inflections or verb conjugations for a given message.

Example:


Back to Top