How GL Strings handles ICU Message Syntax
GL Strings 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.
GL Strings supports ICU Message syntax for the following types of arguments:
When uploading strings to the GL Strings dashboard, ICU syntax found within strings are included in the upload. ICU syntax is highlighted in gray in the Editor / String Management Interface.
If content with ICU syntax is included in translation orders via the GL Strings 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:
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:
Example:
Note: plural type arguments with # notations won't work on Flutter, so we recommend that you avoid using them.
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 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:
The Select type is often used to represent the appropriate gender-based inflections or verb conjugations for a given message.
Example: