intl-messageformat 1.0.3 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -19
- package/dist/intl-messageformat-with-locales.js +1095 -346
- package/dist/intl-messageformat-with-locales.js.map +1 -1
- package/dist/intl-messageformat-with-locales.min.js +4 -2
- package/dist/intl-messageformat-with-locales.min.js.map +1 -1
- package/dist/intl-messageformat.js +309 -186
- package/dist/intl-messageformat.js.map +1 -1
- package/dist/intl-messageformat.min.js +1 -1
- package/dist/intl-messageformat.min.js.map +1 -1
- package/dist/locale-data/af.js +2 -1
- package/dist/locale-data/agq.js +1 -0
- package/dist/locale-data/ak.js +1 -1
- package/dist/locale-data/am.js +1 -1
- package/dist/locale-data/ar.js +28 -1
- package/dist/locale-data/as.js +1 -1
- package/dist/locale-data/asa.js +1 -1
- package/dist/locale-data/ast.js +1 -1
- package/dist/locale-data/az.js +4 -1
- package/dist/locale-data/bas.js +1 -0
- package/dist/locale-data/be.js +1 -1
- package/dist/locale-data/bem.js +1 -1
- package/dist/locale-data/bez.js +1 -1
- package/dist/locale-data/bg.js +1 -1
- package/dist/locale-data/bh.js +1 -0
- package/dist/locale-data/bm.js +2 -1
- package/dist/locale-data/bn.js +2 -1
- package/dist/locale-data/bo.js +2 -1
- package/dist/locale-data/br.js +1 -1
- package/dist/locale-data/brx.js +1 -1
- package/dist/locale-data/bs.js +3 -1
- package/dist/locale-data/ca.js +6 -1
- package/dist/locale-data/ce.js +1 -0
- package/dist/locale-data/cgg.js +1 -1
- package/dist/locale-data/chr.js +1 -1
- package/dist/locale-data/ckb.js +2 -0
- package/dist/locale-data/cs.js +1 -1
- package/dist/locale-data/cu.js +1 -0
- package/dist/locale-data/cy.js +1 -1
- package/dist/locale-data/da.js +2 -1
- package/dist/locale-data/dav.js +1 -0
- package/dist/locale-data/de.js +6 -1
- package/dist/locale-data/dje.js +1 -0
- package/dist/locale-data/dsb.js +1 -0
- package/dist/locale-data/dua.js +1 -0
- package/dist/locale-data/dv.js +1 -0
- package/dist/locale-data/dyo.js +1 -0
- package/dist/locale-data/dz.js +1 -1
- package/dist/locale-data/ebu.js +1 -0
- package/dist/locale-data/ee.js +2 -1
- package/dist/locale-data/el.js +2 -1
- package/dist/locale-data/en.js +107 -1
- package/dist/locale-data/eo.js +1 -1
- package/dist/locale-data/es.js +26 -1
- package/dist/locale-data/et.js +1 -1
- package/dist/locale-data/eu.js +1 -1
- package/dist/locale-data/ewo.js +1 -0
- package/dist/locale-data/fa.js +2 -1
- package/dist/locale-data/ff.js +4 -1
- package/dist/locale-data/fi.js +1 -1
- package/dist/locale-data/fil.js +1 -1
- package/dist/locale-data/fo.js +2 -1
- package/dist/locale-data/fr.js +46 -1
- package/dist/locale-data/fur.js +1 -1
- package/dist/locale-data/fy.js +1 -1
- package/dist/locale-data/ga.js +1 -1
- package/dist/locale-data/gd.js +1 -1
- package/dist/locale-data/gl.js +1 -1
- package/dist/locale-data/gsw.js +3 -1
- package/dist/locale-data/gu.js +1 -1
- package/dist/locale-data/guw.js +1 -0
- package/dist/locale-data/guz.js +1 -0
- package/dist/locale-data/gv.js +1 -1
- package/dist/locale-data/ha.js +4 -1
- package/dist/locale-data/haw.js +1 -1
- package/dist/locale-data/he.js +1 -1
- package/dist/locale-data/hi.js +1 -1
- package/dist/locale-data/hr.js +2 -1
- package/dist/locale-data/hsb.js +1 -0
- package/dist/locale-data/hu.js +1 -1
- package/dist/locale-data/hy.js +1 -1
- package/dist/locale-data/id.js +1 -1
- package/dist/locale-data/ig.js +1 -1
- package/dist/locale-data/ii.js +1 -1
- package/dist/locale-data/in.js +1 -0
- package/dist/locale-data/is.js +1 -1
- package/dist/locale-data/it.js +3 -1
- package/dist/locale-data/iu.js +2 -0
- package/dist/locale-data/iw.js +1 -0
- package/dist/locale-data/ja.js +1 -1
- package/dist/locale-data/jbo.js +1 -0
- package/dist/locale-data/jgo.js +1 -1
- package/dist/locale-data/ji.js +1 -0
- package/dist/locale-data/jmc.js +1 -1
- package/dist/locale-data/jv.js +1 -0
- package/dist/locale-data/jw.js +1 -0
- package/dist/locale-data/ka.js +1 -1
- package/dist/locale-data/kab.js +1 -1
- package/dist/locale-data/kaj.js +1 -0
- package/dist/locale-data/kam.js +1 -0
- package/dist/locale-data/kcg.js +1 -0
- package/dist/locale-data/kde.js +1 -1
- package/dist/locale-data/kea.js +1 -1
- package/dist/locale-data/khq.js +1 -0
- package/dist/locale-data/ki.js +1 -0
- package/dist/locale-data/kk.js +1 -1
- package/dist/locale-data/kkj.js +1 -1
- package/dist/locale-data/kl.js +1 -1
- package/dist/locale-data/kln.js +1 -0
- package/dist/locale-data/km.js +1 -1
- package/dist/locale-data/kn.js +1 -1
- package/dist/locale-data/ko.js +2 -1
- package/dist/locale-data/kok.js +1 -0
- package/dist/locale-data/ks.js +1 -1
- package/dist/locale-data/ksb.js +1 -1
- package/dist/locale-data/ksf.js +1 -0
- package/dist/locale-data/ksh.js +1 -1
- package/dist/locale-data/ku.js +1 -0
- package/dist/locale-data/kw.js +1 -1
- package/dist/locale-data/ky.js +1 -1
- package/dist/locale-data/lag.js +1 -1
- package/dist/locale-data/lb.js +1 -0
- package/dist/locale-data/lg.js +1 -1
- package/dist/locale-data/lkt.js +1 -1
- package/dist/locale-data/ln.js +4 -1
- package/dist/locale-data/lo.js +1 -1
- package/dist/locale-data/lrc.js +2 -0
- package/dist/locale-data/lt.js +1 -1
- package/dist/locale-data/lu.js +1 -0
- package/dist/locale-data/luo.js +1 -0
- package/dist/locale-data/luy.js +1 -0
- package/dist/locale-data/lv.js +1 -1
- package/dist/locale-data/mas.js +2 -1
- package/dist/locale-data/mer.js +1 -0
- package/dist/locale-data/mfe.js +1 -0
- package/dist/locale-data/mg.js +1 -1
- package/dist/locale-data/mgh.js +1 -0
- package/dist/locale-data/mgo.js +1 -1
- package/dist/locale-data/mk.js +1 -1
- package/dist/locale-data/ml.js +1 -1
- package/dist/locale-data/mn.js +2 -1
- package/dist/locale-data/mo.js +1 -0
- package/dist/locale-data/mr.js +1 -1
- package/dist/locale-data/ms.js +4 -1
- package/dist/locale-data/mt.js +1 -1
- package/dist/locale-data/mua.js +1 -0
- package/dist/locale-data/my.js +1 -1
- package/dist/locale-data/mzn.js +1 -0
- package/dist/locale-data/nah.js +1 -0
- package/dist/locale-data/naq.js +1 -1
- package/dist/locale-data/nb.js +2 -1
- package/dist/locale-data/nd.js +1 -1
- package/dist/locale-data/ne.js +2 -1
- package/dist/locale-data/nl.js +7 -1
- package/dist/locale-data/nmg.js +1 -0
- package/dist/locale-data/nn.js +1 -1
- package/dist/locale-data/nnh.js +1 -1
- package/dist/locale-data/no.js +1 -0
- package/dist/locale-data/nqo.js +1 -0
- package/dist/locale-data/nr.js +1 -1
- package/dist/locale-data/nso.js +1 -1
- package/dist/locale-data/nus.js +1 -0
- package/dist/locale-data/ny.js +1 -0
- package/dist/locale-data/nyn.js +1 -1
- package/dist/locale-data/om.js +2 -1
- package/dist/locale-data/or.js +1 -1
- package/dist/locale-data/os.js +2 -1
- package/dist/locale-data/pa.js +3 -1
- package/dist/locale-data/pap.js +1 -0
- package/dist/locale-data/pl.js +1 -1
- package/dist/locale-data/prg.js +1 -0
- package/dist/locale-data/ps.js +1 -1
- package/dist/locale-data/pt.js +9 -1
- package/dist/locale-data/qu.js +3 -0
- package/dist/locale-data/rm.js +1 -1
- package/dist/locale-data/rn.js +1 -0
- package/dist/locale-data/ro.js +2 -1
- package/dist/locale-data/rof.js +1 -1
- package/dist/locale-data/ru.js +6 -1
- package/dist/locale-data/rw.js +1 -0
- package/dist/locale-data/rwk.js +1 -1
- package/dist/locale-data/sah.js +1 -1
- package/dist/locale-data/saq.js +1 -1
- package/dist/locale-data/sbp.js +1 -0
- package/dist/locale-data/sdh.js +1 -0
- package/dist/locale-data/se.js +3 -1
- package/dist/locale-data/seh.js +1 -1
- package/dist/locale-data/ses.js +1 -1
- package/dist/locale-data/sg.js +1 -1
- package/dist/locale-data/sh.js +1 -0
- package/dist/locale-data/shi.js +3 -1
- package/dist/locale-data/si.js +1 -1
- package/dist/locale-data/sk.js +1 -1
- package/dist/locale-data/sl.js +1 -1
- package/dist/locale-data/sma.js +1 -0
- package/dist/locale-data/smi.js +1 -0
- package/dist/locale-data/smj.js +1 -0
- package/dist/locale-data/smn.js +1 -0
- package/dist/locale-data/sms.js +1 -0
- package/dist/locale-data/sn.js +1 -1
- package/dist/locale-data/so.js +4 -1
- package/dist/locale-data/sq.js +3 -1
- package/dist/locale-data/sr.js +9 -1
- package/dist/locale-data/ss.js +1 -1
- package/dist/locale-data/ssy.js +1 -1
- package/dist/locale-data/st.js +1 -1
- package/dist/locale-data/sv.js +3 -1
- package/dist/locale-data/sw.js +4 -1
- package/dist/locale-data/syr.js +1 -0
- package/dist/locale-data/ta.js +4 -1
- package/dist/locale-data/te.js +1 -1
- package/dist/locale-data/teo.js +2 -1
- package/dist/locale-data/th.js +1 -1
- package/dist/locale-data/ti.js +2 -1
- package/dist/locale-data/tig.js +1 -1
- package/dist/locale-data/tk.js +1 -0
- package/dist/locale-data/tl.js +1 -0
- package/dist/locale-data/tn.js +1 -1
- package/dist/locale-data/to.js +1 -1
- package/dist/locale-data/tr.js +2 -1
- package/dist/locale-data/ts.js +1 -1
- package/dist/locale-data/twq.js +1 -0
- package/dist/locale-data/tzm.js +1 -1
- package/dist/locale-data/ug.js +1 -1
- package/dist/locale-data/uk.js +1 -1
- package/dist/locale-data/ur.js +2 -1
- package/dist/locale-data/uz.js +4 -1
- package/dist/locale-data/vai.js +3 -0
- package/dist/locale-data/ve.js +1 -1
- package/dist/locale-data/vi.js +1 -1
- package/dist/locale-data/vo.js +1 -1
- package/dist/locale-data/vun.js +1 -1
- package/dist/locale-data/wa.js +1 -0
- package/dist/locale-data/wae.js +1 -1
- package/dist/locale-data/wo.js +1 -0
- package/dist/locale-data/xh.js +1 -1
- package/dist/locale-data/xog.js +1 -1
- package/dist/locale-data/yav.js +1 -0
- package/dist/locale-data/yi.js +1 -0
- package/dist/locale-data/yo.js +2 -1
- package/dist/locale-data/zgh.js +1 -0
- package/dist/locale-data/zh.js +8 -1
- package/dist/locale-data/zu.js +1 -1
- package/lib/compiler.js +21 -10
- package/lib/core.js +54 -35
- package/lib/en.js +2 -1
- package/lib/es5.js +8 -0
- package/lib/locales.js +554 -161
- package/lib/main.js +5 -3
- package/lib/utils.js +8 -0
- package/package.json +10 -9
- package/src/compiler.js +13 -10
- package/src/core.js +44 -33
- package/src/en.js +1 -1
- package/bower.json +0 -40
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"sbp","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"sdh","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
package/dist/locale-data/se.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"se","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"se","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":n==2?"two":"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"se-FI","parentLocale":"se"});
|
|
3
|
+
IntlMessageFormat.__addLocaleData({"locale":"se-SE","parentLocale":"se"});
|
package/dist/locale-data/seh.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"seh","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"seh","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
package/dist/locale-data/ses.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"ses","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"ses","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
package/dist/locale-data/sg.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"sg","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"sg","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"sh","pluralRuleFunction":function (n,ord){var s=String(n).split("."),i=s[0],f=s[1]||"",v0=!s[1],i10=i.slice(-1),i100=i.slice(-2),f10=f.slice(-1),f100=f.slice(-2);if(ord)return"other";return v0&&i10==1&&i100!=11||f10==1&&f100!=11?"one":v0&&(i10>=2&&i10<=4)&&(i100<12||i100>14)||f10>=2&&f10<=4&&(f100<12||f100>14)?"few":"other"}});
|
package/dist/locale-data/shi.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"shi","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"shi","pluralRuleFunction":function (n,ord){var s=String(n).split("."),t0=Number(s[0])==n;if(ord)return"other";return n>=0&&n<=1?"one":t0&&n>=2&&n<=10?"few":"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"shi-Latn","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
|
3
|
+
IntlMessageFormat.__addLocaleData({"locale":"shi-Tfng","parentLocale":"shi"});
|
package/dist/locale-data/si.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"si","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"si","pluralRuleFunction":function (n,ord){var s=String(n).split("."),i=s[0],f=s[1]||"";if(ord)return"other";return n==0||n==1||i==0&&f==1?"one":"other"}});
|
package/dist/locale-data/sk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"sk","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"sk","pluralRuleFunction":function (n,ord){var s=String(n).split("."),i=s[0],v0=!s[1];if(ord)return"other";return n==1&&v0?"one":i>=2&&i<=4&&v0?"few":!v0?"many":"other"}});
|
package/dist/locale-data/sl.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"sl","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"sl","pluralRuleFunction":function (n,ord){var s=String(n).split("."),i=s[0],v0=!s[1],i100=i.slice(-2);if(ord)return"other";return v0&&i100==1?"one":v0&&i100==2?"two":v0&&(i100==3||i100==4)||!v0?"few":"other"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"sma","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":n==2?"two":"other"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"smi","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":n==2?"two":"other"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"smj","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":n==2?"two":"other"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"smn","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":n==2?"two":"other"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"sms","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":n==2?"two":"other"}});
|
package/dist/locale-data/sn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"sn","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"sn","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
package/dist/locale-data/so.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"so","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"so","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"so-DJ","parentLocale":"so"});
|
|
3
|
+
IntlMessageFormat.__addLocaleData({"locale":"so-ET","parentLocale":"so"});
|
|
4
|
+
IntlMessageFormat.__addLocaleData({"locale":"so-KE","parentLocale":"so"});
|
package/dist/locale-data/sq.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"sq","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"sq","pluralRuleFunction":function (n,ord){var s=String(n).split("."),t0=Number(s[0])==n,n10=t0&&s[0].slice(-1),n100=t0&&s[0].slice(-2);if(ord)return n==1?"one":n10==4&&n100!=14?"many":"other";return n==1?"one":"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"sq-MK","parentLocale":"sq"});
|
|
3
|
+
IntlMessageFormat.__addLocaleData({"locale":"sq-XK","parentLocale":"sq"});
|
package/dist/locale-data/sr.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"sr","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"sr","pluralRuleFunction":function (n,ord){var s=String(n).split("."),i=s[0],f=s[1]||"",v0=!s[1],i10=i.slice(-1),i100=i.slice(-2),f10=f.slice(-1),f100=f.slice(-2);if(ord)return"other";return v0&&i10==1&&i100!=11||f10==1&&f100!=11?"one":v0&&(i10>=2&&i10<=4)&&(i100<12||i100>14)||f10>=2&&f10<=4&&(f100<12||f100>14)?"few":"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"sr-Cyrl","parentLocale":"sr"});
|
|
3
|
+
IntlMessageFormat.__addLocaleData({"locale":"sr-Cyrl-BA","parentLocale":"sr-Cyrl"});
|
|
4
|
+
IntlMessageFormat.__addLocaleData({"locale":"sr-Cyrl-ME","parentLocale":"sr-Cyrl"});
|
|
5
|
+
IntlMessageFormat.__addLocaleData({"locale":"sr-Cyrl-XK","parentLocale":"sr-Cyrl"});
|
|
6
|
+
IntlMessageFormat.__addLocaleData({"locale":"sr-Latn","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
|
7
|
+
IntlMessageFormat.__addLocaleData({"locale":"sr-Latn-BA","parentLocale":"sr-Latn"});
|
|
8
|
+
IntlMessageFormat.__addLocaleData({"locale":"sr-Latn-ME","parentLocale":"sr-Latn"});
|
|
9
|
+
IntlMessageFormat.__addLocaleData({"locale":"sr-Latn-XK","parentLocale":"sr-Latn"});
|
package/dist/locale-data/ss.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"ss","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"ss","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
package/dist/locale-data/ssy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"ssy","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"ssy","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
package/dist/locale-data/st.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"st","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"st","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
package/dist/locale-data/sv.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"sv","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"sv","pluralRuleFunction":function (n,ord){var s=String(n).split("."),v0=!s[1],t0=Number(s[0])==n,n10=t0&&s[0].slice(-1),n100=t0&&s[0].slice(-2);if(ord)return(n10==1||n10==2)&&n100!=11&&n100!=12?"one":"other";return n==1&&v0?"one":"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"sv-AX","parentLocale":"sv"});
|
|
3
|
+
IntlMessageFormat.__addLocaleData({"locale":"sv-FI","parentLocale":"sv"});
|
package/dist/locale-data/sw.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"sw","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"sw","pluralRuleFunction":function (n,ord){var s=String(n).split("."),v0=!s[1];if(ord)return"other";return n==1&&v0?"one":"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"sw-CD","parentLocale":"sw"});
|
|
3
|
+
IntlMessageFormat.__addLocaleData({"locale":"sw-KE","parentLocale":"sw"});
|
|
4
|
+
IntlMessageFormat.__addLocaleData({"locale":"sw-UG","parentLocale":"sw"});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"syr","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
package/dist/locale-data/ta.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"ta","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"ta","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"ta-LK","parentLocale":"ta"});
|
|
3
|
+
IntlMessageFormat.__addLocaleData({"locale":"ta-MY","parentLocale":"ta"});
|
|
4
|
+
IntlMessageFormat.__addLocaleData({"locale":"ta-SG","parentLocale":"ta"});
|
package/dist/locale-data/te.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"te","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"te","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
package/dist/locale-data/teo.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"teo","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"teo","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"teo-KE","parentLocale":"teo"});
|
package/dist/locale-data/th.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"th","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"th","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
package/dist/locale-data/ti.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"ti","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"ti","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==0||n==1?"one":"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"ti-ER","parentLocale":"ti"});
|
package/dist/locale-data/tig.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"tig","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"tig","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"tk","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"tl","pluralRuleFunction":function (n,ord){var s=String(n).split("."),i=s[0],f=s[1]||"",v0=!s[1],i10=i.slice(-1),f10=f.slice(-1);if(ord)return n==1?"one":"other";return v0&&(i==1||i==2||i==3)||v0&&i10!=4&&i10!=6&&i10!=9||!v0&&f10!=4&&f10!=6&&f10!=9?"one":"other"}});
|
package/dist/locale-data/tn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"tn","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"tn","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
package/dist/locale-data/to.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"to","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"to","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
package/dist/locale-data/tr.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"tr","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"tr","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"tr-CY","parentLocale":"tr"});
|
package/dist/locale-data/ts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"ts","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"ts","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"twq","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
package/dist/locale-data/tzm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"tzm","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"tzm","pluralRuleFunction":function (n,ord){var s=String(n).split("."),t0=Number(s[0])==n;if(ord)return"other";return n==0||n==1||t0&&n>=11&&n<=99?"one":"other"}});
|
package/dist/locale-data/ug.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"ug","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"ug","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
package/dist/locale-data/uk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"uk","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"uk","pluralRuleFunction":function (n,ord){var s=String(n).split("."),i=s[0],v0=!s[1],t0=Number(s[0])==n,n10=t0&&s[0].slice(-1),n100=t0&&s[0].slice(-2),i10=i.slice(-1),i100=i.slice(-2);if(ord)return n10==3&&n100!=13?"few":"other";return v0&&i10==1&&i100!=11?"one":v0&&(i10>=2&&i10<=4)&&(i100<12||i100>14)?"few":v0&&i10==0||v0&&(i10>=5&&i10<=9)||v0&&(i100>=11&&i100<=14)?"many":"other"}});
|
package/dist/locale-data/ur.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"ur","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"ur","pluralRuleFunction":function (n,ord){var s=String(n).split("."),v0=!s[1];if(ord)return"other";return n==1&&v0?"one":"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"ur-IN","parentLocale":"ur"});
|
package/dist/locale-data/uz.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"uz","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"uz","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"uz-Arab","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
|
3
|
+
IntlMessageFormat.__addLocaleData({"locale":"uz-Cyrl","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
|
4
|
+
IntlMessageFormat.__addLocaleData({"locale":"uz-Latn","parentLocale":"uz"});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"vai","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"vai-Latn","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
|
3
|
+
IntlMessageFormat.__addLocaleData({"locale":"vai-Vaii","parentLocale":"vai"});
|
package/dist/locale-data/ve.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"ve","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"ve","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
package/dist/locale-data/vi.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"vi","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"vi","pluralRuleFunction":function (n,ord){if(ord)return n==1?"one":"other";return"other"}});
|
package/dist/locale-data/vo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"vo","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"vo","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
package/dist/locale-data/vun.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"vun","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"vun","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"wa","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==0||n==1?"one":"other"}});
|
package/dist/locale-data/wae.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"wae","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"wae","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"wo","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
package/dist/locale-data/xh.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"xh","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"xh","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
package/dist/locale-data/xog.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"xog","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"xog","pluralRuleFunction":function (n,ord){if(ord)return"other";return n==1?"one":"other"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"yav","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"yi","pluralRuleFunction":function (n,ord){var s=String(n).split("."),v0=!s[1];if(ord)return"other";return n==1&&v0?"one":"other"}});
|
package/dist/locale-data/yo.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"yo","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"yo","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"yo-BJ","parentLocale":"yo"});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"zgh","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
package/dist/locale-data/zh.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"zh","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"zh","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
|
2
|
+
IntlMessageFormat.__addLocaleData({"locale":"zh-Hans","parentLocale":"zh"});
|
|
3
|
+
IntlMessageFormat.__addLocaleData({"locale":"zh-Hans-HK","parentLocale":"zh-Hans"});
|
|
4
|
+
IntlMessageFormat.__addLocaleData({"locale":"zh-Hans-MO","parentLocale":"zh-Hans"});
|
|
5
|
+
IntlMessageFormat.__addLocaleData({"locale":"zh-Hans-SG","parentLocale":"zh-Hans"});
|
|
6
|
+
IntlMessageFormat.__addLocaleData({"locale":"zh-Hant","pluralRuleFunction":function (n,ord){if(ord)return"other";return"other"}});
|
|
7
|
+
IntlMessageFormat.__addLocaleData({"locale":"zh-Hant-HK","parentLocale":"zh-Hant"});
|
|
8
|
+
IntlMessageFormat.__addLocaleData({"locale":"zh-Hant-MO","parentLocale":"zh-Hant-HK"});
|
package/dist/locale-data/zu.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
IntlMessageFormat.__addLocaleData({"locale":"zu","pluralRuleFunction":function (n)
|
|
1
|
+
IntlMessageFormat.__addLocaleData({"locale":"zu","pluralRuleFunction":function (n,ord){if(ord)return"other";return n>=0&&n<=1?"one":"other"}});
|
package/lib/compiler.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2014, Yahoo! Inc. All rights reserved.
|
|
3
|
+
Copyrights licensed under the New BSD License.
|
|
4
|
+
See the accompanying LICENSE file for terms.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* jslint esnext: true */
|
|
8
|
+
|
|
1
9
|
"use strict";
|
|
2
10
|
exports["default"] = Compiler;
|
|
3
11
|
|
|
@@ -103,7 +111,9 @@ Compiler.prototype.compileArgument = function (element) {
|
|
|
103
111
|
|
|
104
112
|
case 'pluralFormat':
|
|
105
113
|
options = this.compileOptions(element);
|
|
106
|
-
return new PluralFormat(
|
|
114
|
+
return new PluralFormat(
|
|
115
|
+
element.id, format.ordinal, format.offset, options, pluralFn
|
|
116
|
+
);
|
|
107
117
|
|
|
108
118
|
case 'selectFormat':
|
|
109
119
|
options = this.compileOptions(element);
|
|
@@ -120,8 +130,8 @@ Compiler.prototype.compileOptions = function (element) {
|
|
|
120
130
|
optionsHash = {};
|
|
121
131
|
|
|
122
132
|
// Save the current plural element, if any, then set it to a new value when
|
|
123
|
-
// compiling the options sub-patterns. This
|
|
124
|
-
// for handling `"#"`
|
|
133
|
+
// compiling the options sub-patterns. This conforms the spec's algorithm
|
|
134
|
+
// for handling `"#"` syntax in message text.
|
|
125
135
|
this.pluralStack.push(this.currentPlural);
|
|
126
136
|
this.currentPlural = format.type === 'pluralFormat' ? element : null;
|
|
127
137
|
|
|
@@ -134,7 +144,7 @@ Compiler.prototype.compileOptions = function (element) {
|
|
|
134
144
|
optionsHash[option.selector] = this.compileMessage(option.value);
|
|
135
145
|
}
|
|
136
146
|
|
|
137
|
-
// Pop the plural stack to put back the original
|
|
147
|
+
// Pop the plural stack to put back the original current plural value.
|
|
138
148
|
this.currentPlural = this.pluralStack.pop();
|
|
139
149
|
|
|
140
150
|
return optionsHash;
|
|
@@ -154,18 +164,19 @@ StringFormat.prototype.format = function (value) {
|
|
|
154
164
|
return typeof value === 'string' ? value : String(value);
|
|
155
165
|
};
|
|
156
166
|
|
|
157
|
-
function PluralFormat(id, offset, options, pluralFn) {
|
|
158
|
-
this.id
|
|
159
|
-
this.
|
|
160
|
-
this.
|
|
161
|
-
this.
|
|
167
|
+
function PluralFormat(id, useOrdinal, offset, options, pluralFn) {
|
|
168
|
+
this.id = id;
|
|
169
|
+
this.useOrdinal = useOrdinal;
|
|
170
|
+
this.offset = offset;
|
|
171
|
+
this.options = options;
|
|
172
|
+
this.pluralFn = pluralFn;
|
|
162
173
|
}
|
|
163
174
|
|
|
164
175
|
PluralFormat.prototype.getOption = function (value) {
|
|
165
176
|
var options = this.options;
|
|
166
177
|
|
|
167
178
|
var option = options['=' + value] ||
|
|
168
|
-
options[this.pluralFn(value - this.offset)];
|
|
179
|
+
options[this.pluralFn(value - this.offset, this.useOrdinal)];
|
|
169
180
|
|
|
170
181
|
return option || options.other;
|
|
171
182
|
};
|
package/lib/core.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2014, Yahoo! Inc. All rights reserved.
|
|
3
|
+
Copyrights licensed under the New BSD License.
|
|
4
|
+
See the accompanying LICENSE file for terms.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* jslint esnext: true */
|
|
8
|
+
|
|
1
9
|
"use strict";
|
|
2
10
|
var src$utils$$ = require("./utils"), src$es5$$ = require("./es5"), src$compiler$$ = require("./compiler"), intl$messageformat$parser$$ = require("intl-messageformat-parser");
|
|
3
11
|
exports["default"] = MessageFormat;
|
|
@@ -20,12 +28,11 @@ function MessageFormat(message, locales, formats) {
|
|
|
20
28
|
// Defined first because it's used to build the format pattern.
|
|
21
29
|
src$es5$$.defineProperty(this, '_locale', {value: this._resolveLocale(locales)});
|
|
22
30
|
|
|
23
|
-
var pluralFn = MessageFormat.__localeData__[this._locale].pluralRuleFunction;
|
|
24
|
-
|
|
25
31
|
// Compile the `ast` to a pattern that is highly optimized for repeated
|
|
26
32
|
// `format()` invocations. **Note:** This passes the `locales` set provided
|
|
27
33
|
// to the constructor instead of just the resolved locale.
|
|
28
|
-
var
|
|
34
|
+
var pluralFn = this._findPluralRuleFunction(this._locale);
|
|
35
|
+
var pattern = this._compilePattern(ast, locales, formats, pluralFn);
|
|
29
36
|
|
|
30
37
|
// "Bind" `format()` method to `this` so it can be passed by reference like
|
|
31
38
|
// the other `Intl` APIs.
|
|
@@ -118,21 +125,11 @@ src$es5$$.defineProperty(MessageFormat, '__addLocaleData', {value: function (dat
|
|
|
118
125
|
);
|
|
119
126
|
}
|
|
120
127
|
|
|
121
|
-
|
|
122
|
-
throw new Error(
|
|
123
|
-
'Locale data provided to IntlMessageFormat is missing a ' +
|
|
124
|
-
'`pluralRuleFunction` property'
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Message format locale data only requires the first part of the tag.
|
|
129
|
-
var locale = data.locale.toLowerCase().split('-')[0];
|
|
130
|
-
|
|
131
|
-
MessageFormat.__localeData__[locale] = data;
|
|
128
|
+
MessageFormat.__localeData__[data.locale.toLowerCase()] = data;
|
|
132
129
|
}});
|
|
133
130
|
|
|
134
131
|
// Defines `__parse()` static method as an exposed private.
|
|
135
|
-
src$es5$$.defineProperty(MessageFormat, '__parse', {value: intl$messageformat$parser
|
|
132
|
+
src$es5$$.defineProperty(MessageFormat, '__parse', {value: intl$messageformat$parser$$["default"].parse});
|
|
136
133
|
|
|
137
134
|
// Define public `defaultLocale` property which defaults to English, but can be
|
|
138
135
|
// set by the developer.
|
|
@@ -150,10 +147,30 @@ MessageFormat.prototype.resolvedOptions = function () {
|
|
|
150
147
|
};
|
|
151
148
|
|
|
152
149
|
MessageFormat.prototype._compilePattern = function (ast, locales, formats, pluralFn) {
|
|
153
|
-
var compiler = new src$compiler
|
|
150
|
+
var compiler = new src$compiler$$["default"](locales, formats, pluralFn);
|
|
154
151
|
return compiler.compile(ast);
|
|
155
152
|
};
|
|
156
153
|
|
|
154
|
+
MessageFormat.prototype._findPluralRuleFunction = function (locale) {
|
|
155
|
+
var localeData = MessageFormat.__localeData__;
|
|
156
|
+
var data = localeData[locale.toLowerCase()];
|
|
157
|
+
|
|
158
|
+
// The locale data is de-duplicated, so we have to traverse the locale's
|
|
159
|
+
// hierarchy until we find a `pluralRuleFunction` to return.
|
|
160
|
+
while (data) {
|
|
161
|
+
if (data.pluralRuleFunction) {
|
|
162
|
+
return data.pluralRuleFunction;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
data = data.parentLocale && localeData[data.parentLocale.toLowerCase()];
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
throw new Error(
|
|
169
|
+
'Locale data added to IntlMessageFormat is missing a ' +
|
|
170
|
+
'`pluralRuleFunction` for :' + locale
|
|
171
|
+
);
|
|
172
|
+
};
|
|
173
|
+
|
|
157
174
|
MessageFormat.prototype._format = function (pattern, values) {
|
|
158
175
|
var result = '',
|
|
159
176
|
i, len, part, id, value;
|
|
@@ -207,38 +224,40 @@ MessageFormat.prototype._mergeFormats = function (defaults, formats) {
|
|
|
207
224
|
};
|
|
208
225
|
|
|
209
226
|
MessageFormat.prototype._resolveLocale = function (locales) {
|
|
210
|
-
if (!locales) {
|
|
211
|
-
locales = MessageFormat.defaultLocale;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
227
|
if (typeof locales === 'string') {
|
|
215
228
|
locales = [locales];
|
|
216
229
|
}
|
|
217
230
|
|
|
231
|
+
// Create a copy of the array so we can push on the default locale.
|
|
232
|
+
locales = (locales || []).concat(MessageFormat.defaultLocale);
|
|
233
|
+
|
|
218
234
|
var localeData = MessageFormat.__localeData__;
|
|
219
|
-
var i, len,
|
|
235
|
+
var i, len, localeParts, data;
|
|
220
236
|
|
|
237
|
+
// Using the set of locales + the default locale, we look for the first one
|
|
238
|
+
// which that has been registered. When data does not exist for a locale, we
|
|
239
|
+
// traverse its ancestors to find something that's been registered within
|
|
240
|
+
// its hierarchy of locales. Since we lack the proper `parentLocale` data
|
|
241
|
+
// here, we must take a naive approach to traversal.
|
|
221
242
|
for (i = 0, len = locales.length; i < len; i += 1) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
243
|
+
localeParts = locales[i].toLowerCase().split('-');
|
|
244
|
+
|
|
245
|
+
while (localeParts.length) {
|
|
246
|
+
data = localeData[localeParts.join('-')];
|
|
247
|
+
if (data) {
|
|
248
|
+
// Return the normalized locale string; e.g., we return "en-US",
|
|
249
|
+
// instead of "en-us".
|
|
250
|
+
return data.locale;
|
|
251
|
+
}
|
|
232
252
|
|
|
233
|
-
|
|
234
|
-
if (src$utils$$.hop.call(localeData, locale)) {
|
|
235
|
-
return locale;
|
|
253
|
+
localeParts.pop();
|
|
236
254
|
}
|
|
237
255
|
}
|
|
238
256
|
|
|
257
|
+
var defaultLocale = locales.pop();
|
|
239
258
|
throw new Error(
|
|
240
259
|
'No locale data has been added to IntlMessageFormat for: ' +
|
|
241
|
-
locales.join(', ')
|
|
260
|
+
locales.join(', ') + ', or the default locale: ' + defaultLocale
|
|
242
261
|
);
|
|
243
262
|
};
|
|
244
263
|
|
package/lib/en.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
// GENERATED FILE
|
|
1
2
|
"use strict";
|
|
2
|
-
exports["default"] = {"locale":"en","pluralRuleFunction":function (n)
|
|
3
|
+
exports["default"] = {"locale":"en","pluralRuleFunction":function (n,ord){var s=String(n).split("."),v0=!s[1],t0=Number(s[0])==n,n10=t0&&s[0].slice(-1),n100=t0&&s[0].slice(-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"}};
|
|
3
4
|
|
|
4
5
|
//# sourceMappingURL=en.js.map
|
package/lib/es5.js
CHANGED