intl-messageformat 1.0.4 → 1.1.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 +44 -18
- package/dist/intl-messageformat-with-locales.js +1247 -320
- package/dist/intl-messageformat-with-locales.js.map +1 -1
- package/dist/intl-messageformat-with-locales.min.js +3 -2
- package/dist/intl-messageformat-with-locales.min.js.map +1 -1
- package/dist/intl-messageformat.js +265 -160
- 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/aa.js +4 -0
- package/dist/locale-data/af.js +3 -1
- package/dist/locale-data/agq.js +2 -0
- package/dist/locale-data/ak.js +2 -1
- package/dist/locale-data/am.js +2 -1
- package/dist/locale-data/ar.js +29 -1
- package/dist/locale-data/as.js +2 -1
- package/dist/locale-data/asa.js +2 -1
- package/dist/locale-data/ast.js +2 -1
- package/dist/locale-data/az.js +5 -1
- package/dist/locale-data/bas.js +2 -0
- package/dist/locale-data/be.js +2 -1
- package/dist/locale-data/bem.js +2 -1
- package/dist/locale-data/bez.js +2 -1
- package/dist/locale-data/bg.js +2 -1
- package/dist/locale-data/bh.js +1 -0
- package/dist/locale-data/bm.js +4 -1
- package/dist/locale-data/bn.js +3 -1
- package/dist/locale-data/bo.js +3 -1
- package/dist/locale-data/br.js +2 -1
- package/dist/locale-data/brx.js +2 -1
- package/dist/locale-data/bs.js +5 -1
- package/dist/locale-data/ca.js +6 -1
- package/dist/locale-data/cgg.js +2 -1
- package/dist/locale-data/chr.js +2 -1
- package/dist/locale-data/ckb.js +1 -0
- package/dist/locale-data/cs.js +2 -1
- package/dist/locale-data/cy.js +2 -1
- package/dist/locale-data/da.js +3 -1
- package/dist/locale-data/dav.js +2 -0
- package/dist/locale-data/de.js +7 -1
- package/dist/locale-data/dje.js +2 -0
- package/dist/locale-data/dsb.js +2 -0
- package/dist/locale-data/dua.js +2 -0
- package/dist/locale-data/dv.js +1 -0
- package/dist/locale-data/dyo.js +2 -0
- package/dist/locale-data/dz.js +2 -1
- package/dist/locale-data/ebu.js +2 -0
- package/dist/locale-data/ee.js +3 -1
- package/dist/locale-data/el.js +3 -1
- package/dist/locale-data/en.js +96 -1
- package/dist/locale-data/eo.js +2 -1
- package/dist/locale-data/es.js +27 -1
- package/dist/locale-data/et.js +2 -1
- package/dist/locale-data/eu.js +2 -1
- package/dist/locale-data/ewo.js +2 -0
- package/dist/locale-data/fa.js +3 -1
- package/dist/locale-data/ff.js +5 -1
- package/dist/locale-data/fi.js +2 -1
- package/dist/locale-data/fil.js +2 -1
- package/dist/locale-data/fo.js +2 -1
- package/dist/locale-data/fr.js +47 -1
- package/dist/locale-data/fur.js +2 -1
- package/dist/locale-data/fy.js +2 -1
- package/dist/locale-data/ga.js +2 -1
- package/dist/locale-data/gd.js +2 -1
- package/dist/locale-data/gl.js +2 -1
- package/dist/locale-data/gsw.js +4 -1
- package/dist/locale-data/gu.js +2 -1
- package/dist/locale-data/guw.js +1 -0
- package/dist/locale-data/guz.js +2 -0
- package/dist/locale-data/gv.js +2 -1
- package/dist/locale-data/ha.js +6 -1
- package/dist/locale-data/haw.js +2 -1
- package/dist/locale-data/he.js +2 -1
- package/dist/locale-data/hi.js +2 -1
- package/dist/locale-data/hr.js +3 -1
- package/dist/locale-data/hsb.js +2 -0
- package/dist/locale-data/hu.js +2 -1
- package/dist/locale-data/hy.js +2 -1
- package/dist/locale-data/ia.js +2 -0
- package/dist/locale-data/id.js +2 -1
- package/dist/locale-data/ig.js +2 -1
- package/dist/locale-data/ii.js +2 -1
- package/dist/locale-data/in.js +1 -0
- package/dist/locale-data/is.js +2 -1
- package/dist/locale-data/it.js +4 -1
- package/dist/locale-data/iu.js +1 -0
- package/dist/locale-data/iw.js +1 -0
- package/dist/locale-data/ja.js +2 -1
- package/dist/locale-data/jbo.js +1 -0
- package/dist/locale-data/jgo.js +2 -1
- package/dist/locale-data/ji.js +1 -0
- package/dist/locale-data/jmc.js +2 -1
- package/dist/locale-data/jv.js +1 -0
- package/dist/locale-data/jw.js +1 -0
- package/dist/locale-data/ka.js +2 -1
- package/dist/locale-data/kab.js +2 -1
- package/dist/locale-data/kaj.js +1 -0
- package/dist/locale-data/kam.js +2 -0
- package/dist/locale-data/kcg.js +1 -0
- package/dist/locale-data/kde.js +2 -1
- package/dist/locale-data/kea.js +2 -1
- package/dist/locale-data/khq.js +2 -0
- package/dist/locale-data/ki.js +2 -0
- package/dist/locale-data/kk.js +3 -1
- package/dist/locale-data/kkj.js +2 -1
- package/dist/locale-data/kl.js +2 -1
- package/dist/locale-data/kln.js +2 -0
- package/dist/locale-data/km.js +2 -1
- package/dist/locale-data/kn.js +2 -1
- package/dist/locale-data/ko.js +3 -1
- package/dist/locale-data/kok.js +2 -0
- package/dist/locale-data/ks.js +3 -1
- package/dist/locale-data/ksb.js +2 -1
- package/dist/locale-data/ksf.js +2 -0
- package/dist/locale-data/ksh.js +2 -1
- package/dist/locale-data/ku.js +1 -0
- package/dist/locale-data/kw.js +2 -1
- package/dist/locale-data/ky.js +3 -1
- package/dist/locale-data/lag.js +2 -1
- package/dist/locale-data/lb.js +2 -0
- package/dist/locale-data/lg.js +2 -1
- package/dist/locale-data/lkt.js +2 -1
- package/dist/locale-data/ln.js +5 -1
- package/dist/locale-data/lo.js +2 -1
- package/dist/locale-data/lt.js +2 -1
- package/dist/locale-data/lu.js +2 -0
- package/dist/locale-data/luo.js +2 -0
- package/dist/locale-data/luy.js +2 -0
- package/dist/locale-data/lv.js +2 -1
- package/dist/locale-data/mas.js +3 -1
- package/dist/locale-data/mer.js +2 -0
- package/dist/locale-data/mfe.js +2 -0
- package/dist/locale-data/mg.js +2 -1
- package/dist/locale-data/mgh.js +2 -0
- package/dist/locale-data/mgo.js +2 -1
- package/dist/locale-data/mk.js +2 -1
- package/dist/locale-data/ml.js +2 -1
- package/dist/locale-data/mn.js +4 -1
- package/dist/locale-data/mo.js +1 -0
- package/dist/locale-data/mr.js +2 -1
- package/dist/locale-data/ms.js +6 -1
- package/dist/locale-data/mt.js +2 -1
- package/dist/locale-data/mua.js +2 -0
- package/dist/locale-data/my.js +2 -1
- package/dist/locale-data/nah.js +1 -0
- package/dist/locale-data/naq.js +2 -1
- package/dist/locale-data/nb.js +3 -1
- package/dist/locale-data/nd.js +2 -1
- package/dist/locale-data/ne.js +3 -1
- package/dist/locale-data/nl.js +8 -1
- package/dist/locale-data/nmg.js +2 -0
- package/dist/locale-data/nn.js +2 -1
- package/dist/locale-data/nnh.js +2 -1
- package/dist/locale-data/no.js +1 -0
- package/dist/locale-data/nqo.js +1 -0
- package/dist/locale-data/nr.js +2 -1
- package/dist/locale-data/nso.js +2 -1
- package/dist/locale-data/nus.js +2 -0
- package/dist/locale-data/ny.js +1 -0
- package/dist/locale-data/nyn.js +2 -1
- package/dist/locale-data/om.js +3 -1
- package/dist/locale-data/or.js +2 -1
- package/dist/locale-data/os.js +3 -1
- package/dist/locale-data/pa.js +5 -1
- package/dist/locale-data/pap.js +1 -0
- package/dist/locale-data/pl.js +2 -1
- package/dist/locale-data/prg.js +1 -0
- package/dist/locale-data/ps.js +2 -1
- package/dist/locale-data/pt.js +10 -1
- package/dist/locale-data/qu.js +4 -0
- package/dist/locale-data/rm.js +2 -1
- package/dist/locale-data/rn.js +2 -0
- package/dist/locale-data/ro.js +3 -1
- package/dist/locale-data/rof.js +2 -1
- package/dist/locale-data/ru.js +7 -1
- package/dist/locale-data/rw.js +2 -0
- package/dist/locale-data/rwk.js +2 -1
- package/dist/locale-data/sah.js +2 -1
- package/dist/locale-data/saq.js +2 -1
- package/dist/locale-data/sbp.js +2 -0
- package/dist/locale-data/se.js +4 -1
- package/dist/locale-data/seh.js +2 -1
- package/dist/locale-data/ses.js +2 -1
- package/dist/locale-data/sg.js +2 -1
- package/dist/locale-data/sh.js +1 -0
- package/dist/locale-data/shi.js +5 -1
- package/dist/locale-data/si.js +2 -1
- package/dist/locale-data/sk.js +2 -1
- package/dist/locale-data/sl.js +2 -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 +2 -0
- package/dist/locale-data/sms.js +1 -0
- package/dist/locale-data/sn.js +2 -1
- package/dist/locale-data/so.js +5 -1
- package/dist/locale-data/sq.js +4 -1
- package/dist/locale-data/sr.js +11 -1
- package/dist/locale-data/ss.js +3 -1
- package/dist/locale-data/ssy.js +2 -1
- package/dist/locale-data/st.js +1 -1
- package/dist/locale-data/sv.js +4 -1
- package/dist/locale-data/sw.js +4 -1
- package/dist/locale-data/swc.js +2 -0
- package/dist/locale-data/syr.js +1 -0
- package/dist/locale-data/ta.js +5 -1
- package/dist/locale-data/te.js +2 -1
- package/dist/locale-data/teo.js +3 -1
- package/dist/locale-data/th.js +2 -1
- package/dist/locale-data/ti.js +3 -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 +3 -1
- package/dist/locale-data/to.js +2 -1
- package/dist/locale-data/tr.js +3 -1
- package/dist/locale-data/ts.js +2 -1
- package/dist/locale-data/twq.js +2 -0
- package/dist/locale-data/tzm.js +3 -1
- package/dist/locale-data/ug.js +3 -1
- package/dist/locale-data/uk.js +2 -1
- package/dist/locale-data/ur.js +3 -1
- package/dist/locale-data/uz.js +7 -1
- package/dist/locale-data/vai.js +5 -0
- package/dist/locale-data/ve.js +2 -1
- package/dist/locale-data/vi.js +2 -1
- package/dist/locale-data/vo.js +2 -1
- package/dist/locale-data/vun.js +2 -1
- package/dist/locale-data/wa.js +1 -0
- package/dist/locale-data/wae.js +2 -1
- package/dist/locale-data/wo.js +1 -0
- package/dist/locale-data/xh.js +1 -1
- package/dist/locale-data/xog.js +2 -1
- package/dist/locale-data/yav.js +2 -0
- package/dist/locale-data/yi.js +2 -0
- package/dist/locale-data/yo.js +3 -1
- package/dist/locale-data/zgh.js +2 -0
- package/dist/locale-data/zh.js +10 -1
- package/dist/locale-data/zu.js +2 -1
- package/lib/compiler.js +21 -10
- package/lib/core.js +52 -33
- package/lib/en.js +2 -1
- package/lib/es5.js +8 -0
- package/lib/locales.js +751 -160
- package/lib/main.js +2 -0
- package/lib/utils.js +8 -0
- package/package.json +6 -6
- package/src/compiler.js +13 -10
- package/src/core.js +44 -33
- package/src/en.js +1 -1
- package/bower.json +0 -40
|
@@ -159,7 +159,9 @@
|
|
|
159
159
|
|
|
160
160
|
case 'pluralFormat':
|
|
161
161
|
options = this.compileOptions(element);
|
|
162
|
-
return new $$compiler$$PluralFormat(
|
|
162
|
+
return new $$compiler$$PluralFormat(
|
|
163
|
+
element.id, format.ordinal, format.offset, options, pluralFn
|
|
164
|
+
);
|
|
163
165
|
|
|
164
166
|
case 'selectFormat':
|
|
165
167
|
options = this.compileOptions(element);
|
|
@@ -176,8 +178,8 @@
|
|
|
176
178
|
optionsHash = {};
|
|
177
179
|
|
|
178
180
|
// Save the current plural element, if any, then set it to a new value when
|
|
179
|
-
// compiling the options sub-patterns. This
|
|
180
|
-
// for handling `"#"`
|
|
181
|
+
// compiling the options sub-patterns. This conforms the spec's algorithm
|
|
182
|
+
// for handling `"#"` syntax in message text.
|
|
181
183
|
this.pluralStack.push(this.currentPlural);
|
|
182
184
|
this.currentPlural = format.type === 'pluralFormat' ? element : null;
|
|
183
185
|
|
|
@@ -190,7 +192,7 @@
|
|
|
190
192
|
optionsHash[option.selector] = this.compileMessage(option.value);
|
|
191
193
|
}
|
|
192
194
|
|
|
193
|
-
// Pop the plural stack to put back the original
|
|
195
|
+
// Pop the plural stack to put back the original current plural value.
|
|
194
196
|
this.currentPlural = this.pluralStack.pop();
|
|
195
197
|
|
|
196
198
|
return optionsHash;
|
|
@@ -210,18 +212,19 @@
|
|
|
210
212
|
return typeof value === 'string' ? value : String(value);
|
|
211
213
|
};
|
|
212
214
|
|
|
213
|
-
function $$compiler$$PluralFormat(id, offset, options, pluralFn) {
|
|
214
|
-
this.id
|
|
215
|
-
this.
|
|
216
|
-
this.
|
|
217
|
-
this.
|
|
215
|
+
function $$compiler$$PluralFormat(id, useOrdinal, offset, options, pluralFn) {
|
|
216
|
+
this.id = id;
|
|
217
|
+
this.useOrdinal = useOrdinal;
|
|
218
|
+
this.offset = offset;
|
|
219
|
+
this.options = options;
|
|
220
|
+
this.pluralFn = pluralFn;
|
|
218
221
|
}
|
|
219
222
|
|
|
220
223
|
$$compiler$$PluralFormat.prototype.getOption = function (value) {
|
|
221
224
|
var options = this.options;
|
|
222
225
|
|
|
223
226
|
var option = options['=' + value] ||
|
|
224
|
-
options[this.pluralFn(value - this.offset)];
|
|
227
|
+
options[this.pluralFn(value - this.offset, this.useOrdinal)];
|
|
225
228
|
|
|
226
229
|
return option || options.other;
|
|
227
230
|
};
|
|
@@ -343,67 +346,85 @@
|
|
|
343
346
|
},
|
|
344
347
|
peg$c22 = "plural",
|
|
345
348
|
peg$c23 = { type: "literal", value: "plural", description: "\"plural\"" },
|
|
346
|
-
peg$c24 = function(
|
|
349
|
+
peg$c24 = function(pluralStyle) {
|
|
347
350
|
return {
|
|
348
|
-
type :
|
|
349
|
-
|
|
350
|
-
|
|
351
|
+
type : pluralStyle.type,
|
|
352
|
+
ordinal: false,
|
|
353
|
+
offset : pluralStyle.offset || 0,
|
|
354
|
+
options: pluralStyle.options
|
|
355
|
+
};
|
|
356
|
+
},
|
|
357
|
+
peg$c25 = "selectordinal",
|
|
358
|
+
peg$c26 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" },
|
|
359
|
+
peg$c27 = function(pluralStyle) {
|
|
360
|
+
return {
|
|
361
|
+
type : pluralStyle.type,
|
|
362
|
+
ordinal: true,
|
|
363
|
+
offset : pluralStyle.offset || 0,
|
|
364
|
+
options: pluralStyle.options
|
|
351
365
|
}
|
|
352
366
|
},
|
|
353
|
-
peg$
|
|
354
|
-
peg$
|
|
355
|
-
peg$
|
|
367
|
+
peg$c28 = "select",
|
|
368
|
+
peg$c29 = { type: "literal", value: "select", description: "\"select\"" },
|
|
369
|
+
peg$c30 = function(options) {
|
|
356
370
|
return {
|
|
357
371
|
type : 'selectFormat',
|
|
358
372
|
options: options
|
|
359
|
-
}
|
|
373
|
+
};
|
|
360
374
|
},
|
|
361
|
-
peg$
|
|
362
|
-
peg$
|
|
363
|
-
peg$
|
|
375
|
+
peg$c31 = "=",
|
|
376
|
+
peg$c32 = { type: "literal", value: "=", description: "\"=\"" },
|
|
377
|
+
peg$c33 = function(selector, pattern) {
|
|
364
378
|
return {
|
|
365
379
|
type : 'optionalFormatPattern',
|
|
366
380
|
selector: selector,
|
|
367
381
|
value : pattern
|
|
368
382
|
};
|
|
369
383
|
},
|
|
370
|
-
peg$
|
|
371
|
-
peg$
|
|
372
|
-
peg$
|
|
384
|
+
peg$c34 = "offset:",
|
|
385
|
+
peg$c35 = { type: "literal", value: "offset:", description: "\"offset:\"" },
|
|
386
|
+
peg$c36 = function(number) {
|
|
373
387
|
return number;
|
|
374
388
|
},
|
|
375
|
-
peg$
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
peg$
|
|
383
|
-
peg$
|
|
384
|
-
peg$
|
|
385
|
-
peg$
|
|
386
|
-
peg$
|
|
387
|
-
peg$
|
|
389
|
+
peg$c37 = function(offset, options) {
|
|
390
|
+
return {
|
|
391
|
+
type : 'pluralFormat',
|
|
392
|
+
offset : offset,
|
|
393
|
+
options: options
|
|
394
|
+
};
|
|
395
|
+
},
|
|
396
|
+
peg$c38 = { type: "other", description: "whitespace" },
|
|
397
|
+
peg$c39 = /^[ \t\n\r]/,
|
|
398
|
+
peg$c40 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
|
|
399
|
+
peg$c41 = { type: "other", description: "optionalWhitespace" },
|
|
400
|
+
peg$c42 = /^[0-9]/,
|
|
401
|
+
peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
|
|
402
|
+
peg$c44 = /^[0-9a-f]/i,
|
|
403
|
+
peg$c45 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" },
|
|
404
|
+
peg$c46 = "0",
|
|
405
|
+
peg$c47 = { type: "literal", value: "0", description: "\"0\"" },
|
|
406
|
+
peg$c48 = /^[1-9]/,
|
|
407
|
+
peg$c49 = { type: "class", value: "[1-9]", description: "[1-9]" },
|
|
408
|
+
peg$c50 = function(digits) {
|
|
388
409
|
return parseInt(digits, 10);
|
|
389
410
|
},
|
|
390
|
-
peg$
|
|
391
|
-
peg$
|
|
392
|
-
peg$
|
|
393
|
-
peg$
|
|
394
|
-
peg$
|
|
395
|
-
peg$
|
|
396
|
-
peg$
|
|
397
|
-
peg$
|
|
398
|
-
peg$
|
|
399
|
-
peg$
|
|
400
|
-
peg$
|
|
401
|
-
peg$
|
|
402
|
-
peg$
|
|
403
|
-
peg$
|
|
411
|
+
peg$c51 = /^[^{}\\\0-\x1F \t\n\r]/,
|
|
412
|
+
peg$c52 = { type: "class", value: "[^{}\\\\\\0-\\x1F \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F \\t\\n\\r]" },
|
|
413
|
+
peg$c53 = "\\#",
|
|
414
|
+
peg$c54 = { type: "literal", value: "\\#", description: "\"\\\\#\"" },
|
|
415
|
+
peg$c55 = function() { return '\\#'; },
|
|
416
|
+
peg$c56 = "\\{",
|
|
417
|
+
peg$c57 = { type: "literal", value: "\\{", description: "\"\\\\{\"" },
|
|
418
|
+
peg$c58 = function() { return '\u007B'; },
|
|
419
|
+
peg$c59 = "\\}",
|
|
420
|
+
peg$c60 = { type: "literal", value: "\\}", description: "\"\\\\}\"" },
|
|
421
|
+
peg$c61 = function() { return '\u007D'; },
|
|
422
|
+
peg$c62 = "\\u",
|
|
423
|
+
peg$c63 = { type: "literal", value: "\\u", description: "\"\\\\u\"" },
|
|
424
|
+
peg$c64 = function(digits) {
|
|
404
425
|
return String.fromCharCode(parseInt(digits, 16));
|
|
405
426
|
},
|
|
406
|
-
peg$
|
|
427
|
+
peg$c65 = function(chars) { return chars.join(''); },
|
|
407
428
|
|
|
408
429
|
peg$currPos = 0,
|
|
409
430
|
peg$reportedPos = 0,
|
|
@@ -832,7 +853,10 @@
|
|
|
832
853
|
if (s0 === peg$FAILED) {
|
|
833
854
|
s0 = peg$parsepluralFormat();
|
|
834
855
|
if (s0 === peg$FAILED) {
|
|
835
|
-
s0 = peg$
|
|
856
|
+
s0 = peg$parseselectOrdinalFormat();
|
|
857
|
+
if (s0 === peg$FAILED) {
|
|
858
|
+
s0 = peg$parseselectFormat();
|
|
859
|
+
}
|
|
836
860
|
}
|
|
837
861
|
}
|
|
838
862
|
|
|
@@ -922,7 +946,7 @@
|
|
|
922
946
|
}
|
|
923
947
|
|
|
924
948
|
function peg$parsepluralFormat() {
|
|
925
|
-
var s0, s1, s2, s3, s4, s5
|
|
949
|
+
var s0, s1, s2, s3, s4, s5;
|
|
926
950
|
|
|
927
951
|
s0 = peg$currPos;
|
|
928
952
|
if (input.substr(peg$currPos, 6) === peg$c22) {
|
|
@@ -945,35 +969,64 @@
|
|
|
945
969
|
if (s3 !== peg$FAILED) {
|
|
946
970
|
s4 = peg$parse_();
|
|
947
971
|
if (s4 !== peg$FAILED) {
|
|
948
|
-
s5 = peg$
|
|
949
|
-
if (s5
|
|
950
|
-
|
|
972
|
+
s5 = peg$parsepluralStyle();
|
|
973
|
+
if (s5 !== peg$FAILED) {
|
|
974
|
+
peg$reportedPos = s0;
|
|
975
|
+
s1 = peg$c24(s5);
|
|
976
|
+
s0 = s1;
|
|
977
|
+
} else {
|
|
978
|
+
peg$currPos = s0;
|
|
979
|
+
s0 = peg$c2;
|
|
951
980
|
}
|
|
981
|
+
} else {
|
|
982
|
+
peg$currPos = s0;
|
|
983
|
+
s0 = peg$c2;
|
|
984
|
+
}
|
|
985
|
+
} else {
|
|
986
|
+
peg$currPos = s0;
|
|
987
|
+
s0 = peg$c2;
|
|
988
|
+
}
|
|
989
|
+
} else {
|
|
990
|
+
peg$currPos = s0;
|
|
991
|
+
s0 = peg$c2;
|
|
992
|
+
}
|
|
993
|
+
} else {
|
|
994
|
+
peg$currPos = s0;
|
|
995
|
+
s0 = peg$c2;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
return s0;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
function peg$parseselectOrdinalFormat() {
|
|
1002
|
+
var s0, s1, s2, s3, s4, s5;
|
|
1003
|
+
|
|
1004
|
+
s0 = peg$currPos;
|
|
1005
|
+
if (input.substr(peg$currPos, 13) === peg$c25) {
|
|
1006
|
+
s1 = peg$c25;
|
|
1007
|
+
peg$currPos += 13;
|
|
1008
|
+
} else {
|
|
1009
|
+
s1 = peg$FAILED;
|
|
1010
|
+
if (peg$silentFails === 0) { peg$fail(peg$c26); }
|
|
1011
|
+
}
|
|
1012
|
+
if (s1 !== peg$FAILED) {
|
|
1013
|
+
s2 = peg$parse_();
|
|
1014
|
+
if (s2 !== peg$FAILED) {
|
|
1015
|
+
if (input.charCodeAt(peg$currPos) === 44) {
|
|
1016
|
+
s3 = peg$c10;
|
|
1017
|
+
peg$currPos++;
|
|
1018
|
+
} else {
|
|
1019
|
+
s3 = peg$FAILED;
|
|
1020
|
+
if (peg$silentFails === 0) { peg$fail(peg$c11); }
|
|
1021
|
+
}
|
|
1022
|
+
if (s3 !== peg$FAILED) {
|
|
1023
|
+
s4 = peg$parse_();
|
|
1024
|
+
if (s4 !== peg$FAILED) {
|
|
1025
|
+
s5 = peg$parsepluralStyle();
|
|
952
1026
|
if (s5 !== peg$FAILED) {
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
s8 = peg$parseoptionalFormatPattern();
|
|
957
|
-
if (s8 !== peg$FAILED) {
|
|
958
|
-
while (s8 !== peg$FAILED) {
|
|
959
|
-
s7.push(s8);
|
|
960
|
-
s8 = peg$parseoptionalFormatPattern();
|
|
961
|
-
}
|
|
962
|
-
} else {
|
|
963
|
-
s7 = peg$c2;
|
|
964
|
-
}
|
|
965
|
-
if (s7 !== peg$FAILED) {
|
|
966
|
-
peg$reportedPos = s0;
|
|
967
|
-
s1 = peg$c24(s5, s7);
|
|
968
|
-
s0 = s1;
|
|
969
|
-
} else {
|
|
970
|
-
peg$currPos = s0;
|
|
971
|
-
s0 = peg$c2;
|
|
972
|
-
}
|
|
973
|
-
} else {
|
|
974
|
-
peg$currPos = s0;
|
|
975
|
-
s0 = peg$c2;
|
|
976
|
-
}
|
|
1027
|
+
peg$reportedPos = s0;
|
|
1028
|
+
s1 = peg$c27(s5);
|
|
1029
|
+
s0 = s1;
|
|
977
1030
|
} else {
|
|
978
1031
|
peg$currPos = s0;
|
|
979
1032
|
s0 = peg$c2;
|
|
@@ -1002,12 +1055,12 @@
|
|
|
1002
1055
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
1003
1056
|
|
|
1004
1057
|
s0 = peg$currPos;
|
|
1005
|
-
if (input.substr(peg$currPos, 6) === peg$
|
|
1006
|
-
s1 = peg$
|
|
1058
|
+
if (input.substr(peg$currPos, 6) === peg$c28) {
|
|
1059
|
+
s1 = peg$c28;
|
|
1007
1060
|
peg$currPos += 6;
|
|
1008
1061
|
} else {
|
|
1009
1062
|
s1 = peg$FAILED;
|
|
1010
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1063
|
+
if (peg$silentFails === 0) { peg$fail(peg$c29); }
|
|
1011
1064
|
}
|
|
1012
1065
|
if (s1 !== peg$FAILED) {
|
|
1013
1066
|
s2 = peg$parse_();
|
|
@@ -1034,7 +1087,7 @@
|
|
|
1034
1087
|
}
|
|
1035
1088
|
if (s5 !== peg$FAILED) {
|
|
1036
1089
|
peg$reportedPos = s0;
|
|
1037
|
-
s1 = peg$
|
|
1090
|
+
s1 = peg$c30(s5);
|
|
1038
1091
|
s0 = s1;
|
|
1039
1092
|
} else {
|
|
1040
1093
|
peg$currPos = s0;
|
|
@@ -1066,11 +1119,11 @@
|
|
|
1066
1119
|
s0 = peg$currPos;
|
|
1067
1120
|
s1 = peg$currPos;
|
|
1068
1121
|
if (input.charCodeAt(peg$currPos) === 61) {
|
|
1069
|
-
s2 = peg$
|
|
1122
|
+
s2 = peg$c31;
|
|
1070
1123
|
peg$currPos++;
|
|
1071
1124
|
} else {
|
|
1072
1125
|
s2 = peg$FAILED;
|
|
1073
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1126
|
+
if (peg$silentFails === 0) { peg$fail(peg$c32); }
|
|
1074
1127
|
}
|
|
1075
1128
|
if (s2 !== peg$FAILED) {
|
|
1076
1129
|
s3 = peg$parsenumber();
|
|
@@ -1129,7 +1182,7 @@
|
|
|
1129
1182
|
}
|
|
1130
1183
|
if (s8 !== peg$FAILED) {
|
|
1131
1184
|
peg$reportedPos = s0;
|
|
1132
|
-
s1 = peg$
|
|
1185
|
+
s1 = peg$c33(s2, s6);
|
|
1133
1186
|
s0 = s1;
|
|
1134
1187
|
} else {
|
|
1135
1188
|
peg$currPos = s0;
|
|
@@ -1171,12 +1224,12 @@
|
|
|
1171
1224
|
var s0, s1, s2, s3;
|
|
1172
1225
|
|
|
1173
1226
|
s0 = peg$currPos;
|
|
1174
|
-
if (input.substr(peg$currPos, 7) === peg$
|
|
1175
|
-
s1 = peg$
|
|
1227
|
+
if (input.substr(peg$currPos, 7) === peg$c34) {
|
|
1228
|
+
s1 = peg$c34;
|
|
1176
1229
|
peg$currPos += 7;
|
|
1177
1230
|
} else {
|
|
1178
1231
|
s1 = peg$FAILED;
|
|
1179
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1232
|
+
if (peg$silentFails === 0) { peg$fail(peg$c35); }
|
|
1180
1233
|
}
|
|
1181
1234
|
if (s1 !== peg$FAILED) {
|
|
1182
1235
|
s2 = peg$parse_();
|
|
@@ -1184,7 +1237,48 @@
|
|
|
1184
1237
|
s3 = peg$parsenumber();
|
|
1185
1238
|
if (s3 !== peg$FAILED) {
|
|
1186
1239
|
peg$reportedPos = s0;
|
|
1187
|
-
s1 = peg$
|
|
1240
|
+
s1 = peg$c36(s3);
|
|
1241
|
+
s0 = s1;
|
|
1242
|
+
} else {
|
|
1243
|
+
peg$currPos = s0;
|
|
1244
|
+
s0 = peg$c2;
|
|
1245
|
+
}
|
|
1246
|
+
} else {
|
|
1247
|
+
peg$currPos = s0;
|
|
1248
|
+
s0 = peg$c2;
|
|
1249
|
+
}
|
|
1250
|
+
} else {
|
|
1251
|
+
peg$currPos = s0;
|
|
1252
|
+
s0 = peg$c2;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
return s0;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
function peg$parsepluralStyle() {
|
|
1259
|
+
var s0, s1, s2, s3, s4;
|
|
1260
|
+
|
|
1261
|
+
s0 = peg$currPos;
|
|
1262
|
+
s1 = peg$parseoffset();
|
|
1263
|
+
if (s1 === peg$FAILED) {
|
|
1264
|
+
s1 = peg$c9;
|
|
1265
|
+
}
|
|
1266
|
+
if (s1 !== peg$FAILED) {
|
|
1267
|
+
s2 = peg$parse_();
|
|
1268
|
+
if (s2 !== peg$FAILED) {
|
|
1269
|
+
s3 = [];
|
|
1270
|
+
s4 = peg$parseoptionalFormatPattern();
|
|
1271
|
+
if (s4 !== peg$FAILED) {
|
|
1272
|
+
while (s4 !== peg$FAILED) {
|
|
1273
|
+
s3.push(s4);
|
|
1274
|
+
s4 = peg$parseoptionalFormatPattern();
|
|
1275
|
+
}
|
|
1276
|
+
} else {
|
|
1277
|
+
s3 = peg$c2;
|
|
1278
|
+
}
|
|
1279
|
+
if (s3 !== peg$FAILED) {
|
|
1280
|
+
peg$reportedPos = s0;
|
|
1281
|
+
s1 = peg$c37(s1, s3);
|
|
1188
1282
|
s0 = s1;
|
|
1189
1283
|
} else {
|
|
1190
1284
|
peg$currPos = s0;
|
|
@@ -1207,22 +1301,22 @@
|
|
|
1207
1301
|
|
|
1208
1302
|
peg$silentFails++;
|
|
1209
1303
|
s0 = [];
|
|
1210
|
-
if (peg$
|
|
1304
|
+
if (peg$c39.test(input.charAt(peg$currPos))) {
|
|
1211
1305
|
s1 = input.charAt(peg$currPos);
|
|
1212
1306
|
peg$currPos++;
|
|
1213
1307
|
} else {
|
|
1214
1308
|
s1 = peg$FAILED;
|
|
1215
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1309
|
+
if (peg$silentFails === 0) { peg$fail(peg$c40); }
|
|
1216
1310
|
}
|
|
1217
1311
|
if (s1 !== peg$FAILED) {
|
|
1218
1312
|
while (s1 !== peg$FAILED) {
|
|
1219
1313
|
s0.push(s1);
|
|
1220
|
-
if (peg$
|
|
1314
|
+
if (peg$c39.test(input.charAt(peg$currPos))) {
|
|
1221
1315
|
s1 = input.charAt(peg$currPos);
|
|
1222
1316
|
peg$currPos++;
|
|
1223
1317
|
} else {
|
|
1224
1318
|
s1 = peg$FAILED;
|
|
1225
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1319
|
+
if (peg$silentFails === 0) { peg$fail(peg$c40); }
|
|
1226
1320
|
}
|
|
1227
1321
|
}
|
|
1228
1322
|
} else {
|
|
@@ -1231,7 +1325,7 @@
|
|
|
1231
1325
|
peg$silentFails--;
|
|
1232
1326
|
if (s0 === peg$FAILED) {
|
|
1233
1327
|
s1 = peg$FAILED;
|
|
1234
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1328
|
+
if (peg$silentFails === 0) { peg$fail(peg$c38); }
|
|
1235
1329
|
}
|
|
1236
1330
|
|
|
1237
1331
|
return s0;
|
|
@@ -1255,7 +1349,7 @@
|
|
|
1255
1349
|
peg$silentFails--;
|
|
1256
1350
|
if (s0 === peg$FAILED) {
|
|
1257
1351
|
s1 = peg$FAILED;
|
|
1258
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1352
|
+
if (peg$silentFails === 0) { peg$fail(peg$c41); }
|
|
1259
1353
|
}
|
|
1260
1354
|
|
|
1261
1355
|
return s0;
|
|
@@ -1264,12 +1358,12 @@
|
|
|
1264
1358
|
function peg$parsedigit() {
|
|
1265
1359
|
var s0;
|
|
1266
1360
|
|
|
1267
|
-
if (peg$
|
|
1361
|
+
if (peg$c42.test(input.charAt(peg$currPos))) {
|
|
1268
1362
|
s0 = input.charAt(peg$currPos);
|
|
1269
1363
|
peg$currPos++;
|
|
1270
1364
|
} else {
|
|
1271
1365
|
s0 = peg$FAILED;
|
|
1272
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1366
|
+
if (peg$silentFails === 0) { peg$fail(peg$c43); }
|
|
1273
1367
|
}
|
|
1274
1368
|
|
|
1275
1369
|
return s0;
|
|
@@ -1278,12 +1372,12 @@
|
|
|
1278
1372
|
function peg$parsehexDigit() {
|
|
1279
1373
|
var s0;
|
|
1280
1374
|
|
|
1281
|
-
if (peg$
|
|
1375
|
+
if (peg$c44.test(input.charAt(peg$currPos))) {
|
|
1282
1376
|
s0 = input.charAt(peg$currPos);
|
|
1283
1377
|
peg$currPos++;
|
|
1284
1378
|
} else {
|
|
1285
1379
|
s0 = peg$FAILED;
|
|
1286
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1380
|
+
if (peg$silentFails === 0) { peg$fail(peg$c45); }
|
|
1287
1381
|
}
|
|
1288
1382
|
|
|
1289
1383
|
return s0;
|
|
@@ -1294,21 +1388,21 @@
|
|
|
1294
1388
|
|
|
1295
1389
|
s0 = peg$currPos;
|
|
1296
1390
|
if (input.charCodeAt(peg$currPos) === 48) {
|
|
1297
|
-
s1 = peg$
|
|
1391
|
+
s1 = peg$c46;
|
|
1298
1392
|
peg$currPos++;
|
|
1299
1393
|
} else {
|
|
1300
1394
|
s1 = peg$FAILED;
|
|
1301
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1395
|
+
if (peg$silentFails === 0) { peg$fail(peg$c47); }
|
|
1302
1396
|
}
|
|
1303
1397
|
if (s1 === peg$FAILED) {
|
|
1304
1398
|
s1 = peg$currPos;
|
|
1305
1399
|
s2 = peg$currPos;
|
|
1306
|
-
if (peg$
|
|
1400
|
+
if (peg$c48.test(input.charAt(peg$currPos))) {
|
|
1307
1401
|
s3 = input.charAt(peg$currPos);
|
|
1308
1402
|
peg$currPos++;
|
|
1309
1403
|
} else {
|
|
1310
1404
|
s3 = peg$FAILED;
|
|
1311
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1405
|
+
if (peg$silentFails === 0) { peg$fail(peg$c49); }
|
|
1312
1406
|
}
|
|
1313
1407
|
if (s3 !== peg$FAILED) {
|
|
1314
1408
|
s4 = [];
|
|
@@ -1335,7 +1429,7 @@
|
|
|
1335
1429
|
}
|
|
1336
1430
|
if (s1 !== peg$FAILED) {
|
|
1337
1431
|
peg$reportedPos = s0;
|
|
1338
|
-
s1 = peg$
|
|
1432
|
+
s1 = peg$c50(s1);
|
|
1339
1433
|
}
|
|
1340
1434
|
s0 = s1;
|
|
1341
1435
|
|
|
@@ -1345,63 +1439,63 @@
|
|
|
1345
1439
|
function peg$parsechar() {
|
|
1346
1440
|
var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
1347
1441
|
|
|
1348
|
-
if (peg$
|
|
1442
|
+
if (peg$c51.test(input.charAt(peg$currPos))) {
|
|
1349
1443
|
s0 = input.charAt(peg$currPos);
|
|
1350
1444
|
peg$currPos++;
|
|
1351
1445
|
} else {
|
|
1352
1446
|
s0 = peg$FAILED;
|
|
1353
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1447
|
+
if (peg$silentFails === 0) { peg$fail(peg$c52); }
|
|
1354
1448
|
}
|
|
1355
1449
|
if (s0 === peg$FAILED) {
|
|
1356
1450
|
s0 = peg$currPos;
|
|
1357
|
-
if (input.substr(peg$currPos, 2) === peg$
|
|
1358
|
-
s1 = peg$
|
|
1451
|
+
if (input.substr(peg$currPos, 2) === peg$c53) {
|
|
1452
|
+
s1 = peg$c53;
|
|
1359
1453
|
peg$currPos += 2;
|
|
1360
1454
|
} else {
|
|
1361
1455
|
s1 = peg$FAILED;
|
|
1362
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1456
|
+
if (peg$silentFails === 0) { peg$fail(peg$c54); }
|
|
1363
1457
|
}
|
|
1364
1458
|
if (s1 !== peg$FAILED) {
|
|
1365
1459
|
peg$reportedPos = s0;
|
|
1366
|
-
s1 = peg$
|
|
1460
|
+
s1 = peg$c55();
|
|
1367
1461
|
}
|
|
1368
1462
|
s0 = s1;
|
|
1369
1463
|
if (s0 === peg$FAILED) {
|
|
1370
1464
|
s0 = peg$currPos;
|
|
1371
|
-
if (input.substr(peg$currPos, 2) === peg$
|
|
1372
|
-
s1 = peg$
|
|
1465
|
+
if (input.substr(peg$currPos, 2) === peg$c56) {
|
|
1466
|
+
s1 = peg$c56;
|
|
1373
1467
|
peg$currPos += 2;
|
|
1374
1468
|
} else {
|
|
1375
1469
|
s1 = peg$FAILED;
|
|
1376
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1470
|
+
if (peg$silentFails === 0) { peg$fail(peg$c57); }
|
|
1377
1471
|
}
|
|
1378
1472
|
if (s1 !== peg$FAILED) {
|
|
1379
1473
|
peg$reportedPos = s0;
|
|
1380
|
-
s1 = peg$
|
|
1474
|
+
s1 = peg$c58();
|
|
1381
1475
|
}
|
|
1382
1476
|
s0 = s1;
|
|
1383
1477
|
if (s0 === peg$FAILED) {
|
|
1384
1478
|
s0 = peg$currPos;
|
|
1385
|
-
if (input.substr(peg$currPos, 2) === peg$
|
|
1386
|
-
s1 = peg$
|
|
1479
|
+
if (input.substr(peg$currPos, 2) === peg$c59) {
|
|
1480
|
+
s1 = peg$c59;
|
|
1387
1481
|
peg$currPos += 2;
|
|
1388
1482
|
} else {
|
|
1389
1483
|
s1 = peg$FAILED;
|
|
1390
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1484
|
+
if (peg$silentFails === 0) { peg$fail(peg$c60); }
|
|
1391
1485
|
}
|
|
1392
1486
|
if (s1 !== peg$FAILED) {
|
|
1393
1487
|
peg$reportedPos = s0;
|
|
1394
|
-
s1 = peg$
|
|
1488
|
+
s1 = peg$c61();
|
|
1395
1489
|
}
|
|
1396
1490
|
s0 = s1;
|
|
1397
1491
|
if (s0 === peg$FAILED) {
|
|
1398
1492
|
s0 = peg$currPos;
|
|
1399
|
-
if (input.substr(peg$currPos, 2) === peg$
|
|
1400
|
-
s1 = peg$
|
|
1493
|
+
if (input.substr(peg$currPos, 2) === peg$c62) {
|
|
1494
|
+
s1 = peg$c62;
|
|
1401
1495
|
peg$currPos += 2;
|
|
1402
1496
|
} else {
|
|
1403
1497
|
s1 = peg$FAILED;
|
|
1404
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1498
|
+
if (peg$silentFails === 0) { peg$fail(peg$c63); }
|
|
1405
1499
|
}
|
|
1406
1500
|
if (s1 !== peg$FAILED) {
|
|
1407
1501
|
s2 = peg$currPos;
|
|
@@ -1438,7 +1532,7 @@
|
|
|
1438
1532
|
s2 = s3;
|
|
1439
1533
|
if (s2 !== peg$FAILED) {
|
|
1440
1534
|
peg$reportedPos = s0;
|
|
1441
|
-
s1 = peg$
|
|
1535
|
+
s1 = peg$c64(s2);
|
|
1442
1536
|
s0 = s1;
|
|
1443
1537
|
} else {
|
|
1444
1538
|
peg$currPos = s0;
|
|
@@ -1472,7 +1566,7 @@
|
|
|
1472
1566
|
}
|
|
1473
1567
|
if (s1 !== peg$FAILED) {
|
|
1474
1568
|
peg$reportedPos = s0;
|
|
1475
|
-
s1 = peg$
|
|
1569
|
+
s1 = peg$c65(s1);
|
|
1476
1570
|
}
|
|
1477
1571
|
s0 = s1;
|
|
1478
1572
|
|
|
@@ -1518,12 +1612,11 @@
|
|
|
1518
1612
|
// Defined first because it's used to build the format pattern.
|
|
1519
1613
|
$$es5$$defineProperty(this, '_locale', {value: this._resolveLocale(locales)});
|
|
1520
1614
|
|
|
1521
|
-
var pluralFn = $$core$$MessageFormat.__localeData__[this._locale].pluralRuleFunction;
|
|
1522
|
-
|
|
1523
1615
|
// Compile the `ast` to a pattern that is highly optimized for repeated
|
|
1524
1616
|
// `format()` invocations. **Note:** This passes the `locales` set provided
|
|
1525
1617
|
// to the constructor instead of just the resolved locale.
|
|
1526
|
-
var
|
|
1618
|
+
var pluralFn = this._findPluralRuleFunction(this._locale);
|
|
1619
|
+
var pattern = this._compilePattern(ast, locales, formats, pluralFn);
|
|
1527
1620
|
|
|
1528
1621
|
// "Bind" `format()` method to `this` so it can be passed by reference like
|
|
1529
1622
|
// the other `Intl` APIs.
|
|
@@ -1616,17 +1709,7 @@
|
|
|
1616
1709
|
);
|
|
1617
1710
|
}
|
|
1618
1711
|
|
|
1619
|
-
|
|
1620
|
-
throw new Error(
|
|
1621
|
-
'Locale data provided to IntlMessageFormat is missing a ' +
|
|
1622
|
-
'`pluralRuleFunction` property'
|
|
1623
|
-
);
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
// Message format locale data only requires the first part of the tag.
|
|
1627
|
-
var locale = data.locale.toLowerCase().split('-')[0];
|
|
1628
|
-
|
|
1629
|
-
$$core$$MessageFormat.__localeData__[locale] = data;
|
|
1712
|
+
$$core$$MessageFormat.__localeData__[data.locale.toLowerCase()] = data;
|
|
1630
1713
|
}});
|
|
1631
1714
|
|
|
1632
1715
|
// Defines `__parse()` static method as an exposed private.
|
|
@@ -1652,6 +1735,26 @@
|
|
|
1652
1735
|
return compiler.compile(ast);
|
|
1653
1736
|
};
|
|
1654
1737
|
|
|
1738
|
+
$$core$$MessageFormat.prototype._findPluralRuleFunction = function (locale) {
|
|
1739
|
+
var localeData = $$core$$MessageFormat.__localeData__;
|
|
1740
|
+
var data = localeData[locale.toLowerCase()];
|
|
1741
|
+
|
|
1742
|
+
// The locale data is de-duplicated, so we have to traverse the locale's
|
|
1743
|
+
// hierarchy until we find a `pluralRuleFunction` to return.
|
|
1744
|
+
while (data) {
|
|
1745
|
+
if (data.pluralRuleFunction) {
|
|
1746
|
+
return data.pluralRuleFunction;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
data = data.parentLocale && localeData[data.parentLocale.toLowerCase()];
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
throw new Error(
|
|
1753
|
+
'Locale data added to IntlMessageFormat is missing a ' +
|
|
1754
|
+
'`pluralRuleFunction` for :' + locale
|
|
1755
|
+
);
|
|
1756
|
+
};
|
|
1757
|
+
|
|
1655
1758
|
$$core$$MessageFormat.prototype._format = function (pattern, values) {
|
|
1656
1759
|
var result = '',
|
|
1657
1760
|
i, len, part, id, value;
|
|
@@ -1705,41 +1808,43 @@
|
|
|
1705
1808
|
};
|
|
1706
1809
|
|
|
1707
1810
|
$$core$$MessageFormat.prototype._resolveLocale = function (locales) {
|
|
1708
|
-
if (!locales) {
|
|
1709
|
-
locales = $$core$$MessageFormat.defaultLocale;
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1712
1811
|
if (typeof locales === 'string') {
|
|
1713
1812
|
locales = [locales];
|
|
1714
1813
|
}
|
|
1715
1814
|
|
|
1815
|
+
// Create a copy of the array so we can push on the default locale.
|
|
1816
|
+
locales = (locales || []).concat($$core$$MessageFormat.defaultLocale);
|
|
1817
|
+
|
|
1716
1818
|
var localeData = $$core$$MessageFormat.__localeData__;
|
|
1717
|
-
var i, len,
|
|
1819
|
+
var i, len, localeParts, data;
|
|
1718
1820
|
|
|
1821
|
+
// Using the set of locales + the default locale, we look for the first one
|
|
1822
|
+
// which that has been registered. When data does not exist for a locale, we
|
|
1823
|
+
// traverse its ancestors to find something that's been registered within
|
|
1824
|
+
// its hierarchy of locales. Since we lack the proper `parentLocale` data
|
|
1825
|
+
// here, we must take a naive approach to traversal.
|
|
1719
1826
|
for (i = 0, len = locales.length; i < len; i += 1) {
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
}
|
|
1827
|
+
localeParts = locales[i].toLowerCase().split('-');
|
|
1828
|
+
|
|
1829
|
+
while (localeParts.length) {
|
|
1830
|
+
data = localeData[localeParts.join('-')];
|
|
1831
|
+
if (data) {
|
|
1832
|
+
// Return the normalized locale string; e.g., we return "en-US",
|
|
1833
|
+
// instead of "en-us".
|
|
1834
|
+
return data.locale;
|
|
1835
|
+
}
|
|
1730
1836
|
|
|
1731
|
-
|
|
1732
|
-
if ($$utils$$hop.call(localeData, locale)) {
|
|
1733
|
-
return locale;
|
|
1837
|
+
localeParts.pop();
|
|
1734
1838
|
}
|
|
1735
1839
|
}
|
|
1736
1840
|
|
|
1841
|
+
var defaultLocale = locales.pop();
|
|
1737
1842
|
throw new Error(
|
|
1738
1843
|
'No locale data has been added to IntlMessageFormat for: ' +
|
|
1739
|
-
locales.join(', ')
|
|
1844
|
+
locales.join(', ') + ', or the default locale: ' + defaultLocale
|
|
1740
1845
|
);
|
|
1741
1846
|
};
|
|
1742
|
-
var $$en$$default = {"locale":"en","pluralRuleFunction":function (n)
|
|
1847
|
+
var $$en$$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"}};
|
|
1743
1848
|
|
|
1744
1849
|
$$core$$default.__addLocaleData($$en$$default);
|
|
1745
1850
|
$$core$$default.defaultLocale = 'en';
|