ICU
Format adapter@parlajs/format-icu, built into @parlajs/compiler: a namespace
sets format: 'icu'.
{ "items": "{count, plural, =0 {Your cart is empty} one {# item} other {# items}}" }| ICU | |
|---|---|
{name} |
Placeholder |
{n, plural, =0 {…} one {# …} other {…}} |
Plural, with =N and offset |
{n, selectordinal, one {…} other {…}} |
Ordinal |
{g, select, a {…} other {…}} |
Select |
{n, number}, ::currency/EUR, percent |
Numbers: styles, skeletons and patterns |
{d, date, long}, {d, time, ::Hms} |
Dates: styles and skeletons |
<link>…</link> |
Rich text |
{name, capitalize} |
The config’s own functions |
'< quotes up to the next ', as in FormatJS: '<option>' is text, not markup.
As in ICU, a { that opens no argument, such as i18next’s {{name}}, and a plural or select with no
other fail the build: '{' writes the character.
Plurals and selects of different arguments multiply: a message of more than 10,000 variants fails the build.
A style Intl cannot honour, such as duration, ::permille or yyyy-MM-dd, fails the build.
| Differs from FormatJS | Parla, as ICU | FormatJS |
|---|---|---|
{d, date} |
medium: Nov 29, 2026 |
11/29/2026 |
short dates |
The locale’s: 29/11/2026 | Two-digit year |
{d, time, full} |
The zone’s full name | Its short one |
::percent scale/100 of 0.25 |
25% | 2,500% |
unit-width-short, -iso-code |
€5.00, EUR 5.00 | The other way round |
{n} |
Formatted: 1,000 | 1000 |
For a year or an ID, {year, number, ::group-off} is 2026, not 2,026; or pass it as a string.
::percent alone follows FormatJS: 0.25 is 25%.
The same messages in MF2: Plurals and selects.