v1.1.0 — Added Ordinal Support, Updated Locale Data
This is feature release which adds support for selectordinal
arguments in message (#84), has updated locale data with support for new languages, and improves locale resolution.
Select Ordinal Arguments
selectordinal
arguments in messages are just like plural
arguments, expect the ordinal pluralization rules are used; e.g., to display which birthday your about to have:
It's your {year, selectordinal,
one {#st}
two {#nd}
few {#rd}
other{#th}
} birthday!
message.format({year: 30});
// => "It's my 30th birthday!"
Updated Locale Data
The locale data has also been vastly improved in the following ways:
- Added
pt-PT
plural rule function, which differs frompt
's. - Properly de-duplicate data for all CLDR locales by correctly traversing a locale's hierarchy of ancestor locales.
- Added data for the following languages:
aa, agq, bas, bh, ckb, dav, dje, dsb, dua, dv, dyo, ebu, ewo, guw, guz, hsb, ia, in, iu, iw, jbo, ji, jv, jw, kaj, kam, kcg, khq, ki, kln, kok, ksf, ku, lb, lu, luo, luy, mer, mfe, mgh, mo, mua, nah, nmg, no, nqo, nus, ny, pap, prg, qu, rn, rw, sbp, sh, sma, smi, smj, smn, sms, swc, syr, tk, tl, twq, vai, wa, wo, yav, yi, zgh
Improved Locale Resolution
This release also includes improvements for how locales are resolved. Here are some details of these changes:
-
If no extra locale data is loaded, the locale will always resolved to
en
. -
If locale data is missing for a leaf locale like
fr-FR
, but there is data for the root,fr
in this case, then its root will be used. -
If there's data for the specified locale, then that locale will be resolved; i.e.,
var mf = new IntlMessageFormat('some message', 'en-US'); assert(mf.resolvedOptions().locale === 'en-US'); // true
-
The resolved locales are now normalized; e.g.,
en-us
will resolve to:en-US
.