forked from formatjs/intl-messageformat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
selectordinal
support and improve locale data
This upgrades to intl-messageformat-parser@1.1.0 and adds support for `selectordinal` arguments; e.g.: ``` This is my {year, selectordinal, one {#st} two {#nd} few {#rd} other{#th} } birthday. ``` The locale data has also been vastly improved in the following ways: * Added `pt-PT` plural rule function, which differs from `pt`'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 ---- These changes also include 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('', 'en-US'); assert(mf.resolvedOptions().locale === 'en-US'); // true * The resolved locales are now normalized; e.g., `en-us` will resolve to: `en-US`. Fixes formatjs#84
- Loading branch information
Showing
6 changed files
with
159 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// GENERATED FILE | ||
export default {"locale":"en","pluralRuleFunction":function (n) {var i=Math.floor(Math.abs(n)),v=n.toString().replace(/^[^.]*\.?/,"").length;n=Math.floor(n);if(i===1&&v===0)return"one";return"other";}}; | ||
export default {"locale":"en","pluralRuleFunction":function (n,ord){var s=String(n).split("."),v0=!s[1],t0=Number(s[0])==n,n10=t0&&s[0].substr(-1),n100=t0&&s[0].substr(-2);if(ord)return n10==1&&n100!=11?"one":n10==2&&n100!=12?"two":n10==3&&n100!=13?"few":"other";return n==1&&v0?"one":"other"}}; |
Oops, something went wrong.