Preview ICU MessageFormat1
Render nested ICU select and plural messages locally, and locate invisible syntax characters with original source positions.
- 1Add input
- 2Adjust settings
- 3Get your result
Tool input and files are processed in this browser without being uploaded.
Before you start
Render nested ICU select and plural messages locally, and locate invisible syntax characters with original source positions.
How to use this tool
- Paste a message or select one original UTF-8 pattern file, then paste the named parameter JSON.
- Choose the explicit locale and preview all branches with correctly typed parameters.
- For syntax errors inspect the mature code and visible codepoint positions, correct the source deliberately and retry.
- Copy or download the entire text, both unchanged originals and the parameter report before handoff.
Supported inputs and limits
Paste a pattern or select at most one strict UTF-8 message file, up to 1 MiB. The file replaces only the primary pattern; keep the secondary parameter JSON paste, also up to 1 MiB. Original filename labels allow 512 UTF-8 bytes.
Remove at most one leading UTF-8 BOM per input as transport only, record it and preserve both original byte sequences. Reject malformed UTF-8 and raw or JSON-escaped unpaired Unicode surrogates. Decoded duplicate parameter keys refuse the whole run.
Choose en-US, en-GB, zh-CN, fr-FR, ru-RU or ar-EG. Default en-US. Support literal text, optional apostrophe quoting, bare arguments, select, cardinal plural, selectordinal, offset, =selectors, # and unstyled number. Every select/plural needs other.
Parameters are scalar Unicode strings or exact mathematical safe integers from −9,007,199,254,740,991 to 9,007,199,254,740,991, checked before JavaScript Number conversion. Decimal/scientific tokens are allowed only when their value is an exact integer. Counts, offsets and =selectors must be nonnegative. Explicit =selectors use canonical decimal spelling: =0 or =[1-9][0-9]*, without a plus sign, leading zeros or −0.
Refuse fractional values, date/time, styles, skeletons, currency, rich tags/angle brackets, MF2 declarations, callbacks and resolvers. Validate required parameters and types in every AST branch, including unselected branches. Report valid unused scalar parameters.
Allow 20,000 AST nodes, 65 unquoted syntactic brace levels, 1,000 parameter names, 128 UTF-8 bytes per name and 65,536 UTF-8 bytes per string value. Quoted literal braces do not consume syntactic depth.
Complete rendered text allows 8 MiB of UTF-8. Preview only 4,000 Unicode codepoints; native copy and rendered-message.txt preserve the whole result. Download both originals and the complete parameter metadata report; hidden-character locations in the report are explicitly a first-200 preview.
Bare numeric arguments use FormatJS String(value), while number and # use this browser’s Intl locale data. Output may change with runtime locale data; this is not universal ICU4J compatibility. Syntax errors show mature codes, original UTF16 offset/line/column, UTF8 byte offset and nearby U+00A0 positions. Never repair NBSP automatically.
Worked example
Example input
{gender, select, female {{n, plural, offset:1 =1 {Alex arrived alone.} one {Alex and one guest arrived.} other {Alex and # guests arrived.}}} other {{n, plural, offset:1 =1 {Alex arrived alone.} one {Alex and one guest arrived.} other {Alex and # guests arrived.}}}}Example options
{"gender":"female","n":3}; locale=en-USExample output
Alex and 2 guests arrived.
When something does not work
Correct missing parameters, types, duplicate keys or unsupported syntax, then rerun. After cancellation keep the same selected file, parameter JSON and locale and retry. An internal parser failure is not a syntax diagnosis.
Frequently asked questions
Why can a visually identical other clause fail?
A copied NBSP U+00A0 in syntax can look like an ordinary space. The original code and nearby positions remain visible; the tool never silently replaces it. NBSP in literal text is preserved.
Does the preview match every ICU runtime?
The declared finite FormatJS profile uses bare numeric String(value) and runtime Intl for number/plural. It refuses date/time, styles, fractions and MF2; browser locale data can change output.
Documentation & further reading
Related tools
Convert text encoding
Choose the right text encoding and save a readable TXT file.
Merge text files
Put several text files together in the order you choose.
Word counter
Words, characters, and paragraphs at a glance.
Case converter
Change letter case to suit your text.