ICU MessageFormat Tester
Render an ICU MessageFormat template with plural/select arms.
Overview
Paste an ICU MessageFormat template - the localisation syntax used by FormatJS, i18next, MessageFormat.js, and CLDR-aware libraries - and provide a JSON payload with the variable values. The tester renders the final string and reports any syntactic errors.
It's for developers and translators wiring up plural/select messages, gender-aware copy, or number/date formatting. Reach for it when testing a new translation key before shipping, verifying that a translator's plural arms align with the locale's rules, or debugging an unexpected fallback to the other clause.
How it works
ICU MessageFormat is a templating language defined by the ICU project and used as the de facto standard for non-trivial localisation. The grammar supports {placeholder} substitution, {count, plural, one {...} other {...}} for plural-aware messages, {gender, select, male {...} female {...} other {...}} for arbitrary value-keyed selection, and {value, number} / {value, date} formatters.
Plural categories come from CLDR's plural rules - in English one and other, in Polish one, few, many, and other. The tester picks the right category for the current locale based on the numeric value.
Examples
- Simple substitution:
Template: Hello, {name} Data: { "name": "Alex" } Output: Hello, Alex - Plural arms:
Template: {count, plural, one {1 file} other {# files}} Data: { "count": 3 } Output: 3 files - Select on a string value:
Template: {role, select, admin {Welcome, boss} other {Welcome}} Data: { "role": "admin" } Output: Welcome, boss - Nested with hash interpolation:
{count, plural, =0 {No items} one {1 item} other {# items}}
FAQ
What's the # inside plural arms?
# is shorthand for the plural's value formatted as a number. Use it inside the arms to avoid repeating {count}.
Difference between =0 and other?
=0 is an exact-value match that overrides the CLDR plural category. Use exact matches for special-cased zero/one cases your designer wants worded differently from the general plural.
What if a translator forgets the other arm?
other is mandatory in plural and select - it's the fallback when no other arm matches. The tester flags it as a syntax error if missing.
Can I nest plurals?
Yes - a select can contain plural arms and vice versa. Keep it readable; deep nesting becomes hard for translators to work with.