ICU MessageFormat Syntax Validator
Analyze ICU MessageFormat messages detecting malformed placeholders, plurals missing the other case, missing select branches and invalid types.
Understanding ICU MessageFormat
ICU MessageFormat is the message syntax used for internationalization (i18n) by tools such as FormatJS / react-intl, MessageFormat.js, and the ICU4J / ICU4C libraries. It lets a single localized string adapt to runtime values โ counts, genders, currencies, dates โ without hardcoding grammar for each language. Validating a message means checking that braces are balanced and that every argument uses a known type with valid sub-syntax.
Placeholders and argument types
The simplest placeholder is just a name in braces: Hello, {name}!. Typed arguments add a type and options:
- plural:
{count, plural, one {# item} other {# items}} - select:
{g, select, male {he} female {she} other {they}} - number:
{n, number, ::currency/USD} - date / time:
{d, date, short} - Other types include selectordinal and the deprecated choice.
Inside a plural block, the # symbol is replaced by the formatted count. Always provide an other branch โ it is the required fallback.
Escaping literals
Because braces and # are special, you escape literal characters with apostrophes. A single quote starts and ends a literal section, and '' produces a literal apostrophe. So '{not a placeholder}' renders the braces verbatim.
Common pitfalls
- Unbalanced braces โ an opening
{with no matching}. - Omitting the mandatory
otherbranch in apluralorselect. - Using an unknown argument type (e.g.
fooinstead ofplural/select/number). - Forgetting that
#only works inside aplural/selectordinal, not elsewhere. - Putting a literal apostrophe without doubling it, which silently starts an escape.
FAQ
What is the difference between plural and select? plural matches CLDR plural categories (one, other, etc.) for a number, while select matches arbitrary string keys you define, such as a gender value.
Why must I always include other? It is the guaranteed fallback when no other case matches, and languages differ wildly in their plural rules, so the parser enforces it.
Is choice safe to use? No โ the choice argument type is deprecated. Use plural or select instead.
Related Tools
CSS Named Color Validator
Check if a string is a standard CSS named color and resolve hex.
Base32 Validator
Check whether a string is valid Base32 (RFC 4648). Accepts = padding. Shows payload size in bytes.
Base58 Validator
Validate Base58 (Bitcoin alphabet, no 0, O, I, l).
Base64 Validator
Check whether a string is valid Base64 (with or without padding). Shows decoded size and whether content looks like UTF-8 or binary.
Base91 Validator
Check if a string uses only Base91 characters (letters, digits and specific symbols like !#$%&()*+...). Format only.
BIC / SWIFT Validator
Validate the format of a bank BIC/SWIFT code (8 or 11 characters) used in international transfers. Check the bank code before sending money abroad.