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
|
@@ -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,88 @@
|
|
|
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 '\\#'; },
|
|
419
|
+
peg$c59 = "\\{",
|
|
420
|
+
peg$c60 = { type: "literal", value: "\\{", description: "\"\\\\{\"" },
|
|
421
|
+
peg$c61 = function() { return '\u007B'; },
|
|
422
|
+
peg$c62 = "\\}",
|
|
423
|
+
peg$c63 = { type: "literal", value: "\\}", description: "\"\\\\}\"" },
|
|
424
|
+
peg$c64 = function() { return '\u007D'; },
|
|
425
|
+
peg$c65 = "\\u",
|
|
426
|
+
peg$c66 = { type: "literal", value: "\\u", description: "\"\\\\u\"" },
|
|
427
|
+
peg$c67 = function(digits) {
|
|
404
428
|
return String.fromCharCode(parseInt(digits, 16));
|
|
405
429
|
},
|
|
406
|
-
peg$
|
|
430
|
+
peg$c68 = function(chars) { return chars.join(''); },
|
|
407
431
|
|
|
408
432
|
peg$currPos = 0,
|
|
409
433
|
peg$reportedPos = 0,
|
|
@@ -832,7 +856,10 @@
|
|
|
832
856
|
if (s0 === peg$FAILED) {
|
|
833
857
|
s0 = peg$parsepluralFormat();
|
|
834
858
|
if (s0 === peg$FAILED) {
|
|
835
|
-
s0 = peg$
|
|
859
|
+
s0 = peg$parseselectOrdinalFormat();
|
|
860
|
+
if (s0 === peg$FAILED) {
|
|
861
|
+
s0 = peg$parseselectFormat();
|
|
862
|
+
}
|
|
836
863
|
}
|
|
837
864
|
}
|
|
838
865
|
|
|
@@ -922,7 +949,7 @@
|
|
|
922
949
|
}
|
|
923
950
|
|
|
924
951
|
function peg$parsepluralFormat() {
|
|
925
|
-
var s0, s1, s2, s3, s4, s5
|
|
952
|
+
var s0, s1, s2, s3, s4, s5;
|
|
926
953
|
|
|
927
954
|
s0 = peg$currPos;
|
|
928
955
|
if (input.substr(peg$currPos, 6) === peg$c22) {
|
|
@@ -945,35 +972,64 @@
|
|
|
945
972
|
if (s3 !== peg$FAILED) {
|
|
946
973
|
s4 = peg$parse_();
|
|
947
974
|
if (s4 !== peg$FAILED) {
|
|
948
|
-
s5 = peg$
|
|
949
|
-
if (s5
|
|
950
|
-
|
|
975
|
+
s5 = peg$parsepluralStyle();
|
|
976
|
+
if (s5 !== peg$FAILED) {
|
|
977
|
+
peg$reportedPos = s0;
|
|
978
|
+
s1 = peg$c24(s5);
|
|
979
|
+
s0 = s1;
|
|
980
|
+
} else {
|
|
981
|
+
peg$currPos = s0;
|
|
982
|
+
s0 = peg$c2;
|
|
951
983
|
}
|
|
984
|
+
} else {
|
|
985
|
+
peg$currPos = s0;
|
|
986
|
+
s0 = peg$c2;
|
|
987
|
+
}
|
|
988
|
+
} else {
|
|
989
|
+
peg$currPos = s0;
|
|
990
|
+
s0 = peg$c2;
|
|
991
|
+
}
|
|
992
|
+
} else {
|
|
993
|
+
peg$currPos = s0;
|
|
994
|
+
s0 = peg$c2;
|
|
995
|
+
}
|
|
996
|
+
} else {
|
|
997
|
+
peg$currPos = s0;
|
|
998
|
+
s0 = peg$c2;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
return s0;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
function peg$parseselectOrdinalFormat() {
|
|
1005
|
+
var s0, s1, s2, s3, s4, s5;
|
|
1006
|
+
|
|
1007
|
+
s0 = peg$currPos;
|
|
1008
|
+
if (input.substr(peg$currPos, 13) === peg$c25) {
|
|
1009
|
+
s1 = peg$c25;
|
|
1010
|
+
peg$currPos += 13;
|
|
1011
|
+
} else {
|
|
1012
|
+
s1 = peg$FAILED;
|
|
1013
|
+
if (peg$silentFails === 0) { peg$fail(peg$c26); }
|
|
1014
|
+
}
|
|
1015
|
+
if (s1 !== peg$FAILED) {
|
|
1016
|
+
s2 = peg$parse_();
|
|
1017
|
+
if (s2 !== peg$FAILED) {
|
|
1018
|
+
if (input.charCodeAt(peg$currPos) === 44) {
|
|
1019
|
+
s3 = peg$c10;
|
|
1020
|
+
peg$currPos++;
|
|
1021
|
+
} else {
|
|
1022
|
+
s3 = peg$FAILED;
|
|
1023
|
+
if (peg$silentFails === 0) { peg$fail(peg$c11); }
|
|
1024
|
+
}
|
|
1025
|
+
if (s3 !== peg$FAILED) {
|
|
1026
|
+
s4 = peg$parse_();
|
|
1027
|
+
if (s4 !== peg$FAILED) {
|
|
1028
|
+
s5 = peg$parsepluralStyle();
|
|
952
1029
|
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
|
-
}
|
|
1030
|
+
peg$reportedPos = s0;
|
|
1031
|
+
s1 = peg$c27(s5);
|
|
1032
|
+
s0 = s1;
|
|
977
1033
|
} else {
|
|
978
1034
|
peg$currPos = s0;
|
|
979
1035
|
s0 = peg$c2;
|
|
@@ -1002,12 +1058,12 @@
|
|
|
1002
1058
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
1003
1059
|
|
|
1004
1060
|
s0 = peg$currPos;
|
|
1005
|
-
if (input.substr(peg$currPos, 6) === peg$
|
|
1006
|
-
s1 = peg$
|
|
1061
|
+
if (input.substr(peg$currPos, 6) === peg$c28) {
|
|
1062
|
+
s1 = peg$c28;
|
|
1007
1063
|
peg$currPos += 6;
|
|
1008
1064
|
} else {
|
|
1009
1065
|
s1 = peg$FAILED;
|
|
1010
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1066
|
+
if (peg$silentFails === 0) { peg$fail(peg$c29); }
|
|
1011
1067
|
}
|
|
1012
1068
|
if (s1 !== peg$FAILED) {
|
|
1013
1069
|
s2 = peg$parse_();
|
|
@@ -1034,7 +1090,7 @@
|
|
|
1034
1090
|
}
|
|
1035
1091
|
if (s5 !== peg$FAILED) {
|
|
1036
1092
|
peg$reportedPos = s0;
|
|
1037
|
-
s1 = peg$
|
|
1093
|
+
s1 = peg$c30(s5);
|
|
1038
1094
|
s0 = s1;
|
|
1039
1095
|
} else {
|
|
1040
1096
|
peg$currPos = s0;
|
|
@@ -1066,11 +1122,11 @@
|
|
|
1066
1122
|
s0 = peg$currPos;
|
|
1067
1123
|
s1 = peg$currPos;
|
|
1068
1124
|
if (input.charCodeAt(peg$currPos) === 61) {
|
|
1069
|
-
s2 = peg$
|
|
1125
|
+
s2 = peg$c31;
|
|
1070
1126
|
peg$currPos++;
|
|
1071
1127
|
} else {
|
|
1072
1128
|
s2 = peg$FAILED;
|
|
1073
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1129
|
+
if (peg$silentFails === 0) { peg$fail(peg$c32); }
|
|
1074
1130
|
}
|
|
1075
1131
|
if (s2 !== peg$FAILED) {
|
|
1076
1132
|
s3 = peg$parsenumber();
|
|
@@ -1129,7 +1185,7 @@
|
|
|
1129
1185
|
}
|
|
1130
1186
|
if (s8 !== peg$FAILED) {
|
|
1131
1187
|
peg$reportedPos = s0;
|
|
1132
|
-
s1 = peg$
|
|
1188
|
+
s1 = peg$c33(s2, s6);
|
|
1133
1189
|
s0 = s1;
|
|
1134
1190
|
} else {
|
|
1135
1191
|
peg$currPos = s0;
|
|
@@ -1171,12 +1227,12 @@
|
|
|
1171
1227
|
var s0, s1, s2, s3;
|
|
1172
1228
|
|
|
1173
1229
|
s0 = peg$currPos;
|
|
1174
|
-
if (input.substr(peg$currPos, 7) === peg$
|
|
1175
|
-
s1 = peg$
|
|
1230
|
+
if (input.substr(peg$currPos, 7) === peg$c34) {
|
|
1231
|
+
s1 = peg$c34;
|
|
1176
1232
|
peg$currPos += 7;
|
|
1177
1233
|
} else {
|
|
1178
1234
|
s1 = peg$FAILED;
|
|
1179
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1235
|
+
if (peg$silentFails === 0) { peg$fail(peg$c35); }
|
|
1180
1236
|
}
|
|
1181
1237
|
if (s1 !== peg$FAILED) {
|
|
1182
1238
|
s2 = peg$parse_();
|
|
@@ -1184,7 +1240,48 @@
|
|
|
1184
1240
|
s3 = peg$parsenumber();
|
|
1185
1241
|
if (s3 !== peg$FAILED) {
|
|
1186
1242
|
peg$reportedPos = s0;
|
|
1187
|
-
s1 = peg$
|
|
1243
|
+
s1 = peg$c36(s3);
|
|
1244
|
+
s0 = s1;
|
|
1245
|
+
} else {
|
|
1246
|
+
peg$currPos = s0;
|
|
1247
|
+
s0 = peg$c2;
|
|
1248
|
+
}
|
|
1249
|
+
} else {
|
|
1250
|
+
peg$currPos = s0;
|
|
1251
|
+
s0 = peg$c2;
|
|
1252
|
+
}
|
|
1253
|
+
} else {
|
|
1254
|
+
peg$currPos = s0;
|
|
1255
|
+
s0 = peg$c2;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
return s0;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
function peg$parsepluralStyle() {
|
|
1262
|
+
var s0, s1, s2, s3, s4;
|
|
1263
|
+
|
|
1264
|
+
s0 = peg$currPos;
|
|
1265
|
+
s1 = peg$parseoffset();
|
|
1266
|
+
if (s1 === peg$FAILED) {
|
|
1267
|
+
s1 = peg$c9;
|
|
1268
|
+
}
|
|
1269
|
+
if (s1 !== peg$FAILED) {
|
|
1270
|
+
s2 = peg$parse_();
|
|
1271
|
+
if (s2 !== peg$FAILED) {
|
|
1272
|
+
s3 = [];
|
|
1273
|
+
s4 = peg$parseoptionalFormatPattern();
|
|
1274
|
+
if (s4 !== peg$FAILED) {
|
|
1275
|
+
while (s4 !== peg$FAILED) {
|
|
1276
|
+
s3.push(s4);
|
|
1277
|
+
s4 = peg$parseoptionalFormatPattern();
|
|
1278
|
+
}
|
|
1279
|
+
} else {
|
|
1280
|
+
s3 = peg$c2;
|
|
1281
|
+
}
|
|
1282
|
+
if (s3 !== peg$FAILED) {
|
|
1283
|
+
peg$reportedPos = s0;
|
|
1284
|
+
s1 = peg$c37(s1, s3);
|
|
1188
1285
|
s0 = s1;
|
|
1189
1286
|
} else {
|
|
1190
1287
|
peg$currPos = s0;
|
|
@@ -1207,22 +1304,22 @@
|
|
|
1207
1304
|
|
|
1208
1305
|
peg$silentFails++;
|
|
1209
1306
|
s0 = [];
|
|
1210
|
-
if (peg$
|
|
1307
|
+
if (peg$c39.test(input.charAt(peg$currPos))) {
|
|
1211
1308
|
s1 = input.charAt(peg$currPos);
|
|
1212
1309
|
peg$currPos++;
|
|
1213
1310
|
} else {
|
|
1214
1311
|
s1 = peg$FAILED;
|
|
1215
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1312
|
+
if (peg$silentFails === 0) { peg$fail(peg$c40); }
|
|
1216
1313
|
}
|
|
1217
1314
|
if (s1 !== peg$FAILED) {
|
|
1218
1315
|
while (s1 !== peg$FAILED) {
|
|
1219
1316
|
s0.push(s1);
|
|
1220
|
-
if (peg$
|
|
1317
|
+
if (peg$c39.test(input.charAt(peg$currPos))) {
|
|
1221
1318
|
s1 = input.charAt(peg$currPos);
|
|
1222
1319
|
peg$currPos++;
|
|
1223
1320
|
} else {
|
|
1224
1321
|
s1 = peg$FAILED;
|
|
1225
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1322
|
+
if (peg$silentFails === 0) { peg$fail(peg$c40); }
|
|
1226
1323
|
}
|
|
1227
1324
|
}
|
|
1228
1325
|
} else {
|
|
@@ -1231,7 +1328,7 @@
|
|
|
1231
1328
|
peg$silentFails--;
|
|
1232
1329
|
if (s0 === peg$FAILED) {
|
|
1233
1330
|
s1 = peg$FAILED;
|
|
1234
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1331
|
+
if (peg$silentFails === 0) { peg$fail(peg$c38); }
|
|
1235
1332
|
}
|
|
1236
1333
|
|
|
1237
1334
|
return s0;
|
|
@@ -1255,7 +1352,7 @@
|
|
|
1255
1352
|
peg$silentFails--;
|
|
1256
1353
|
if (s0 === peg$FAILED) {
|
|
1257
1354
|
s1 = peg$FAILED;
|
|
1258
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1355
|
+
if (peg$silentFails === 0) { peg$fail(peg$c41); }
|
|
1259
1356
|
}
|
|
1260
1357
|
|
|
1261
1358
|
return s0;
|
|
@@ -1264,12 +1361,12 @@
|
|
|
1264
1361
|
function peg$parsedigit() {
|
|
1265
1362
|
var s0;
|
|
1266
1363
|
|
|
1267
|
-
if (peg$
|
|
1364
|
+
if (peg$c42.test(input.charAt(peg$currPos))) {
|
|
1268
1365
|
s0 = input.charAt(peg$currPos);
|
|
1269
1366
|
peg$currPos++;
|
|
1270
1367
|
} else {
|
|
1271
1368
|
s0 = peg$FAILED;
|
|
1272
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1369
|
+
if (peg$silentFails === 0) { peg$fail(peg$c43); }
|
|
1273
1370
|
}
|
|
1274
1371
|
|
|
1275
1372
|
return s0;
|
|
@@ -1278,12 +1375,12 @@
|
|
|
1278
1375
|
function peg$parsehexDigit() {
|
|
1279
1376
|
var s0;
|
|
1280
1377
|
|
|
1281
|
-
if (peg$
|
|
1378
|
+
if (peg$c44.test(input.charAt(peg$currPos))) {
|
|
1282
1379
|
s0 = input.charAt(peg$currPos);
|
|
1283
1380
|
peg$currPos++;
|
|
1284
1381
|
} else {
|
|
1285
1382
|
s0 = peg$FAILED;
|
|
1286
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1383
|
+
if (peg$silentFails === 0) { peg$fail(peg$c45); }
|
|
1287
1384
|
}
|
|
1288
1385
|
|
|
1289
1386
|
return s0;
|
|
@@ -1294,21 +1391,21 @@
|
|
|
1294
1391
|
|
|
1295
1392
|
s0 = peg$currPos;
|
|
1296
1393
|
if (input.charCodeAt(peg$currPos) === 48) {
|
|
1297
|
-
s1 = peg$
|
|
1394
|
+
s1 = peg$c46;
|
|
1298
1395
|
peg$currPos++;
|
|
1299
1396
|
} else {
|
|
1300
1397
|
s1 = peg$FAILED;
|
|
1301
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1398
|
+
if (peg$silentFails === 0) { peg$fail(peg$c47); }
|
|
1302
1399
|
}
|
|
1303
1400
|
if (s1 === peg$FAILED) {
|
|
1304
1401
|
s1 = peg$currPos;
|
|
1305
1402
|
s2 = peg$currPos;
|
|
1306
|
-
if (peg$
|
|
1403
|
+
if (peg$c48.test(input.charAt(peg$currPos))) {
|
|
1307
1404
|
s3 = input.charAt(peg$currPos);
|
|
1308
1405
|
peg$currPos++;
|
|
1309
1406
|
} else {
|
|
1310
1407
|
s3 = peg$FAILED;
|
|
1311
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1408
|
+
if (peg$silentFails === 0) { peg$fail(peg$c49); }
|
|
1312
1409
|
}
|
|
1313
1410
|
if (s3 !== peg$FAILED) {
|
|
1314
1411
|
s4 = [];
|
|
@@ -1335,7 +1432,7 @@
|
|
|
1335
1432
|
}
|
|
1336
1433
|
if (s1 !== peg$FAILED) {
|
|
1337
1434
|
peg$reportedPos = s0;
|
|
1338
|
-
s1 = peg$
|
|
1435
|
+
s1 = peg$c50(s1);
|
|
1339
1436
|
}
|
|
1340
1437
|
s0 = s1;
|
|
1341
1438
|
|
|
@@ -1345,77 +1442,95 @@
|
|
|
1345
1442
|
function peg$parsechar() {
|
|
1346
1443
|
var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
1347
1444
|
|
|
1348
|
-
if (peg$
|
|
1445
|
+
if (peg$c51.test(input.charAt(peg$currPos))) {
|
|
1349
1446
|
s0 = input.charAt(peg$currPos);
|
|
1350
1447
|
peg$currPos++;
|
|
1351
1448
|
} else {
|
|
1352
1449
|
s0 = peg$FAILED;
|
|
1353
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1450
|
+
if (peg$silentFails === 0) { peg$fail(peg$c52); }
|
|
1354
1451
|
}
|
|
1355
1452
|
if (s0 === peg$FAILED) {
|
|
1356
1453
|
s0 = peg$currPos;
|
|
1357
|
-
if (input.substr(peg$currPos, 2) === peg$
|
|
1358
|
-
s1 = peg$
|
|
1454
|
+
if (input.substr(peg$currPos, 2) === peg$c53) {
|
|
1455
|
+
s1 = peg$c53;
|
|
1359
1456
|
peg$currPos += 2;
|
|
1360
1457
|
} else {
|
|
1361
1458
|
s1 = peg$FAILED;
|
|
1362
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1459
|
+
if (peg$silentFails === 0) { peg$fail(peg$c54); }
|
|
1363
1460
|
}
|
|
1364
1461
|
if (s1 !== peg$FAILED) {
|
|
1365
1462
|
peg$reportedPos = s0;
|
|
1366
|
-
s1 = peg$
|
|
1463
|
+
s1 = peg$c55();
|
|
1367
1464
|
}
|
|
1368
1465
|
s0 = s1;
|
|
1369
1466
|
if (s0 === peg$FAILED) {
|
|
1370
1467
|
s0 = peg$currPos;
|
|
1371
|
-
if (input.substr(peg$currPos, 2) === peg$
|
|
1372
|
-
s1 = peg$
|
|
1468
|
+
if (input.substr(peg$currPos, 2) === peg$c56) {
|
|
1469
|
+
s1 = peg$c56;
|
|
1373
1470
|
peg$currPos += 2;
|
|
1374
1471
|
} else {
|
|
1375
1472
|
s1 = peg$FAILED;
|
|
1376
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1473
|
+
if (peg$silentFails === 0) { peg$fail(peg$c57); }
|
|
1377
1474
|
}
|
|
1378
1475
|
if (s1 !== peg$FAILED) {
|
|
1379
1476
|
peg$reportedPos = s0;
|
|
1380
|
-
s1 = peg$
|
|
1477
|
+
s1 = peg$c58();
|
|
1381
1478
|
}
|
|
1382
1479
|
s0 = s1;
|
|
1383
1480
|
if (s0 === peg$FAILED) {
|
|
1384
1481
|
s0 = peg$currPos;
|
|
1385
|
-
if (input.substr(peg$currPos, 2) === peg$
|
|
1386
|
-
s1 = peg$
|
|
1482
|
+
if (input.substr(peg$currPos, 2) === peg$c59) {
|
|
1483
|
+
s1 = peg$c59;
|
|
1387
1484
|
peg$currPos += 2;
|
|
1388
1485
|
} else {
|
|
1389
1486
|
s1 = peg$FAILED;
|
|
1390
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1487
|
+
if (peg$silentFails === 0) { peg$fail(peg$c60); }
|
|
1391
1488
|
}
|
|
1392
1489
|
if (s1 !== peg$FAILED) {
|
|
1393
1490
|
peg$reportedPos = s0;
|
|
1394
|
-
s1 = peg$
|
|
1491
|
+
s1 = peg$c61();
|
|
1395
1492
|
}
|
|
1396
1493
|
s0 = s1;
|
|
1397
1494
|
if (s0 === peg$FAILED) {
|
|
1398
1495
|
s0 = peg$currPos;
|
|
1399
|
-
if (input.substr(peg$currPos, 2) === peg$
|
|
1400
|
-
s1 = peg$
|
|
1496
|
+
if (input.substr(peg$currPos, 2) === peg$c62) {
|
|
1497
|
+
s1 = peg$c62;
|
|
1401
1498
|
peg$currPos += 2;
|
|
1402
1499
|
} else {
|
|
1403
1500
|
s1 = peg$FAILED;
|
|
1404
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1501
|
+
if (peg$silentFails === 0) { peg$fail(peg$c63); }
|
|
1405
1502
|
}
|
|
1406
1503
|
if (s1 !== peg$FAILED) {
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1504
|
+
peg$reportedPos = s0;
|
|
1505
|
+
s1 = peg$c64();
|
|
1506
|
+
}
|
|
1507
|
+
s0 = s1;
|
|
1508
|
+
if (s0 === peg$FAILED) {
|
|
1509
|
+
s0 = peg$currPos;
|
|
1510
|
+
if (input.substr(peg$currPos, 2) === peg$c65) {
|
|
1511
|
+
s1 = peg$c65;
|
|
1512
|
+
peg$currPos += 2;
|
|
1513
|
+
} else {
|
|
1514
|
+
s1 = peg$FAILED;
|
|
1515
|
+
if (peg$silentFails === 0) { peg$fail(peg$c66); }
|
|
1516
|
+
}
|
|
1517
|
+
if (s1 !== peg$FAILED) {
|
|
1518
|
+
s2 = peg$currPos;
|
|
1519
|
+
s3 = peg$currPos;
|
|
1520
|
+
s4 = peg$parsehexDigit();
|
|
1521
|
+
if (s4 !== peg$FAILED) {
|
|
1522
|
+
s5 = peg$parsehexDigit();
|
|
1523
|
+
if (s5 !== peg$FAILED) {
|
|
1524
|
+
s6 = peg$parsehexDigit();
|
|
1525
|
+
if (s6 !== peg$FAILED) {
|
|
1526
|
+
s7 = peg$parsehexDigit();
|
|
1527
|
+
if (s7 !== peg$FAILED) {
|
|
1528
|
+
s4 = [s4, s5, s6, s7];
|
|
1529
|
+
s3 = s4;
|
|
1530
|
+
} else {
|
|
1531
|
+
peg$currPos = s3;
|
|
1532
|
+
s3 = peg$c2;
|
|
1533
|
+
}
|
|
1419
1534
|
} else {
|
|
1420
1535
|
peg$currPos = s3;
|
|
1421
1536
|
s3 = peg$c2;
|
|
@@ -1428,25 +1543,22 @@
|
|
|
1428
1543
|
peg$currPos = s3;
|
|
1429
1544
|
s3 = peg$c2;
|
|
1430
1545
|
}
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1546
|
+
if (s3 !== peg$FAILED) {
|
|
1547
|
+
s3 = input.substring(s2, peg$currPos);
|
|
1548
|
+
}
|
|
1549
|
+
s2 = s3;
|
|
1550
|
+
if (s2 !== peg$FAILED) {
|
|
1551
|
+
peg$reportedPos = s0;
|
|
1552
|
+
s1 = peg$c67(s2);
|
|
1553
|
+
s0 = s1;
|
|
1554
|
+
} else {
|
|
1555
|
+
peg$currPos = s0;
|
|
1556
|
+
s0 = peg$c2;
|
|
1557
|
+
}
|
|
1443
1558
|
} else {
|
|
1444
1559
|
peg$currPos = s0;
|
|
1445
1560
|
s0 = peg$c2;
|
|
1446
1561
|
}
|
|
1447
|
-
} else {
|
|
1448
|
-
peg$currPos = s0;
|
|
1449
|
-
s0 = peg$c2;
|
|
1450
1562
|
}
|
|
1451
1563
|
}
|
|
1452
1564
|
}
|
|
@@ -1472,7 +1584,7 @@
|
|
|
1472
1584
|
}
|
|
1473
1585
|
if (s1 !== peg$FAILED) {
|
|
1474
1586
|
peg$reportedPos = s0;
|
|
1475
|
-
s1 = peg$
|
|
1587
|
+
s1 = peg$c68(s1);
|
|
1476
1588
|
}
|
|
1477
1589
|
s0 = s1;
|
|
1478
1590
|
|
|
@@ -1518,12 +1630,11 @@
|
|
|
1518
1630
|
// Defined first because it's used to build the format pattern.
|
|
1519
1631
|
$$es5$$defineProperty(this, '_locale', {value: this._resolveLocale(locales)});
|
|
1520
1632
|
|
|
1521
|
-
var pluralFn = $$core$$MessageFormat.__localeData__[this._locale].pluralRuleFunction;
|
|
1522
|
-
|
|
1523
1633
|
// Compile the `ast` to a pattern that is highly optimized for repeated
|
|
1524
1634
|
// `format()` invocations. **Note:** This passes the `locales` set provided
|
|
1525
1635
|
// to the constructor instead of just the resolved locale.
|
|
1526
|
-
var
|
|
1636
|
+
var pluralFn = this._findPluralRuleFunction(this._locale);
|
|
1637
|
+
var pattern = this._compilePattern(ast, locales, formats, pluralFn);
|
|
1527
1638
|
|
|
1528
1639
|
// "Bind" `format()` method to `this` so it can be passed by reference like
|
|
1529
1640
|
// the other `Intl` APIs.
|
|
@@ -1616,17 +1727,7 @@
|
|
|
1616
1727
|
);
|
|
1617
1728
|
}
|
|
1618
1729
|
|
|
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;
|
|
1730
|
+
$$core$$MessageFormat.__localeData__[data.locale.toLowerCase()] = data;
|
|
1630
1731
|
}});
|
|
1631
1732
|
|
|
1632
1733
|
// Defines `__parse()` static method as an exposed private.
|
|
@@ -1652,6 +1753,26 @@
|
|
|
1652
1753
|
return compiler.compile(ast);
|
|
1653
1754
|
};
|
|
1654
1755
|
|
|
1756
|
+
$$core$$MessageFormat.prototype._findPluralRuleFunction = function (locale) {
|
|
1757
|
+
var localeData = $$core$$MessageFormat.__localeData__;
|
|
1758
|
+
var data = localeData[locale.toLowerCase()];
|
|
1759
|
+
|
|
1760
|
+
// The locale data is de-duplicated, so we have to traverse the locale's
|
|
1761
|
+
// hierarchy until we find a `pluralRuleFunction` to return.
|
|
1762
|
+
while (data) {
|
|
1763
|
+
if (data.pluralRuleFunction) {
|
|
1764
|
+
return data.pluralRuleFunction;
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
data = data.parentLocale && localeData[data.parentLocale.toLowerCase()];
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
throw new Error(
|
|
1771
|
+
'Locale data added to IntlMessageFormat is missing a ' +
|
|
1772
|
+
'`pluralRuleFunction` for :' + locale
|
|
1773
|
+
);
|
|
1774
|
+
};
|
|
1775
|
+
|
|
1655
1776
|
$$core$$MessageFormat.prototype._format = function (pattern, values) {
|
|
1656
1777
|
var result = '',
|
|
1657
1778
|
i, len, part, id, value;
|
|
@@ -1705,41 +1826,43 @@
|
|
|
1705
1826
|
};
|
|
1706
1827
|
|
|
1707
1828
|
$$core$$MessageFormat.prototype._resolveLocale = function (locales) {
|
|
1708
|
-
if (!locales) {
|
|
1709
|
-
locales = $$core$$MessageFormat.defaultLocale;
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1712
1829
|
if (typeof locales === 'string') {
|
|
1713
1830
|
locales = [locales];
|
|
1714
1831
|
}
|
|
1715
1832
|
|
|
1833
|
+
// Create a copy of the array so we can push on the default locale.
|
|
1834
|
+
locales = (locales || []).concat($$core$$MessageFormat.defaultLocale);
|
|
1835
|
+
|
|
1716
1836
|
var localeData = $$core$$MessageFormat.__localeData__;
|
|
1717
|
-
var i, len,
|
|
1837
|
+
var i, len, localeParts, data;
|
|
1718
1838
|
|
|
1839
|
+
// Using the set of locales + the default locale, we look for the first one
|
|
1840
|
+
// which that has been registered. When data does not exist for a locale, we
|
|
1841
|
+
// traverse its ancestors to find something that's been registered within
|
|
1842
|
+
// its hierarchy of locales. Since we lack the proper `parentLocale` data
|
|
1843
|
+
// here, we must take a naive approach to traversal.
|
|
1719
1844
|
for (i = 0, len = locales.length; i < len; i += 1) {
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
}
|
|
1845
|
+
localeParts = locales[i].toLowerCase().split('-');
|
|
1846
|
+
|
|
1847
|
+
while (localeParts.length) {
|
|
1848
|
+
data = localeData[localeParts.join('-')];
|
|
1849
|
+
if (data) {
|
|
1850
|
+
// Return the normalized locale string; e.g., we return "en-US",
|
|
1851
|
+
// instead of "en-us".
|
|
1852
|
+
return data.locale;
|
|
1853
|
+
}
|
|
1730
1854
|
|
|
1731
|
-
|
|
1732
|
-
if ($$utils$$hop.call(localeData, locale)) {
|
|
1733
|
-
return locale;
|
|
1855
|
+
localeParts.pop();
|
|
1734
1856
|
}
|
|
1735
1857
|
}
|
|
1736
1858
|
|
|
1859
|
+
var defaultLocale = locales.pop();
|
|
1737
1860
|
throw new Error(
|
|
1738
1861
|
'No locale data has been added to IntlMessageFormat for: ' +
|
|
1739
|
-
locales.join(', ')
|
|
1862
|
+
locales.join(', ') + ', or the default locale: ' + defaultLocale
|
|
1740
1863
|
);
|
|
1741
1864
|
};
|
|
1742
|
-
var $$en$$default = {"locale":"en","pluralRuleFunction":function (n)
|
|
1865
|
+
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
1866
|
|
|
1744
1867
|
$$core$$default.__addLocaleData($$en$$default);
|
|
1745
1868
|
$$core$$default.defaultLocale = 'en';
|