twitter_cldr_js 2.2.4 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/History.txt +5 -0
- data/README.md +51 -5
- data/Rakefile +1 -1
- data/lib/assets/javascripts/twitter_cldr/af.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ar.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/be.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/bg.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/bn.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ca.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/cs.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/cy.js +215 -58
- data/lib/assets/javascripts/twitter_cldr/da.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/de-CH.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/de.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/el.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/en-150.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/en-AU.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/en-CA.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/en-GB.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/en-IE.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/en-SG.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/en-ZA.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/en.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/es-419.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/es-CO.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/es-MX.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/es-US.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/es.js +215 -58
- data/lib/assets/javascripts/twitter_cldr/eu.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/fa.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/fi.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/fil.js +215 -58
- data/lib/assets/javascripts/twitter_cldr/fr-BE.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/fr-CA.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/fr-CH.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/fr.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ga.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/gl.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/he.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/hi.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/hr.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/hu.js +215 -58
- data/lib/assets/javascripts/twitter_cldr/id.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/is.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/it-CH.js +2183 -0
- data/lib/assets/javascripts/twitter_cldr/it.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ja.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ko.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/lv.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/msa.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/nl.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/no.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/pl.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/pt.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ro.js +215 -58
- data/lib/assets/javascripts/twitter_cldr/ru.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/sk.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/sq.js +215 -58
- data/lib/assets/javascripts/twitter_cldr/sr.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/sv.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ta.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/th.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/tr.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/uk.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/ur.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/vi.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/zh-cn.js +214 -57
- data/lib/assets/javascripts/twitter_cldr/zh-tw.js +214 -57
- data/lib/twitter_cldr/js/compiler.rb +13 -10
- data/lib/twitter_cldr/js/mustache/bundle.coffee +1 -1
- data/lib/twitter_cldr/js/mustache/calendars/datetime.coffee +1 -1
- data/lib/twitter_cldr/js/mustache/calendars/timespan.coffee +2 -3
- data/lib/twitter_cldr/js/mustache/numbers/numbers.coffee +27 -15
- data/lib/twitter_cldr/js/mustache/parsers/number_parser.coffee +1 -1
- data/lib/twitter_cldr/js/mustache/shared/calendar.coffee +10 -1
- data/lib/twitter_cldr/js/mustache/shared/languages.coffee +15 -0
- data/lib/twitter_cldr/js/mustache/shared/lists.coffee +3 -5
- data/lib/twitter_cldr/js/mustache/shared/phone_codes.coffee +2 -6
- data/lib/twitter_cldr/js/mustache/shared/postal_codes.coffee +22 -0
- data/lib/twitter_cldr/js/mustache/shared/territories_containment.coffee +48 -0
- data/lib/twitter_cldr/js/renderers/base.rb +4 -0
- data/lib/twitter_cldr/js/renderers/bundle.rb +4 -0
- data/lib/twitter_cldr/js/renderers/calendars/additional_date_format_selector_renderer.rb +1 -1
- data/lib/twitter_cldr/js/renderers/calendars/datetime_renderer.rb +19 -9
- data/lib/twitter_cldr/js/renderers/calendars/timespan_renderer.rb +16 -10
- data/lib/twitter_cldr/js/renderers/numbers/numbers_renderer.rb +24 -13
- data/lib/twitter_cldr/js/renderers/parsers/number_parser.rb +1 -3
- data/lib/twitter_cldr/js/renderers/plurals/rules/plural_rules_renderer.rb +35 -4
- data/lib/twitter_cldr/js/renderers/shared/bidi_renderer.rb +1 -1
- data/lib/twitter_cldr/js/renderers/shared/calendar_renderer.rb +2 -2
- data/lib/twitter_cldr/js/renderers/shared/currencies_renderer.rb +1 -1
- data/lib/twitter_cldr/js/renderers/shared/languages_renderer.rb +27 -0
- data/lib/twitter_cldr/js/renderers/shared/list_renderer.rb +2 -2
- data/lib/twitter_cldr/js/renderers/shared/phone_codes_renderer.rb +1 -1
- data/lib/twitter_cldr/js/renderers/shared/postal_codes_renderer.rb +23 -0
- data/lib/twitter_cldr/js/renderers/shared/territories_containment_renderer.rb +20 -0
- data/lib/twitter_cldr/js/renderers.rb +6 -3
- data/lib/twitter_cldr/js/version.rb +1 -1
- data/spec/js/calendars/datetime.spec.js +16 -8
- data/spec/js/calendars/timespan.spec.js +2 -2
- data/spec/js/numbers/abbreviated/abbreviated_number.spec.js +9 -15
- data/spec/js/numbers/abbreviated/long_decimal.ko.spec.js +20 -0
- data/spec/js/numbers/abbreviated/short_decimal.ko.spec.js +20 -0
- data/spec/js/numbers/abbreviated/short_decimal.ru.spec.js +16 -0
- data/spec/js/numbers/currency.spec.js +12 -4
- data/spec/js/parsers/number_parser.spec.js +5 -1
- data/spec/js/shared/languages.spec.js +41 -0
- data/spec/js/shared/lists.spec.js +20 -0
- data/spec/js/shared/phone_codes.spec.js +1 -1
- data/spec/js/shared/postal_codes.spec.js +46 -0
- data/spec/js/shared/territories_containment.spec.js +89 -0
- data/twitter_cldr_js.gemspec +2 -3
- metadata +38 -25
@@ -0,0 +1,2183 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
// Copyright 2012 Twitter, Inc
|
4
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
|
6
|
+
// TwitterCLDR (JavaScript) v2.3.0
|
7
|
+
// Authors: Cameron Dutro [@camertron]
|
8
|
+
Kirill Lashuk [@KL_7]
|
9
|
+
portions by Sven Fuchs [@svenfuchs]
|
10
|
+
// Homepage: https://twitter.com
|
11
|
+
// Description: Provides date, time, number, and list formatting functionality for various Twitter-supported locales in Javascript.
|
12
|
+
*/
|
13
|
+
|
14
|
+
|
15
|
+
/*-module-*/
|
16
|
+
/*_lib/twitter_cldr_*/
|
17
|
+
|
18
|
+
(function() {
|
19
|
+
var TwitterCldr, key, obj, root,
|
20
|
+
__hasProp = {}.hasOwnProperty,
|
21
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
22
|
+
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
23
|
+
|
24
|
+
TwitterCldr = {};
|
25
|
+
|
26
|
+
TwitterCldr.is_rtl = false;
|
27
|
+
|
28
|
+
TwitterCldr.locale = "es-419";
|
29
|
+
|
30
|
+
TwitterCldr.Utilities = (function() {
|
31
|
+
function Utilities() {}
|
32
|
+
|
33
|
+
Utilities.from_char_code = function(code_point) {
|
34
|
+
if (code_point > 0xFFFF) {
|
35
|
+
code_point -= 0x10000;
|
36
|
+
return String.fromCharCode(0xD800 + (code_point >> 10), 0xDC00 + (code_point & 0x3FF));
|
37
|
+
} else {
|
38
|
+
return String.fromCharCode(code_point);
|
39
|
+
}
|
40
|
+
};
|
41
|
+
|
42
|
+
Utilities.char_code_at = function(str, idx) {
|
43
|
+
var code, end, hi, li, low, surrogatePairs;
|
44
|
+
str += '';
|
45
|
+
end = str.length;
|
46
|
+
surrogatePairs = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
47
|
+
while (surrogatePairs.exec(str) !== null) {
|
48
|
+
li = surrogatePairs.lastIndex;
|
49
|
+
if (li - 2 < idx) {
|
50
|
+
idx += 1;
|
51
|
+
} else {
|
52
|
+
break;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
if ((idx >= end) || (idx < 0)) {
|
56
|
+
return NaN;
|
57
|
+
}
|
58
|
+
code = str.charCodeAt(idx);
|
59
|
+
if ((0xD800 <= code) && (code <= 0xDBFF)) {
|
60
|
+
hi = code;
|
61
|
+
low = str.charCodeAt(idx + 1);
|
62
|
+
return ((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;
|
63
|
+
}
|
64
|
+
return code;
|
65
|
+
};
|
66
|
+
|
67
|
+
Utilities.unpack_string = function(str) {
|
68
|
+
var code_point, idx, result, _i, _ref;
|
69
|
+
result = [];
|
70
|
+
for (idx = _i = 0, _ref = str.length; 0 <= _ref ? _i < _ref : _i > _ref; idx = 0 <= _ref ? ++_i : --_i) {
|
71
|
+
code_point = this.char_code_at(str, idx);
|
72
|
+
if (!code_point) {
|
73
|
+
break;
|
74
|
+
}
|
75
|
+
result.push(code_point);
|
76
|
+
}
|
77
|
+
return result;
|
78
|
+
};
|
79
|
+
|
80
|
+
Utilities.pack_array = function(char_arr) {
|
81
|
+
var cur_char;
|
82
|
+
return ((function() {
|
83
|
+
var _i, _len, _results;
|
84
|
+
_results = [];
|
85
|
+
for (_i = 0, _len = char_arr.length; _i < _len; _i++) {
|
86
|
+
cur_char = char_arr[_i];
|
87
|
+
_results.push(this.from_char_code(cur_char));
|
88
|
+
}
|
89
|
+
return _results;
|
90
|
+
}).call(this)).join("");
|
91
|
+
};
|
92
|
+
|
93
|
+
Utilities.arraycopy = function(orig, orig_index, dest, dest_index, length) {
|
94
|
+
var count, elem, _i, _len, _ref;
|
95
|
+
_ref = orig.slice(orig_index, orig_index + length);
|
96
|
+
for (count = _i = 0, _len = _ref.length; _i < _len; count = ++_i) {
|
97
|
+
elem = _ref[count];
|
98
|
+
dest[dest_index + count] = elem;
|
99
|
+
}
|
100
|
+
};
|
101
|
+
|
102
|
+
Utilities.max = function(arr) {
|
103
|
+
var elem, i, max, start_index, _i, _j, _len, _ref;
|
104
|
+
max = null;
|
105
|
+
for (start_index = _i = 0, _len = arr.length; _i < _len; start_index = ++_i) {
|
106
|
+
elem = arr[start_index];
|
107
|
+
if (elem != null) {
|
108
|
+
max = elem;
|
109
|
+
break;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
for (i = _j = start_index, _ref = arr.length; start_index <= _ref ? _j <= _ref : _j >= _ref; i = start_index <= _ref ? ++_j : --_j) {
|
113
|
+
if (arr[i] > max) {
|
114
|
+
max = arr[i];
|
115
|
+
}
|
116
|
+
}
|
117
|
+
return max;
|
118
|
+
};
|
119
|
+
|
120
|
+
Utilities.min = function(arr) {
|
121
|
+
var elem, i, min, start_index, _i, _j, _len, _ref;
|
122
|
+
min = null;
|
123
|
+
for (start_index = _i = 0, _len = arr.length; _i < _len; start_index = ++_i) {
|
124
|
+
elem = arr[start_index];
|
125
|
+
if (elem != null) {
|
126
|
+
min = elem;
|
127
|
+
break;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
for (i = _j = start_index, _ref = arr.length; start_index <= _ref ? _j <= _ref : _j >= _ref; i = start_index <= _ref ? ++_j : --_j) {
|
131
|
+
if (arr[i] < min) {
|
132
|
+
min = arr[i];
|
133
|
+
}
|
134
|
+
}
|
135
|
+
return min;
|
136
|
+
};
|
137
|
+
|
138
|
+
Utilities.is_even = function(num) {
|
139
|
+
return num % 2 === 0;
|
140
|
+
};
|
141
|
+
|
142
|
+
Utilities.is_odd = function(num) {
|
143
|
+
return num % 2 === 1;
|
144
|
+
};
|
145
|
+
|
146
|
+
return Utilities;
|
147
|
+
|
148
|
+
})();
|
149
|
+
|
150
|
+
TwitterCldr.PluralRules = (function() {
|
151
|
+
function PluralRules() {}
|
152
|
+
|
153
|
+
PluralRules.rules = {"keys": ["one","other"], "rule": function(n) { return (function() { if (n == 1) { return "one" } else { return "other" } })(); }};
|
154
|
+
|
155
|
+
PluralRules.all = function() {
|
156
|
+
return this.rules.keys;
|
157
|
+
};
|
158
|
+
|
159
|
+
PluralRules.rule_for = function(number) {
|
160
|
+
var error;
|
161
|
+
try {
|
162
|
+
return this.rules.rule(number);
|
163
|
+
} catch (_error) {
|
164
|
+
error = _error;
|
165
|
+
return "other";
|
166
|
+
}
|
167
|
+
};
|
168
|
+
|
169
|
+
return PluralRules;
|
170
|
+
|
171
|
+
})();
|
172
|
+
|
173
|
+
TwitterCldr.TimespanFormatter = (function() {
|
174
|
+
function TimespanFormatter() {
|
175
|
+
this.approximate_multiplier = 0.75;
|
176
|
+
this.default_type = "default";
|
177
|
+
this.patterns = {"ago":{"second":{"default":{"one":"Hace {0} segundo","other":"Hace {0} segundos"}},"minute":{"default":{"one":"Hace {0} minuto","other":"Hace {0} minutos"}},"hour":{"default":{"one":"Hace {0} hora","other":"Hace {0} horas"}},"day":{"default":{"one":"Hace {0} día","other":"Hace {0} días"}},"week":{"default":{"one":"Hace {0} semana","other":"Hace {0} semanas"}},"month":{"default":{"one":"Hace {0} mes","other":"Hace {0} meses"}},"year":{"default":{"one":"Hace {0} año","other":"Hace {0} años"}}},"until":{"second":{"default":{"one":"En {0} segundo","other":"En {0} segundos"}},"minute":{"default":{"one":"En {0} minuto","other":"En {0} minutos"}},"hour":{"default":{"one":"En {0} hora","other":"En {0} horas"}},"day":{"default":{"one":"En {0} día","other":"En {0} días"}},"week":{"default":{"one":"En {0} semana","other":"En {0} semanas"}},"month":{"default":{"one":"En {0} mes","other":"En {0} meses"}},"year":{"default":{"one":"En {0} año","other":"En {0} años"}}},"none":{"second":{"default":{"one":"{0} segundo","other":"{0} segundos"},"short":{"one":"{0} s","other":"{0} s"}},"minute":{"default":{"one":"{0} minuto","other":"{0} minutos"},"short":{"one":"{0} min","other":"{0} min"}},"hour":{"default":{"one":"{0} hora","other":"{0} horas"},"short":{"one":"{0} h","other":"{0} h"}},"day":{"default":{"one":"{0} día","other":"{0} días"},"short":{"one":"{0} día","other":"{0} días"}},"week":{"default":{"one":"{0} semana","other":"{0} semanas"},"short":{"one":"{0} semana","other":"{0} semanas"}},"month":{"default":{"one":"{0} mes","other":"{0} meses"},"short":{"one":"{0} mes","other":"{0} meses"}},"year":{"default":{"one":"{0} año","other":"{0} años"},"short":{"one":"{0} año","other":"{0} años"}}}};
|
178
|
+
this.time_in_seconds = {
|
179
|
+
"second": 1,
|
180
|
+
"minute": 60,
|
181
|
+
"hour": 3600,
|
182
|
+
"day": 86400,
|
183
|
+
"week": 604800,
|
184
|
+
"month": 2629743.83,
|
185
|
+
"year": 31556926
|
186
|
+
};
|
187
|
+
}
|
188
|
+
|
189
|
+
TimespanFormatter.prototype.format = function(seconds, fmt_options) {
|
190
|
+
var key, number, obj, options;
|
191
|
+
if (fmt_options == null) {
|
192
|
+
fmt_options = {};
|
193
|
+
}
|
194
|
+
options = {};
|
195
|
+
for (key in fmt_options) {
|
196
|
+
obj = fmt_options[key];
|
197
|
+
options[key] = obj;
|
198
|
+
}
|
199
|
+
options["direction"] || (options["direction"] = (seconds < 0 ? "ago" : "until"));
|
200
|
+
if (options["unit"] === null || options["unit"] === void 0) {
|
201
|
+
options["unit"] = this.calculate_unit(Math.abs(seconds), options);
|
202
|
+
}
|
203
|
+
options["type"] || (options["type"] = this.default_type);
|
204
|
+
options["number"] = this.calculate_time(Math.abs(seconds), options["unit"]);
|
205
|
+
number = this.calculate_time(Math.abs(seconds), options["unit"]);
|
206
|
+
options["rule"] = TwitterCldr.PluralRules.rule_for(number);
|
207
|
+
return this.patterns[options["direction"]][options["unit"]][options["type"]][options["rule"]].replace(/\{[0-9]\}/, number.toString());
|
208
|
+
};
|
209
|
+
|
210
|
+
TimespanFormatter.prototype.calculate_unit = function(seconds, unit_options) {
|
211
|
+
var key, multiplier, obj, options;
|
212
|
+
if (unit_options == null) {
|
213
|
+
unit_options = {};
|
214
|
+
}
|
215
|
+
options = {};
|
216
|
+
for (key in unit_options) {
|
217
|
+
obj = unit_options[key];
|
218
|
+
options[key] = obj;
|
219
|
+
}
|
220
|
+
if (options.approximate == null) {
|
221
|
+
options["approximate"] = false;
|
222
|
+
}
|
223
|
+
multiplier = options.approximate ? this.approximate_multiplier : 1;
|
224
|
+
if (seconds < (this.time_in_seconds.minute * multiplier)) {
|
225
|
+
return "second";
|
226
|
+
} else if (seconds < (this.time_in_seconds.hour * multiplier)) {
|
227
|
+
return "minute";
|
228
|
+
} else if (seconds < (this.time_in_seconds.day * multiplier)) {
|
229
|
+
return "hour";
|
230
|
+
} else if (seconds < (this.time_in_seconds.week * multiplier)) {
|
231
|
+
return "day";
|
232
|
+
} else if (seconds < (this.time_in_seconds.month * multiplier)) {
|
233
|
+
return "week";
|
234
|
+
} else if (seconds < (this.time_in_seconds.year * multiplier)) {
|
235
|
+
return "month";
|
236
|
+
} else {
|
237
|
+
return "year";
|
238
|
+
}
|
239
|
+
};
|
240
|
+
|
241
|
+
TimespanFormatter.prototype.calculate_time = function(seconds, unit) {
|
242
|
+
return Math.round(seconds / this.time_in_seconds[unit]);
|
243
|
+
};
|
244
|
+
|
245
|
+
return TimespanFormatter;
|
246
|
+
|
247
|
+
})();
|
248
|
+
|
249
|
+
TwitterCldr.DateTimeFormatter = (function() {
|
250
|
+
function DateTimeFormatter() {
|
251
|
+
this.tokens = {"date_time":{"default":[{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"full":[{"value":"EEEE","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":",","type":"plaintext"},{"value":" ","type":"plaintext"},{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" (","type":"plaintext"},{"value":"zzzz","type":"pattern"},{"value":")","type":"plaintext"}],"long":[{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":",","type":"plaintext"},{"value":" ","type":"plaintext"},{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"z","type":"pattern"}],"medium":[{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"short":[{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"yy","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"}],"additional":{"EHm":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"}],"EHms":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"Ed":[{"value":"E","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"Ehm":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"Ehms":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"Gy":[{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"G","type":"pattern"}],"GyMMM":[{"value":"MMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"G","type":"pattern"}],"GyMMMEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"G","type":"pattern"}],"GyMMMd":[{"value":"d","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"G","type":"pattern"}],"H":[{"value":"H","type":"pattern"}],"Hm":[{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"}],"Hms":[{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"M":[{"value":"L","type":"pattern"}],"MEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"}],"MMM":[{"value":"LLL","type":"pattern"}],"MMMEd":[{"value":"E","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMM","type":"pattern"}],"MMMMd":[{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMMM","type":"pattern"}],"MMMd":[{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMM","type":"pattern"}],"MMMdd":[{"value":"dd","type":"pattern"},{"value":"-","type":"plaintext"},{"value":"MMM","type":"pattern"}],"MMd":[{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"}],"MMdd":[{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"}],"Md":[{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"}],"d":[{"value":"d","type":"pattern"}],"h":[{"value":"h","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"hm":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"hms":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"ms":[{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"y":[{"value":"y","type":"pattern"}],"yM":[{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yMEd":[{"value":"E","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yMM":[{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMM":[{"value":"MMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMEd":[{"value":"EEE","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMM":[{"value":"MMMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMd":[{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMd":[{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yQQQ":[{"value":"QQQ","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yQQQQ":[{"value":"QQQQ","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"}]}},"time":{"default":[{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"full":[{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" (","type":"plaintext"},{"value":"zzzz","type":"pattern"},{"value":")","type":"plaintext"}],"long":[{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"z","type":"pattern"}],"medium":[{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"short":[{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"}],"additional":{"EHm":[{"value":"E, ","type":"plaintext"},{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"}],"EHms":[{"value":"E, ","type":"plaintext"},{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"Ed":[{"value":"E d","type":"plaintext"}],"Ehm":[{"value":"E, ","type":"plaintext"},{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"Ehms":[{"value":"E, ","type":"plaintext"},{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"Gy":[{"value":"y G","type":"plaintext"}],"GyMMM":[{"value":"MMM ","type":"plaintext"},{"value":"'de'","type":"plaintext"},{"value":" y G","type":"plaintext"}],"GyMMMEd":[{"value":"E, d ","type":"plaintext"},{"value":"'de'","type":"plaintext"},{"value":" MMMM ","type":"plaintext"},{"value":"'de'","type":"plaintext"},{"value":" y G","type":"plaintext"}],"GyMMMd":[{"value":"d MMM ","type":"plaintext"},{"value":"'de'","type":"plaintext"},{"value":" y G","type":"plaintext"}],"H":[{"value":"H","type":"pattern"}],"Hm":[{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"}],"Hms":[{"value":"H","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"M":[{"value":"L","type":"plaintext"}],"MEd":[{"value":"E, d/M","type":"plaintext"}],"MMM":[{"value":"LLL","type":"plaintext"}],"MMMEd":[{"value":"E d ","type":"plaintext"},{"value":"'de'","type":"plaintext"},{"value":" MMM","type":"plaintext"}],"MMMMd":[{"value":"d ","type":"plaintext"},{"value":"'de'","type":"plaintext"},{"value":" MMMM","type":"plaintext"}],"MMMd":[{"value":"d ","type":"plaintext"},{"value":"'de'","type":"plaintext"},{"value":" MMM","type":"plaintext"}],"MMMdd":[{"value":"dd-MMM","type":"plaintext"}],"MMd":[{"value":"d/M","type":"plaintext"}],"MMdd":[{"value":"d/M","type":"plaintext"}],"Md":[{"value":"d/M","type":"plaintext"}],"d":[{"value":"d","type":"plaintext"}],"h":[{"value":"h","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"hm":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"hms":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"ms":[{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"y":[{"value":"y","type":"plaintext"}],"yM":[{"value":"M/y","type":"plaintext"}],"yMEd":[{"value":"E d/M/y","type":"plaintext"}],"yMM":[{"value":"M/y","type":"plaintext"}],"yMMM":[{"value":"MMM ","type":"plaintext"},{"value":"'de'","type":"plaintext"},{"value":" y","type":"plaintext"}],"yMMMEd":[{"value":"EEE, d ","type":"plaintext"},{"value":"'de'","type":"plaintext"},{"value":" MMMM ","type":"plaintext"},{"value":"'de'","type":"plaintext"},{"value":" y","type":"plaintext"}],"yMMMM":[{"value":"MMMM ","type":"plaintext"},{"value":"'de'","type":"plaintext"},{"value":" y","type":"plaintext"}],"yMMMd":[{"value":"d ","type":"plaintext"},{"value":"'de'","type":"plaintext"},{"value":" MMM ","type":"plaintext"},{"value":"'de'","type":"plaintext"},{"value":" y","type":"plaintext"}],"yMd":[{"value":"d/M/y","type":"plaintext"}],"yQQQ":[{"value":"QQQ y","type":"plaintext"}],"yQQQQ":[{"value":"QQQQ ","type":"plaintext"},{"value":"'de'","type":"plaintext"},{"value":" y","type":"plaintext"}]}},"date":{"default":[{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"full":[{"value":"EEEE","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"}],"long":[{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"}],"medium":[{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"short":[{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"yy","type":"pattern"}],"additional":{"EHm":[{"value":"E","type":"pattern"},{"value":", H:mm","type":"plaintext"}],"EHms":[{"value":"E","type":"pattern"},{"value":", H:mm:ss","type":"plaintext"}],"Ed":[{"value":"E","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"Ehm":[{"value":"E","type":"pattern"},{"value":", h:mm a","type":"plaintext"}],"Ehms":[{"value":"E","type":"pattern"},{"value":", h:mm:ss a","type":"plaintext"}],"Gy":[{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"G","type":"pattern"}],"GyMMM":[{"value":"MMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"G","type":"pattern"}],"GyMMMEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"G","type":"pattern"}],"GyMMMd":[{"value":"d","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"G","type":"pattern"}],"H":[{"value":"H","type":"plaintext"}],"Hm":[{"value":"H:mm","type":"plaintext"}],"Hms":[{"value":"H:mm:ss","type":"plaintext"}],"M":[{"value":"L","type":"pattern"}],"MEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"}],"MMM":[{"value":"LLL","type":"pattern"}],"MMMEd":[{"value":"E","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMM","type":"pattern"}],"MMMMd":[{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMMM","type":"pattern"}],"MMMd":[{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMM","type":"pattern"}],"MMMdd":[{"value":"dd","type":"pattern"},{"value":"-","type":"plaintext"},{"value":"MMM","type":"pattern"}],"MMd":[{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"}],"MMdd":[{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"}],"Md":[{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"}],"d":[{"value":"d","type":"pattern"}],"h":[{"value":"h a","type":"plaintext"}],"hm":[{"value":"h:mm a","type":"plaintext"}],"hms":[{"value":"h:mm:ss a","type":"plaintext"}],"ms":[{"value":"mm:ss","type":"plaintext"}],"y":[{"value":"y","type":"pattern"}],"yM":[{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yMEd":[{"value":"E","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yMM":[{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMM":[{"value":"MMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMEd":[{"value":"EEE","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMM":[{"value":"MMMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMd":[{"value":"d","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMd":[{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yQQQ":[{"value":"QQQ","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yQQQQ":[{"value":"QQQQ","type":"pattern"},{"value":" 'de' ","type":"plaintext"},{"value":"y","type":"pattern"}]}}};
|
252
|
+
this.weekday_keys = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
|
253
|
+
this.methods = {
|
254
|
+
'G': 'era',
|
255
|
+
'y': 'year',
|
256
|
+
'Y': 'year_of_week_of_year',
|
257
|
+
'Q': 'quarter',
|
258
|
+
'q': 'quarter_stand_alone',
|
259
|
+
'M': 'month',
|
260
|
+
'L': 'month_stand_alone',
|
261
|
+
'w': 'week_of_year',
|
262
|
+
'W': 'week_of_month',
|
263
|
+
'd': 'day',
|
264
|
+
'D': 'day_of_month',
|
265
|
+
'F': 'day_of_week_in_month',
|
266
|
+
'E': 'weekday',
|
267
|
+
'e': 'weekday_local',
|
268
|
+
'c': 'weekday_local_stand_alone',
|
269
|
+
'a': 'period',
|
270
|
+
'h': 'hour',
|
271
|
+
'H': 'hour',
|
272
|
+
'K': 'hour',
|
273
|
+
'k': 'hour',
|
274
|
+
'm': 'minute',
|
275
|
+
's': 'second',
|
276
|
+
'S': 'second_fraction',
|
277
|
+
'z': 'timezone',
|
278
|
+
'Z': 'timezone',
|
279
|
+
'v': 'timezone_generic_non_location',
|
280
|
+
'V': 'timezone_metazone'
|
281
|
+
};
|
282
|
+
}
|
283
|
+
|
284
|
+
DateTimeFormatter.prototype.format = function(obj, options) {
|
285
|
+
var format_token, token, tokens;
|
286
|
+
format_token = (function(_this) {
|
287
|
+
return function(token) {
|
288
|
+
var result;
|
289
|
+
result = "";
|
290
|
+
switch (token.type) {
|
291
|
+
case "pattern":
|
292
|
+
return _this.result_for_token(token, obj);
|
293
|
+
default:
|
294
|
+
if (token.value.length > 0 && token.value[0] === "'" && token.value[token.value.length - 1] === "'") {
|
295
|
+
return token.value.substring(1, token.value.length - 1);
|
296
|
+
} else {
|
297
|
+
return token.value;
|
298
|
+
}
|
299
|
+
}
|
300
|
+
};
|
301
|
+
})(this);
|
302
|
+
tokens = this.get_tokens(obj, options);
|
303
|
+
return ((function() {
|
304
|
+
var _i, _len, _results;
|
305
|
+
_results = [];
|
306
|
+
for (_i = 0, _len = tokens.length; _i < _len; _i++) {
|
307
|
+
token = tokens[_i];
|
308
|
+
_results.push(format_token(token));
|
309
|
+
}
|
310
|
+
return _results;
|
311
|
+
})()).join("");
|
312
|
+
};
|
313
|
+
|
314
|
+
DateTimeFormatter.prototype.get_tokens = function(obj, options) {
|
315
|
+
var format, type;
|
316
|
+
format = options.format || "date_time";
|
317
|
+
type = options.type || "default";
|
318
|
+
if (format === "additional") {
|
319
|
+
return this.tokens["date_time"][format][this.additional_format_selector().find_closest(options.type)];
|
320
|
+
} else {
|
321
|
+
return this.tokens[format][type];
|
322
|
+
}
|
323
|
+
};
|
324
|
+
|
325
|
+
DateTimeFormatter.prototype.result_for_token = function(token, date) {
|
326
|
+
return this[this.methods[token.value[0]]](date, token.value, token.value.length);
|
327
|
+
};
|
328
|
+
|
329
|
+
DateTimeFormatter.prototype.additional_format_selector = function() {
|
330
|
+
return new TwitterCldr.AdditionalDateFormatSelector(this.tokens["date_time"]["additional"]);
|
331
|
+
};
|
332
|
+
|
333
|
+
DateTimeFormatter.additional_formats = function() {
|
334
|
+
return new TwitterCldr.DateTimeFormatter().additional_format_selector().patterns();
|
335
|
+
};
|
336
|
+
|
337
|
+
DateTimeFormatter.prototype.era = function(date, pattern, length) {
|
338
|
+
var choices, index, result;
|
339
|
+
switch (length) {
|
340
|
+
case 0:
|
341
|
+
choices = ["", ""];
|
342
|
+
break;
|
343
|
+
case 1:
|
344
|
+
case 2:
|
345
|
+
case 3:
|
346
|
+
choices = TwitterCldr.Calendar.calendar["eras"]["abbr"];
|
347
|
+
break;
|
348
|
+
default:
|
349
|
+
choices = TwitterCldr.Calendar.calendar["eras"]["name"];
|
350
|
+
}
|
351
|
+
index = date.getFullYear() < 0 ? 0 : 1;
|
352
|
+
result = choices[index];
|
353
|
+
if (result != null) {
|
354
|
+
return result;
|
355
|
+
} else {
|
356
|
+
return this.era(date, pattern.slice(0, -1), length - 1);
|
357
|
+
}
|
358
|
+
};
|
359
|
+
|
360
|
+
DateTimeFormatter.prototype.year = function(date, pattern, length) {
|
361
|
+
var year;
|
362
|
+
year = date.getFullYear().toString();
|
363
|
+
if (length === 2) {
|
364
|
+
if (year.length !== 1) {
|
365
|
+
year = year.slice(-2);
|
366
|
+
}
|
367
|
+
}
|
368
|
+
if (length > 1) {
|
369
|
+
year = ("0000" + year).slice(-length);
|
370
|
+
}
|
371
|
+
return year;
|
372
|
+
};
|
373
|
+
|
374
|
+
DateTimeFormatter.prototype.year_of_week_of_year = function(date, pattern, length) {
|
375
|
+
throw 'not implemented';
|
376
|
+
};
|
377
|
+
|
378
|
+
DateTimeFormatter.prototype.day_of_week_in_month = function(date, pattern, length) {
|
379
|
+
throw 'not implemented';
|
380
|
+
};
|
381
|
+
|
382
|
+
DateTimeFormatter.prototype.quarter = function(date, pattern, length) {
|
383
|
+
var quarter;
|
384
|
+
quarter = ((date.getMonth() / 3) | 0) + 1;
|
385
|
+
switch (length) {
|
386
|
+
case 1:
|
387
|
+
return quarter.toString();
|
388
|
+
case 2:
|
389
|
+
return ("0000" + quarter.toString()).slice(-length);
|
390
|
+
case 3:
|
391
|
+
return TwitterCldr.Calendar.calendar.quarters.format.abbreviated[quarter];
|
392
|
+
case 4:
|
393
|
+
return TwitterCldr.Calendar.calendar.quarters.format.wide[quarter];
|
394
|
+
}
|
395
|
+
};
|
396
|
+
|
397
|
+
DateTimeFormatter.prototype.quarter_stand_alone = function(date, pattern, length) {
|
398
|
+
var quarter;
|
399
|
+
quarter = (date.getMonth() - 1) / 3 + 1;
|
400
|
+
switch (length) {
|
401
|
+
case 1:
|
402
|
+
return quarter.toString();
|
403
|
+
case 2:
|
404
|
+
return ("0000" + quarter.toString()).slice(-length);
|
405
|
+
case 3:
|
406
|
+
throw 'not yet implemented (requires cldr\'s "multiple inheritance")';
|
407
|
+
break;
|
408
|
+
case 4:
|
409
|
+
throw 'not yet implemented (requires cldr\'s "multiple inheritance")';
|
410
|
+
break;
|
411
|
+
case 5:
|
412
|
+
return TwitterCldr.Calendar.calendar.quarters['stand-alone'].narrow[quarter];
|
413
|
+
}
|
414
|
+
};
|
415
|
+
|
416
|
+
DateTimeFormatter.prototype.month = function(date, pattern, length) {
|
417
|
+
var month_str;
|
418
|
+
month_str = (date.getMonth() + 1).toString();
|
419
|
+
switch (length) {
|
420
|
+
case 1:
|
421
|
+
return month_str;
|
422
|
+
case 2:
|
423
|
+
return ("0000" + month_str).slice(-length);
|
424
|
+
case 3:
|
425
|
+
return TwitterCldr.Calendar.calendar.months.format.abbreviated[month_str];
|
426
|
+
case 4:
|
427
|
+
return TwitterCldr.Calendar.calendar.months.format.wide[month_str];
|
428
|
+
case 5:
|
429
|
+
throw 'not yet implemented (requires cldr\'s "multiple inheritance")';
|
430
|
+
break;
|
431
|
+
default:
|
432
|
+
throw "Unknown date format";
|
433
|
+
}
|
434
|
+
};
|
435
|
+
|
436
|
+
DateTimeFormatter.prototype.month_stand_alone = function(date, pattern, length) {
|
437
|
+
var month_str;
|
438
|
+
month_str = (date.getMonth() + 1).toString();
|
439
|
+
switch (length) {
|
440
|
+
case 1:
|
441
|
+
return month_str;
|
442
|
+
case 2:
|
443
|
+
return ("0000" + month_str).slice(-length);
|
444
|
+
case 3:
|
445
|
+
return TwitterCldr.Calendar.calendar.months['stand-alone'].abbreviated[month_str];
|
446
|
+
case 4:
|
447
|
+
return TwitterCldr.Calendar.calendar.months['stand-alone'].wide[month_str];
|
448
|
+
case 5:
|
449
|
+
return TwitterCldr.Calendar.calendar.months['stand-alone'].narrow[month_str];
|
450
|
+
default:
|
451
|
+
throw "Unknown date format";
|
452
|
+
}
|
453
|
+
};
|
454
|
+
|
455
|
+
DateTimeFormatter.prototype.day = function(date, pattern, length) {
|
456
|
+
switch (length) {
|
457
|
+
case 1:
|
458
|
+
return date.getDate().toString();
|
459
|
+
case 2:
|
460
|
+
return ("0000" + date.getDate().toString()).slice(-length);
|
461
|
+
}
|
462
|
+
};
|
463
|
+
|
464
|
+
DateTimeFormatter.prototype.weekday = function(date, pattern, length) {
|
465
|
+
var key;
|
466
|
+
key = this.weekday_keys[date.getDay()];
|
467
|
+
switch (length) {
|
468
|
+
case 1:
|
469
|
+
case 2:
|
470
|
+
case 3:
|
471
|
+
return TwitterCldr.Calendar.calendar.days.format.abbreviated[key];
|
472
|
+
case 4:
|
473
|
+
return TwitterCldr.Calendar.calendar.days.format.wide[key];
|
474
|
+
case 5:
|
475
|
+
return TwitterCldr.Calendar.calendar.days['stand-alone'].narrow[key];
|
476
|
+
}
|
477
|
+
};
|
478
|
+
|
479
|
+
DateTimeFormatter.prototype.weekday_local = function(date, pattern, length) {
|
480
|
+
var day;
|
481
|
+
switch (length) {
|
482
|
+
case 1:
|
483
|
+
case 2:
|
484
|
+
day = date.getDay();
|
485
|
+
if (day === 0) {
|
486
|
+
return "7";
|
487
|
+
} else {
|
488
|
+
return day.toString();
|
489
|
+
}
|
490
|
+
break;
|
491
|
+
default:
|
492
|
+
return this.weekday(date, pattern, length);
|
493
|
+
}
|
494
|
+
};
|
495
|
+
|
496
|
+
DateTimeFormatter.prototype.weekday_local_stand_alone = function(date, pattern, length) {
|
497
|
+
switch (length) {
|
498
|
+
case 1:
|
499
|
+
return this.weekday_local(date, pattern, length);
|
500
|
+
default:
|
501
|
+
return this.weekday(date, pattern, length);
|
502
|
+
}
|
503
|
+
};
|
504
|
+
|
505
|
+
DateTimeFormatter.prototype.period = function(time, pattern, length) {
|
506
|
+
if (time.getHours() > 11) {
|
507
|
+
return TwitterCldr.Calendar.calendar.periods.format.wide["pm"];
|
508
|
+
} else {
|
509
|
+
return TwitterCldr.Calendar.calendar.periods.format.wide["am"];
|
510
|
+
}
|
511
|
+
};
|
512
|
+
|
513
|
+
DateTimeFormatter.prototype.hour = function(time, pattern, length) {
|
514
|
+
var hour;
|
515
|
+
hour = time.getHours();
|
516
|
+
switch (pattern[0]) {
|
517
|
+
case 'h':
|
518
|
+
if (hour > 12) {
|
519
|
+
hour = hour - 12;
|
520
|
+
} else if (hour === 0) {
|
521
|
+
hour = 12;
|
522
|
+
}
|
523
|
+
break;
|
524
|
+
case 'K':
|
525
|
+
if (hour > 11) {
|
526
|
+
hour = hour - 12;
|
527
|
+
}
|
528
|
+
break;
|
529
|
+
case 'k':
|
530
|
+
if (hour === 0) {
|
531
|
+
hour = 24;
|
532
|
+
}
|
533
|
+
}
|
534
|
+
if (length === 1) {
|
535
|
+
return hour.toString();
|
536
|
+
} else {
|
537
|
+
return ("000000" + hour.toString()).slice(-length);
|
538
|
+
}
|
539
|
+
};
|
540
|
+
|
541
|
+
DateTimeFormatter.prototype.minute = function(time, pattern, length) {
|
542
|
+
if (length === 1) {
|
543
|
+
return time.getMinutes().toString();
|
544
|
+
} else {
|
545
|
+
return ("000000" + time.getMinutes().toString()).slice(-length);
|
546
|
+
}
|
547
|
+
};
|
548
|
+
|
549
|
+
DateTimeFormatter.prototype.second = function(time, pattern, length) {
|
550
|
+
if (length === 1) {
|
551
|
+
return time.getSeconds().toString();
|
552
|
+
} else {
|
553
|
+
return ("000000" + time.getSeconds().toString()).slice(-length);
|
554
|
+
}
|
555
|
+
};
|
556
|
+
|
557
|
+
DateTimeFormatter.prototype.second_fraction = function(time, pattern, length) {
|
558
|
+
if (length > 6) {
|
559
|
+
throw 'can not use the S format with more than 6 digits';
|
560
|
+
}
|
561
|
+
return ("000000" + Math.round(Math.pow(time.getMilliseconds() * 100.0, 6 - length)).toString()).slice(-length);
|
562
|
+
};
|
563
|
+
|
564
|
+
DateTimeFormatter.prototype.timezone = function(time, pattern, length) {
|
565
|
+
var hours, minutes, offset, offsetString, sign;
|
566
|
+
offset = time.getTimezoneOffset();
|
567
|
+
hours = ("00" + (Math.floor(Math.abs(offset) / 60)).toString()).slice(-2);
|
568
|
+
minutes = ("00" + (Math.abs(offset) % 60).toString()).slice(-2);
|
569
|
+
sign = offset > 0 ? "-" : "+";
|
570
|
+
offsetString = sign + hours + ":" + minutes;
|
571
|
+
switch (length) {
|
572
|
+
case 1:
|
573
|
+
case 2:
|
574
|
+
case 3:
|
575
|
+
return offsetString;
|
576
|
+
default:
|
577
|
+
return "UTC" + offsetString;
|
578
|
+
}
|
579
|
+
};
|
580
|
+
|
581
|
+
DateTimeFormatter.prototype.timezone_generic_non_location = function(time, pattern, length) {
|
582
|
+
throw 'not yet implemented (requires timezone translation data")';
|
583
|
+
};
|
584
|
+
|
585
|
+
return DateTimeFormatter;
|
586
|
+
|
587
|
+
})();
|
588
|
+
|
589
|
+
TwitterCldr.AdditionalDateFormatSelector = (function() {
|
590
|
+
function AdditionalDateFormatSelector(pattern_hash) {
|
591
|
+
this.pattern_hash = pattern_hash;
|
592
|
+
}
|
593
|
+
|
594
|
+
AdditionalDateFormatSelector.prototype.find_closest = function(goal_pattern) {
|
595
|
+
var key, min_key, min_rank, rank, ranks;
|
596
|
+
if ((goal_pattern == null) || goal_pattern.replace(/^\s+|\s+$/g, "").length === 0) {
|
597
|
+
return null;
|
598
|
+
} else {
|
599
|
+
ranks = this.rank(goal_pattern);
|
600
|
+
min_rank = 100;
|
601
|
+
min_key = null;
|
602
|
+
for (key in ranks) {
|
603
|
+
rank = ranks[key];
|
604
|
+
if (rank < min_rank) {
|
605
|
+
min_rank = rank;
|
606
|
+
min_key = key;
|
607
|
+
}
|
608
|
+
}
|
609
|
+
return min_key;
|
610
|
+
}
|
611
|
+
};
|
612
|
+
|
613
|
+
AdditionalDateFormatSelector.prototype.patterns = function() {
|
614
|
+
var key, _results;
|
615
|
+
_results = [];
|
616
|
+
for (key in this.pattern_hash) {
|
617
|
+
_results.push(key);
|
618
|
+
}
|
619
|
+
return _results;
|
620
|
+
};
|
621
|
+
|
622
|
+
AdditionalDateFormatSelector.prototype.separate = function(pattern_key) {
|
623
|
+
var cur_char, last_char, result, _i, _len;
|
624
|
+
last_char = "";
|
625
|
+
result = [];
|
626
|
+
for (_i = 0, _len = pattern_key.length; _i < _len; _i++) {
|
627
|
+
cur_char = pattern_key[_i];
|
628
|
+
if (cur_char === last_char) {
|
629
|
+
result[result.length - 1] += cur_char;
|
630
|
+
} else {
|
631
|
+
result.push(cur_char);
|
632
|
+
}
|
633
|
+
last_char = cur_char;
|
634
|
+
}
|
635
|
+
return result;
|
636
|
+
};
|
637
|
+
|
638
|
+
AdditionalDateFormatSelector.prototype.all_separated_patterns = function() {
|
639
|
+
var key, _results;
|
640
|
+
_results = [];
|
641
|
+
for (key in this.pattern_hash) {
|
642
|
+
_results.push(this.separate(key));
|
643
|
+
}
|
644
|
+
return _results;
|
645
|
+
};
|
646
|
+
|
647
|
+
AdditionalDateFormatSelector.prototype.score = function(entities, goal_entities) {
|
648
|
+
var score;
|
649
|
+
score = this.exist_score(entities, goal_entities) * 2;
|
650
|
+
score += this.position_score(entities, goal_entities);
|
651
|
+
return score + this.count_score(entities, goal_entities);
|
652
|
+
};
|
653
|
+
|
654
|
+
AdditionalDateFormatSelector.prototype.position_score = function(entities, goal_entities) {
|
655
|
+
var found, goal_entity, index, sum;
|
656
|
+
sum = 0;
|
657
|
+
for (index in goal_entities) {
|
658
|
+
goal_entity = goal_entities[index];
|
659
|
+
found = entities.indexOf(goal_entity);
|
660
|
+
if (found > -1) {
|
661
|
+
sum += Math.abs(found - index);
|
662
|
+
}
|
663
|
+
}
|
664
|
+
return sum;
|
665
|
+
};
|
666
|
+
|
667
|
+
AdditionalDateFormatSelector.prototype.exist_score = function(entities, goal_entities) {
|
668
|
+
var count, entity, goal_entity, _i, _len;
|
669
|
+
count = 0;
|
670
|
+
for (_i = 0, _len = goal_entities.length; _i < _len; _i++) {
|
671
|
+
goal_entity = goal_entities[_i];
|
672
|
+
if (!(((function() {
|
673
|
+
var _j, _len1, _results;
|
674
|
+
_results = [];
|
675
|
+
for (_j = 0, _len1 = entities.length; _j < _len1; _j++) {
|
676
|
+
entity = entities[_j];
|
677
|
+
if (entity[0] === goal_entity[0]) {
|
678
|
+
_results.push(entity);
|
679
|
+
}
|
680
|
+
}
|
681
|
+
return _results;
|
682
|
+
})()).length > 0)) {
|
683
|
+
count += 1;
|
684
|
+
}
|
685
|
+
}
|
686
|
+
return count;
|
687
|
+
};
|
688
|
+
|
689
|
+
AdditionalDateFormatSelector.prototype.count_score = function(entities, goal_entities) {
|
690
|
+
var entity, found_entity, goal_entity, sum, _i, _len;
|
691
|
+
sum = 0;
|
692
|
+
for (_i = 0, _len = goal_entities.length; _i < _len; _i++) {
|
693
|
+
goal_entity = goal_entities[_i];
|
694
|
+
found_entity = ((function() {
|
695
|
+
var _j, _len1, _results;
|
696
|
+
_results = [];
|
697
|
+
for (_j = 0, _len1 = entities.length; _j < _len1; _j++) {
|
698
|
+
entity = entities[_j];
|
699
|
+
if (entity[0] === goal_entity[0]) {
|
700
|
+
_results.push(entity);
|
701
|
+
}
|
702
|
+
}
|
703
|
+
return _results;
|
704
|
+
})())[0];
|
705
|
+
if (found_entity != null) {
|
706
|
+
sum += Math.abs(found_entity.length - goal_entity.length);
|
707
|
+
}
|
708
|
+
}
|
709
|
+
return sum;
|
710
|
+
};
|
711
|
+
|
712
|
+
AdditionalDateFormatSelector.prototype.rank = function(goal_pattern) {
|
713
|
+
var result, separated_goal_pattern, separated_pattern, _i, _len, _ref;
|
714
|
+
separated_goal_pattern = this.separate(goal_pattern);
|
715
|
+
result = {};
|
716
|
+
_ref = this.all_separated_patterns();
|
717
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
718
|
+
separated_pattern = _ref[_i];
|
719
|
+
result[separated_pattern.join("")] = this.score(separated_pattern, separated_goal_pattern);
|
720
|
+
}
|
721
|
+
return result;
|
722
|
+
};
|
723
|
+
|
724
|
+
return AdditionalDateFormatSelector;
|
725
|
+
|
726
|
+
})();
|
727
|
+
|
728
|
+
TwitterCldr.NumberFormatter = (function() {
|
729
|
+
function NumberFormatter() {
|
730
|
+
this.all_tokens = {"default":{"positive":["","#,##0.###"],"negative":["-","#,##0.###"]},"decimal":{"positive":["","#,##0.###"],"negative":["-","#,##0.###"]},"long_decimal":{"positive":{"1000":["","0"," mil"],"10000":["","00"," mil"],"100000":["","000"," mil"],"1000000":["","0"," millones"],"10000000":["","00"," millones"],"100000000":["","000"," millones"],"1000000000":["","0"," mil millones"],"10000000000":["","00"," mil millones"],"100000000000":["","000"," mil millones"],"1000000000000":["","0"," billones"],"10000000000000":["","00"," billones"],"100000000000000":["","000"," billones"]},"negative":{"1000":["-","0"," mil"],"10000":["-","00"," mil"],"100000":["-","000"," mil"],"1000000":["-","0"," millones"],"10000000":["-","00"," millones"],"100000000":["-","000"," millones"],"1000000000":["-","0"," mil millones"],"10000000000":["-","00"," mil millones"],"100000000000":["-","000"," mil millones"],"1000000000000":["-","0"," billones"],"10000000000000":["-","00"," billones"],"100000000000000":["-","000"," billones"]}},"short_decimal":{"positive":{"10000":["","00","k"],"100000":["","000","k"],"1000000":["","0"," M"],"10000000":["","00"," M"],"100000000":["","000"," M"],"1000000000":["","0","k M"],"10000000000":["","00","k M"],"100000000000":["","000","k M"],"1000000000000":["","0"," B"],"10000000000000":["","00"," B"],"100000000000000":["","000"," B"]},"negative":{"10000":["-","00","k"],"100000":["-","000","k"],"1000000":["-","0"," M"],"10000000":["-","00"," M"],"100000000":["-","000"," M"],"1000000000":["-","0","k M"],"10000000000":["-","00","k M"],"100000000000":["-","000","k M"],"1000000000000":["-","0"," B"],"10000000000000":["-","00"," B"],"100000000000000":["-","000"," B"]}},"currency":{"positive":["¤","#,##0.00"],"negative":["-¤","#,##0.00"]},"percent":{"positive":["","#,##0","%"],"negative":["-","#,##0","%"]}};
|
731
|
+
this.tokens = [];
|
732
|
+
this.symbols = {"alias":"","decimal":".","exponential":"E","group":",","infinity":"∞","list":";","minus_sign":"-","nan":"NaN","per_mille":"‰","percent_sign":"%","plus_sign":"+","superscripting_exponent":"×"};
|
733
|
+
this.default_symbols = {
|
734
|
+
'group': ',',
|
735
|
+
'decimal': '.',
|
736
|
+
'plus_sign': '+',
|
737
|
+
'minus_sign': '-'
|
738
|
+
};
|
739
|
+
}
|
740
|
+
|
741
|
+
NumberFormatter.prototype.format = function(number, options) {
|
742
|
+
var fraction, fraction_format, integer_format, intg, key, opts, prefix, result, sign, suffix, tokens, val, _ref, _ref1;
|
743
|
+
if (options == null) {
|
744
|
+
options = {};
|
745
|
+
}
|
746
|
+
opts = this.default_format_options_for(number);
|
747
|
+
for (key in options) {
|
748
|
+
val = options[key];
|
749
|
+
opts[key] = options[key] != null ? options[key] : opts[key];
|
750
|
+
}
|
751
|
+
tokens = this.get_tokens(number, opts);
|
752
|
+
if (tokens != null) {
|
753
|
+
_ref = this.partition_tokens(tokens), prefix = _ref[0], suffix = _ref[1], integer_format = _ref[2], fraction_format = _ref[3];
|
754
|
+
number = this.truncate_number(number, integer_format);
|
755
|
+
_ref1 = this.parse_number(number, opts), intg = _ref1[0], fraction = _ref1[1];
|
756
|
+
result = integer_format.apply(parseFloat(intg), opts);
|
757
|
+
if (fraction) {
|
758
|
+
result += fraction_format.apply(fraction, opts);
|
759
|
+
}
|
760
|
+
sign = number < 0 && prefix !== "-" ? this.symbols.minus_sign || this.default_symbols.minus_sign : "";
|
761
|
+
return "" + prefix + result + suffix;
|
762
|
+
} else {
|
763
|
+
return number.toString();
|
764
|
+
}
|
765
|
+
};
|
766
|
+
|
767
|
+
NumberFormatter.prototype.truncate_number = function(number, integer_format) {
|
768
|
+
return number;
|
769
|
+
};
|
770
|
+
|
771
|
+
NumberFormatter.prototype.partition_tokens = function(tokens) {
|
772
|
+
return [tokens[0] || "", tokens[2] || "", new TwitterCldr.NumberFormatter.IntegerHelper(tokens[1], this.symbols), new TwitterCldr.NumberFormatter.FractionHelper(tokens[1], this.symbols)];
|
773
|
+
};
|
774
|
+
|
775
|
+
NumberFormatter.prototype.parse_number = function(number, options) {
|
776
|
+
var precision;
|
777
|
+
if (options == null) {
|
778
|
+
options = {};
|
779
|
+
}
|
780
|
+
if (options.precision != null) {
|
781
|
+
precision = options.precision;
|
782
|
+
} else {
|
783
|
+
precision = this.precision_from(number);
|
784
|
+
}
|
785
|
+
number = this.round_to(number, precision);
|
786
|
+
return Math.abs(number).toFixed(precision).split(".");
|
787
|
+
};
|
788
|
+
|
789
|
+
NumberFormatter.prototype.precision_from = function(num) {
|
790
|
+
var parts;
|
791
|
+
parts = num.toString().split(".");
|
792
|
+
if (parts.length === 2) {
|
793
|
+
return parts[1].length;
|
794
|
+
} else {
|
795
|
+
return 0;
|
796
|
+
}
|
797
|
+
};
|
798
|
+
|
799
|
+
NumberFormatter.prototype.round_to = function(number, precision) {
|
800
|
+
var factor;
|
801
|
+
factor = Math.pow(10, precision);
|
802
|
+
return Math.round(number * factor) / factor;
|
803
|
+
};
|
804
|
+
|
805
|
+
NumberFormatter.prototype.get_tokens = function() {
|
806
|
+
throw "get_tokens() not implemented - use a derived class like PercentFormatter.";
|
807
|
+
};
|
808
|
+
|
809
|
+
return NumberFormatter;
|
810
|
+
|
811
|
+
})();
|
812
|
+
|
813
|
+
TwitterCldr.PercentFormatter = (function(_super) {
|
814
|
+
__extends(PercentFormatter, _super);
|
815
|
+
|
816
|
+
function PercentFormatter(options) {
|
817
|
+
if (options == null) {
|
818
|
+
options = {};
|
819
|
+
}
|
820
|
+
this.default_percent_sign = "%";
|
821
|
+
PercentFormatter.__super__.constructor.apply(this, arguments);
|
822
|
+
}
|
823
|
+
|
824
|
+
PercentFormatter.prototype.format = function(number, options) {
|
825
|
+
if (options == null) {
|
826
|
+
options = {};
|
827
|
+
}
|
828
|
+
return PercentFormatter.__super__.format.call(this, number, options).replace('¤', this.symbols.percent_sign || this.default_percent_sign);
|
829
|
+
};
|
830
|
+
|
831
|
+
PercentFormatter.prototype.default_format_options_for = function(number) {
|
832
|
+
return {
|
833
|
+
precision: 0
|
834
|
+
};
|
835
|
+
};
|
836
|
+
|
837
|
+
PercentFormatter.prototype.get_tokens = function(number, options) {
|
838
|
+
if (number < 0) {
|
839
|
+
return this.all_tokens.percent.negative;
|
840
|
+
} else {
|
841
|
+
return this.all_tokens.percent.positive;
|
842
|
+
}
|
843
|
+
};
|
844
|
+
|
845
|
+
return PercentFormatter;
|
846
|
+
|
847
|
+
})(TwitterCldr.NumberFormatter);
|
848
|
+
|
849
|
+
TwitterCldr.DecimalFormatter = (function(_super) {
|
850
|
+
__extends(DecimalFormatter, _super);
|
851
|
+
|
852
|
+
function DecimalFormatter() {
|
853
|
+
return DecimalFormatter.__super__.constructor.apply(this, arguments);
|
854
|
+
}
|
855
|
+
|
856
|
+
DecimalFormatter.prototype.format = function(number, options) {
|
857
|
+
var error;
|
858
|
+
if (options == null) {
|
859
|
+
options = {};
|
860
|
+
}
|
861
|
+
try {
|
862
|
+
return DecimalFormatter.__super__.format.call(this, number, options);
|
863
|
+
} catch (_error) {
|
864
|
+
error = _error;
|
865
|
+
return number;
|
866
|
+
}
|
867
|
+
};
|
868
|
+
|
869
|
+
DecimalFormatter.prototype.default_format_options_for = function(number) {
|
870
|
+
return {
|
871
|
+
precision: this.precision_from(number)
|
872
|
+
};
|
873
|
+
};
|
874
|
+
|
875
|
+
DecimalFormatter.prototype.get_tokens = function(number, options) {
|
876
|
+
if (options == null) {
|
877
|
+
options = {};
|
878
|
+
}
|
879
|
+
if (number < 0) {
|
880
|
+
return this.all_tokens.decimal.negative;
|
881
|
+
} else {
|
882
|
+
return this.all_tokens.decimal.positive;
|
883
|
+
}
|
884
|
+
};
|
885
|
+
|
886
|
+
return DecimalFormatter;
|
887
|
+
|
888
|
+
})(TwitterCldr.NumberFormatter);
|
889
|
+
|
890
|
+
TwitterCldr.CurrencyFormatter = (function(_super) {
|
891
|
+
__extends(CurrencyFormatter, _super);
|
892
|
+
|
893
|
+
function CurrencyFormatter(options) {
|
894
|
+
if (options == null) {
|
895
|
+
options = {};
|
896
|
+
}
|
897
|
+
this.currencies_data = {"ADP":{"digits":0,"rounding":0},"AFN":{"digits":0,"rounding":0},"ALL":{"digits":0,"rounding":0},"AMD":{"digits":0,"rounding":0},"BHD":{"digits":3,"rounding":0},"BIF":{"digits":0,"rounding":0},"BYR":{"digits":0,"rounding":0},"CAD":{"digits":2,"rounding":0},"CHF":{"digits":2,"rounding":0},"CLF":{"digits":0,"rounding":0},"CLP":{"digits":0,"rounding":0},"COP":{"digits":0,"rounding":0},"CRC":{"digits":0,"rounding":0},"DEFAULT":{"digits":2,"rounding":0},"DJF":{"digits":0,"rounding":0},"ESP":{"digits":0,"rounding":0},"GNF":{"digits":0,"rounding":0},"GYD":{"digits":0,"rounding":0},"HUF":{"digits":0,"rounding":0},"IDR":{"digits":0,"rounding":0},"IQD":{"digits":0,"rounding":0},"IRR":{"digits":0,"rounding":0},"ISK":{"digits":0,"rounding":0},"ITL":{"digits":0,"rounding":0},"JOD":{"digits":3,"rounding":0},"JPY":{"digits":0,"rounding":0},"KMF":{"digits":0,"rounding":0},"KPW":{"digits":0,"rounding":0},"KRW":{"digits":0,"rounding":0},"KWD":{"digits":3,"rounding":0},"LAK":{"digits":0,"rounding":0},"LBP":{"digits":0,"rounding":0},"LUF":{"digits":0,"rounding":0},"LYD":{"digits":3,"rounding":0},"MGA":{"digits":0,"rounding":0},"MGF":{"digits":0,"rounding":0},"MMK":{"digits":0,"rounding":0},"MNT":{"digits":0,"rounding":0},"MRO":{"digits":0,"rounding":0},"MUR":{"digits":0,"rounding":0},"OMR":{"digits":3,"rounding":0},"PKR":{"digits":0,"rounding":0},"PYG":{"digits":0,"rounding":0},"RSD":{"digits":0,"rounding":0},"RWF":{"digits":0,"rounding":0},"SLL":{"digits":0,"rounding":0},"SOS":{"digits":0,"rounding":0},"STD":{"digits":0,"rounding":0},"SYP":{"digits":0,"rounding":0},"TMM":{"digits":0,"rounding":0},"TND":{"digits":3,"rounding":0},"TRL":{"digits":0,"rounding":0},"TWD":{"digits":2,"rounding":0},"TZS":{"digits":0,"rounding":0},"UGX":{"digits":0,"rounding":0},"UZS":{"digits":0,"rounding":0},"VND":{"digits":0,"rounding":0},"VUV":{"digits":0,"rounding":0},"XAF":{"digits":0,"rounding":0},"XOF":{"digits":0,"rounding":0},"XPF":{"digits":0,"rounding":0},"YER":{"digits":0,"rounding":0},"ZMK":{"digits":0,"rounding":0},"ZWD":{"digits":0,"rounding":0}};
|
898
|
+
this.default_currency_symbol = "$";
|
899
|
+
this.default_precision = this.currencies_data.DEFAULT.digits;
|
900
|
+
CurrencyFormatter.__super__.constructor.apply(this, arguments);
|
901
|
+
}
|
902
|
+
|
903
|
+
CurrencyFormatter.prototype.format = function(number, options) {
|
904
|
+
var currency, symbol;
|
905
|
+
if (options == null) {
|
906
|
+
options = {};
|
907
|
+
}
|
908
|
+
if (options.currency) {
|
909
|
+
if (TwitterCldr.Currencies != null) {
|
910
|
+
currency = TwitterCldr.Currencies.for_code(options.currency);
|
911
|
+
currency || (currency = {
|
912
|
+
symbol: options.currency
|
913
|
+
});
|
914
|
+
} else {
|
915
|
+
currency = {
|
916
|
+
symbol: options.currency
|
917
|
+
};
|
918
|
+
}
|
919
|
+
options.precision || (options.precision = this.defaults_for_currency(options.currency).digits);
|
920
|
+
} else {
|
921
|
+
currency = {
|
922
|
+
symbol: this.default_currency_symbol
|
923
|
+
};
|
924
|
+
}
|
925
|
+
symbol = options.use_cldr_symbol ? currency.cldr_symbol : currency.symbol;
|
926
|
+
return CurrencyFormatter.__super__.format.call(this, number, options).replace('¤', symbol);
|
927
|
+
};
|
928
|
+
|
929
|
+
CurrencyFormatter.prototype.default_format_options_for = function(number) {
|
930
|
+
var precision;
|
931
|
+
precision = this.precision_from(number);
|
932
|
+
if (precision === 0) {
|
933
|
+
precision = this.default_precision;
|
934
|
+
}
|
935
|
+
return {
|
936
|
+
precision: precision
|
937
|
+
};
|
938
|
+
};
|
939
|
+
|
940
|
+
CurrencyFormatter.prototype.get_tokens = function(number, options) {
|
941
|
+
if (options == null) {
|
942
|
+
options = {};
|
943
|
+
}
|
944
|
+
if (number < 0) {
|
945
|
+
return this.all_tokens.currency.negative;
|
946
|
+
} else {
|
947
|
+
return this.all_tokens.currency.positive;
|
948
|
+
}
|
949
|
+
};
|
950
|
+
|
951
|
+
CurrencyFormatter.prototype.defaults_for_currency = function(currency) {
|
952
|
+
return this.currencies_data[currency] || this.currencies_data.DEFAULT;
|
953
|
+
};
|
954
|
+
|
955
|
+
return CurrencyFormatter;
|
956
|
+
|
957
|
+
})(TwitterCldr.NumberFormatter);
|
958
|
+
|
959
|
+
TwitterCldr.AbbreviatedNumberFormatter = (function(_super) {
|
960
|
+
__extends(AbbreviatedNumberFormatter, _super);
|
961
|
+
|
962
|
+
function AbbreviatedNumberFormatter() {
|
963
|
+
return AbbreviatedNumberFormatter.__super__.constructor.apply(this, arguments);
|
964
|
+
}
|
965
|
+
|
966
|
+
AbbreviatedNumberFormatter.prototype.NUMBER_MAX = Math.pow(10, 15);
|
967
|
+
|
968
|
+
AbbreviatedNumberFormatter.prototype.NUMBER_MIN = 1000;
|
969
|
+
|
970
|
+
AbbreviatedNumberFormatter.prototype.default_format_options_for = function(number) {
|
971
|
+
return {
|
972
|
+
precision: this.precision_from(number)
|
973
|
+
};
|
974
|
+
};
|
975
|
+
|
976
|
+
AbbreviatedNumberFormatter.prototype.get_type = function() {
|
977
|
+
return "decimal";
|
978
|
+
};
|
979
|
+
|
980
|
+
AbbreviatedNumberFormatter.prototype.get_key = function(number) {
|
981
|
+
var i, zeroes;
|
982
|
+
zeroes = ((function() {
|
983
|
+
var _i, _ref, _results;
|
984
|
+
_results = [];
|
985
|
+
for (i = _i = 0, _ref = Math.floor(number).toString().length - 1; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
|
986
|
+
_results.push("0");
|
987
|
+
}
|
988
|
+
return _results;
|
989
|
+
})()).join("");
|
990
|
+
return "1" + zeroes;
|
991
|
+
};
|
992
|
+
|
993
|
+
AbbreviatedNumberFormatter.prototype.get_tokens = function(number, options) {
|
994
|
+
var format, tokens, type;
|
995
|
+
if (options == null) {
|
996
|
+
options = {};
|
997
|
+
}
|
998
|
+
type = (number < this.NUMBER_MAX) && (number >= this.NUMBER_MIN) ? this.get_type() : "decimal";
|
999
|
+
format = type === this.get_type() ? this.get_key(number) : null;
|
1000
|
+
tokens = this.all_tokens[type];
|
1001
|
+
tokens = number < 0 ? tokens.negative : tokens.positive;
|
1002
|
+
if (format != null) {
|
1003
|
+
tokens = tokens[format];
|
1004
|
+
}
|
1005
|
+
return tokens;
|
1006
|
+
};
|
1007
|
+
|
1008
|
+
AbbreviatedNumberFormatter.prototype.truncate_number = function(number, integer_format) {
|
1009
|
+
var factor;
|
1010
|
+
if (this.NUMBER_MIN <= number && number < this.NUMBER_MAX) {
|
1011
|
+
factor = Math.max(0, Math.floor(number).toString().length - integer_format.format.length);
|
1012
|
+
return number / Math.pow(10, factor);
|
1013
|
+
} else {
|
1014
|
+
return number;
|
1015
|
+
}
|
1016
|
+
};
|
1017
|
+
|
1018
|
+
return AbbreviatedNumberFormatter;
|
1019
|
+
|
1020
|
+
})(TwitterCldr.NumberFormatter);
|
1021
|
+
|
1022
|
+
TwitterCldr.ShortDecimalFormatter = (function(_super) {
|
1023
|
+
__extends(ShortDecimalFormatter, _super);
|
1024
|
+
|
1025
|
+
function ShortDecimalFormatter() {
|
1026
|
+
return ShortDecimalFormatter.__super__.constructor.apply(this, arguments);
|
1027
|
+
}
|
1028
|
+
|
1029
|
+
ShortDecimalFormatter.prototype.get_type = function() {
|
1030
|
+
return "short_decimal";
|
1031
|
+
};
|
1032
|
+
|
1033
|
+
return ShortDecimalFormatter;
|
1034
|
+
|
1035
|
+
})(TwitterCldr.AbbreviatedNumberFormatter);
|
1036
|
+
|
1037
|
+
TwitterCldr.LongDecimalFormatter = (function(_super) {
|
1038
|
+
__extends(LongDecimalFormatter, _super);
|
1039
|
+
|
1040
|
+
function LongDecimalFormatter() {
|
1041
|
+
return LongDecimalFormatter.__super__.constructor.apply(this, arguments);
|
1042
|
+
}
|
1043
|
+
|
1044
|
+
LongDecimalFormatter.prototype.get_type = function() {
|
1045
|
+
return "long_decimal";
|
1046
|
+
};
|
1047
|
+
|
1048
|
+
return LongDecimalFormatter;
|
1049
|
+
|
1050
|
+
})(TwitterCldr.AbbreviatedNumberFormatter);
|
1051
|
+
|
1052
|
+
TwitterCldr.NumberFormatter.BaseHelper = (function() {
|
1053
|
+
function BaseHelper() {}
|
1054
|
+
|
1055
|
+
BaseHelper.prototype.interpolate = function(string, value, orientation) {
|
1056
|
+
var i, length, start;
|
1057
|
+
if (orientation == null) {
|
1058
|
+
orientation = "right";
|
1059
|
+
}
|
1060
|
+
value = value.toString();
|
1061
|
+
length = value.length;
|
1062
|
+
start = orientation === "left" ? 0 : -length;
|
1063
|
+
if (string.length < length) {
|
1064
|
+
string = (((function() {
|
1065
|
+
var _i, _results;
|
1066
|
+
_results = [];
|
1067
|
+
for (i = _i = 0; 0 <= length ? _i < length : _i > length; i = 0 <= length ? ++_i : --_i) {
|
1068
|
+
_results.push("#");
|
1069
|
+
}
|
1070
|
+
return _results;
|
1071
|
+
})()).join("") + string).slice(-length);
|
1072
|
+
}
|
1073
|
+
if (start < 0) {
|
1074
|
+
string = string.slice(0, start + string.length) + value;
|
1075
|
+
} else {
|
1076
|
+
string = string.slice(0, start) + value + string.slice(length);
|
1077
|
+
}
|
1078
|
+
return string.replace(/#/g, "");
|
1079
|
+
};
|
1080
|
+
|
1081
|
+
return BaseHelper;
|
1082
|
+
|
1083
|
+
})();
|
1084
|
+
|
1085
|
+
TwitterCldr.NumberFormatter.IntegerHelper = (function(_super) {
|
1086
|
+
__extends(IntegerHelper, _super);
|
1087
|
+
|
1088
|
+
function IntegerHelper(token, symbols) {
|
1089
|
+
var format;
|
1090
|
+
if (symbols == null) {
|
1091
|
+
symbols = {};
|
1092
|
+
}
|
1093
|
+
format = token.split('.')[0];
|
1094
|
+
this.format = this.prepare_format(format, symbols);
|
1095
|
+
this.groups = this.parse_groups(format);
|
1096
|
+
this.separator = symbols.group || ',';
|
1097
|
+
}
|
1098
|
+
|
1099
|
+
IntegerHelper.prototype.apply = function(number, options) {
|
1100
|
+
if (options == null) {
|
1101
|
+
options = {};
|
1102
|
+
}
|
1103
|
+
return this.format_groups(this.interpolate(this.format, parseInt(number)));
|
1104
|
+
};
|
1105
|
+
|
1106
|
+
IntegerHelper.prototype.format_groups = function(string) {
|
1107
|
+
var cur_token, token, tokens;
|
1108
|
+
if (this.groups.length === 0) {
|
1109
|
+
return string;
|
1110
|
+
}
|
1111
|
+
tokens = [];
|
1112
|
+
cur_token = this.chop_group(string, this.groups[0]);
|
1113
|
+
tokens.push(cur_token);
|
1114
|
+
if (cur_token) {
|
1115
|
+
string = string.slice(0, string.length - cur_token.length);
|
1116
|
+
}
|
1117
|
+
while (string.length > this.groups[this.groups.length - 1]) {
|
1118
|
+
cur_token = this.chop_group(string, this.groups[this.groups.length - 1]);
|
1119
|
+
tokens.push(cur_token);
|
1120
|
+
if (cur_token) {
|
1121
|
+
string = string.slice(0, string.length - cur_token.length);
|
1122
|
+
}
|
1123
|
+
}
|
1124
|
+
tokens.push(string);
|
1125
|
+
return ((function() {
|
1126
|
+
var _i, _len, _results;
|
1127
|
+
_results = [];
|
1128
|
+
for (_i = 0, _len = tokens.length; _i < _len; _i++) {
|
1129
|
+
token = tokens[_i];
|
1130
|
+
if (token !== null) {
|
1131
|
+
_results.push(token);
|
1132
|
+
}
|
1133
|
+
}
|
1134
|
+
return _results;
|
1135
|
+
})()).reverse().join(this.separator);
|
1136
|
+
};
|
1137
|
+
|
1138
|
+
IntegerHelper.prototype.parse_groups = function(format) {
|
1139
|
+
var index, rest, width, widths;
|
1140
|
+
index = format.lastIndexOf(',');
|
1141
|
+
if (!(index > 0)) {
|
1142
|
+
return [];
|
1143
|
+
}
|
1144
|
+
rest = format.slice(0, index);
|
1145
|
+
widths = [format.length - index - 1];
|
1146
|
+
if (rest.lastIndexOf(',') > -1) {
|
1147
|
+
widths.push(rest.length - rest.lastIndexOf(',') - 1);
|
1148
|
+
}
|
1149
|
+
widths = (function() {
|
1150
|
+
var _i, _len, _results;
|
1151
|
+
_results = [];
|
1152
|
+
for (_i = 0, _len = widths.length; _i < _len; _i++) {
|
1153
|
+
width = widths[_i];
|
1154
|
+
if (width !== null) {
|
1155
|
+
_results.push(width);
|
1156
|
+
}
|
1157
|
+
}
|
1158
|
+
return _results;
|
1159
|
+
})();
|
1160
|
+
widths.reverse();
|
1161
|
+
return ((function() {
|
1162
|
+
var _i, _ref, _results;
|
1163
|
+
_results = [];
|
1164
|
+
for (index = _i = 0, _ref = widths.length; 0 <= _ref ? _i < _ref : _i > _ref; index = 0 <= _ref ? ++_i : --_i) {
|
1165
|
+
if (widths.indexOf(widths[index], index + 1) === -1) {
|
1166
|
+
_results.push(widths[index]);
|
1167
|
+
}
|
1168
|
+
}
|
1169
|
+
return _results;
|
1170
|
+
})()).reverse();
|
1171
|
+
};
|
1172
|
+
|
1173
|
+
IntegerHelper.prototype.chop_group = function(string, size) {
|
1174
|
+
if (string.length > size) {
|
1175
|
+
return string.slice(-size);
|
1176
|
+
} else {
|
1177
|
+
return null;
|
1178
|
+
}
|
1179
|
+
};
|
1180
|
+
|
1181
|
+
IntegerHelper.prototype.prepare_format = function(format, symbols) {
|
1182
|
+
return format.replace(",", "").replace("+", symbols.plus_sign).replace("-", symbols.minus_sign);
|
1183
|
+
};
|
1184
|
+
|
1185
|
+
return IntegerHelper;
|
1186
|
+
|
1187
|
+
})(TwitterCldr.NumberFormatter.BaseHelper);
|
1188
|
+
|
1189
|
+
TwitterCldr.NumberFormatter.FractionHelper = (function(_super) {
|
1190
|
+
__extends(FractionHelper, _super);
|
1191
|
+
|
1192
|
+
function FractionHelper(token, symbols) {
|
1193
|
+
if (symbols == null) {
|
1194
|
+
symbols = {};
|
1195
|
+
}
|
1196
|
+
this.format = token ? token.split('.').pop() : "";
|
1197
|
+
this.decimal = symbols.decimal || ".";
|
1198
|
+
this.precision = this.format.length;
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
FractionHelper.prototype.apply = function(fraction, options) {
|
1202
|
+
var precision;
|
1203
|
+
if (options == null) {
|
1204
|
+
options = {};
|
1205
|
+
}
|
1206
|
+
precision = options.precision != null ? options.precision : this.precision;
|
1207
|
+
if (precision > 0) {
|
1208
|
+
return this.decimal + this.interpolate(this.format_for(options), fraction, "left");
|
1209
|
+
} else {
|
1210
|
+
return "";
|
1211
|
+
}
|
1212
|
+
};
|
1213
|
+
|
1214
|
+
FractionHelper.prototype.format_for = function(options) {
|
1215
|
+
var i, precision;
|
1216
|
+
precision = options.precision != null ? options.precision : this.precision;
|
1217
|
+
if (precision) {
|
1218
|
+
return ((function() {
|
1219
|
+
var _i, _results;
|
1220
|
+
_results = [];
|
1221
|
+
for (i = _i = 0; 0 <= precision ? _i < precision : _i > precision; i = 0 <= precision ? ++_i : --_i) {
|
1222
|
+
_results.push("0");
|
1223
|
+
}
|
1224
|
+
return _results;
|
1225
|
+
})()).join("");
|
1226
|
+
} else {
|
1227
|
+
return this.format;
|
1228
|
+
}
|
1229
|
+
};
|
1230
|
+
|
1231
|
+
return FractionHelper;
|
1232
|
+
|
1233
|
+
})(TwitterCldr.NumberFormatter.BaseHelper);
|
1234
|
+
|
1235
|
+
TwitterCldr.Currencies = (function() {
|
1236
|
+
function Currencies() {}
|
1237
|
+
|
1238
|
+
Currencies.currencies = {"ADP":{"currency":"ADP","name":"Andorran peseta","cldr_symbol":"ADP","symbol":"ADP","code_points":[65,68,80]},"AED":{"currency":"AED","name":"UAE dirham","cldr_symbol":"AED","symbol":"AED","code_points":[65,69,68]},"AFA":{"currency":"AFA","name":"Afghan afghani (1927–2002)","cldr_symbol":"AFA","symbol":"AFA","code_points":[65,70,65]},"AFN":{"currency":"AFN","name":"Afghan Afghani","cldr_symbol":"AFN","symbol":"؋","code_points":[1547]},"ALK":{"currency":"ALK","name":"Albanian lek (1946–1965)","cldr_symbol":"ALK","symbol":"ALK","code_points":[65,76,75]},"ALL":{"currency":"ALL","name":"Albanian lek","cldr_symbol":"ALL","symbol":"LEK","code_points":[76,69,75]},"AMD":{"currency":"AMD","name":"Armenian dram","cldr_symbol":"AMD","symbol":"AMD","code_points":[65,77,68]},"ANG":{"currency":"ANG","name":"Netherlands Antillean guilder","cldr_symbol":"ANG","symbol":"ƒ","code_points":[402]},"AOA":{"currency":"AOA","name":"Angolan kwanza","cldr_symbol":"AOA","symbol":"AOA","code_points":[65,79,65]},"AOK":{"currency":"AOK","name":"Angolan kwanza (1977–1991)","cldr_symbol":"AOK","symbol":"AOK","code_points":[65,79,75]},"AON":{"currency":"AON","name":"Angolan new kwanza (1990–2000)","cldr_symbol":"AON","symbol":"AON","code_points":[65,79,78]},"AOR":{"currency":"AOR","name":"Angolan readjusted kwanza (1995–1999)","cldr_symbol":"AOR","symbol":"AOR","code_points":[65,79,82]},"ARA":{"currency":"ARA","name":"Argentine austral","cldr_symbol":"ARA","symbol":"ARA","code_points":[65,82,65]},"ARL":{"currency":"ARL","name":"Argentine peso ley (1970–1983)","cldr_symbol":"ARL","symbol":"ARL","code_points":[65,82,76]},"ARM":{"currency":"ARM","name":"Argentine peso (1881–1970)","cldr_symbol":"ARM","symbol":"ARM","code_points":[65,82,77]},"ARP":{"currency":"ARP","name":"Argentine peso (1983–1985)","cldr_symbol":"ARP","symbol":"ARP","code_points":[65,82,80]},"ARS":{"currency":"ARS","name":"Argentine peso","cldr_symbol":"$","symbol":"$","code_points":[36]},"ATS":{"currency":"ATS","name":"Austrian schilling","cldr_symbol":"ATS","symbol":"ATS","code_points":[65,84,83]},"AUD":{"currency":"AUD","name":"Australian dollar","cldr_symbol":"A$","symbol":"$","code_points":[36]},"AWG":{"currency":"AWG","name":"Aruban florin","cldr_symbol":"AWG","symbol":"ƒ","code_points":[402],"alt_name":"Florins"},"AZM":{"currency":"AZM","name":"Azerbaijani manat (1993–2006)","cldr_symbol":"AZM","symbol":"AZM","code_points":[65,90,77]},"AZN":{"currency":"AZN","name":"Azerbaijani manat","cldr_symbol":"AZN","symbol":"ман","code_points":[1084,1072,1085]},"BAD":{"currency":"BAD","name":"Bosnia-Herzegovina dinar (1992–1994)","cldr_symbol":"BAD","symbol":"BAD","code_points":[66,65,68]},"BAM":{"currency":"BAM","name":"Bosnia-Herzegovina convertible mark","cldr_symbol":"BAM","symbol":"KM","code_points":[75,77]},"BAN":{"currency":"BAN","name":"Bosnia-Herzegovina new dinar (1994–1997)","cldr_symbol":"BAN","symbol":"BAN","code_points":[66,65,78]},"BBD":{"currency":"BBD","name":"Barbadian dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"BDT":{"currency":"BDT","name":"Bangladeshi taka","cldr_symbol":"৳","symbol":"৳","code_points":[2547]},"BEC":{"currency":"BEC","name":"Belgian franc (convertible)","cldr_symbol":"BEC","symbol":"BEC","code_points":[66,69,67]},"BEF":{"currency":"BEF","name":"Belgian franc","cldr_symbol":"BEF","symbol":"BEF","code_points":[66,69,70]},"BEL":{"currency":"BEL","name":"Belgian franc (financial)","cldr_symbol":"BEL","symbol":"BEL","code_points":[66,69,76]},"BGL":{"currency":"BGL","name":"Bulgarian hard lev","cldr_symbol":"BGL","symbol":"BGL","code_points":[66,71,76]},"BGM":{"currency":"BGM","name":"Bulgarian socialist lev","cldr_symbol":"BGM","symbol":"BGM","code_points":[66,71,77]},"BGN":{"currency":"BGN","name":"Bulgarian lev","cldr_symbol":"BGN","symbol":"лв","code_points":[1083,1074]},"BGO":{"currency":"BGO","name":"Bulgarian lev (1879–1952)","cldr_symbol":"BGO","symbol":"BGO","code_points":[66,71,79]},"BHD":{"currency":"BHD","name":"Bahraini dinar","cldr_symbol":"BHD","symbol":"BHD","code_points":[66,72,68]},"BIF":{"currency":"BIF","name":"Burundian franc","cldr_symbol":"BIF","symbol":"BIF","code_points":[66,73,70]},"BMD":{"currency":"BMD","name":"Bermudan dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"BND":{"currency":"BND","name":"Brunei dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"BOB":{"currency":"BOB","name":"Bolivian boliviano","cldr_symbol":"BOB","symbol":"$b","code_points":[36,98]},"BOL":{"currency":"BOL","name":"Bolivian boliviano (1863–1963)","cldr_symbol":"BOL","symbol":"BOL","code_points":[66,79,76]},"BOP":{"currency":"BOP","name":"Bolivian peso","cldr_symbol":"BOP","symbol":"BOP","code_points":[66,79,80]},"BOV":{"currency":"BOV","name":"Bolivian mvdol","cldr_symbol":"BOV","symbol":"BOV","code_points":[66,79,86]},"BRB":{"currency":"BRB","name":"Brazilian new cruzeiro (1967–1986)","cldr_symbol":"BRB","symbol":"BRB","code_points":[66,82,66]},"BRC":{"currency":"BRC","name":"Brazilian cruzado (1986–1989)","cldr_symbol":"BRC","symbol":"BRC","code_points":[66,82,67]},"BRE":{"currency":"BRE","name":"Brazilian cruzeiro (1990–1993)","cldr_symbol":"BRE","symbol":"BRE","code_points":[66,82,69]},"BRL":{"currency":"BRL","name":"Brazilian real","cldr_symbol":"R$","symbol":"R$","code_points":[82,36]},"BRN":{"currency":"BRN","name":"Brazilian new cruzado (1989–1990)","cldr_symbol":"BRN","symbol":"BRN","code_points":[66,82,78]},"BRR":{"currency":"BRR","name":"Brazilian cruzeiro (1993–1994)","cldr_symbol":"BRR","symbol":"BRR","code_points":[66,82,82]},"BRZ":{"currency":"BRZ","name":"Brazilian cruzeiro (1942–1967)","cldr_symbol":"BRZ","symbol":"BRZ","code_points":[66,82,90]},"BSD":{"currency":"BSD","name":"Bahamian dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"BTN":{"currency":"BTN","name":"Bhutanese ngultrum","cldr_symbol":"BTN","symbol":"BTN","code_points":[66,84,78]},"BUK":{"currency":"BUK","name":"Burmese kyat","cldr_symbol":"BUK","symbol":"BUK","code_points":[66,85,75]},"BWP":{"currency":"BWP","name":"Botswanan pula","cldr_symbol":"BWP","symbol":"P","code_points":[80]},"BYB":{"currency":"BYB","name":"Belarusian new ruble (1994–1999)","cldr_symbol":"BYB","symbol":"BYB","code_points":[66,89,66]},"BYR":{"currency":"BYR","name":"Belarusian ruble","cldr_symbol":"р.","symbol":"p.","code_points":[112,46]},"BZD":{"currency":"BZD","name":"Belize dollar","cldr_symbol":"$","symbol":"BZ$","code_points":[66,90,36]},"CAD":{"currency":"CAD","name":"Canadian dollar","cldr_symbol":"CA$","symbol":"$","code_points":[36]},"CDF":{"currency":"CDF","name":"Congolese franc","cldr_symbol":"CDF","symbol":"CDF","code_points":[67,68,70]},"CHE":{"currency":"CHE","name":"WIR euro","cldr_symbol":"CHE","symbol":"CHE","code_points":[67,72,69]},"CHF":{"currency":"CHF","name":"Swiss franc","cldr_symbol":"CHF","symbol":"CHF","code_points":[67,72,70]},"CHW":{"currency":"CHW","name":"WIR franc","cldr_symbol":"CHW","symbol":"CHW","code_points":[67,72,87]},"CLE":{"currency":"CLE","name":"Chilean escudo","cldr_symbol":"CLE","symbol":"CLE","code_points":[67,76,69]},"CLF":{"currency":"CLF","name":"Chilean unit of account (UF)","cldr_symbol":"CLF","symbol":"CLF","code_points":[67,76,70]},"CLP":{"currency":"CLP","name":"Chilean peso","cldr_symbol":"$","symbol":"$","code_points":[36]},"CNX":{"currency":"CNX","name":"Chinese People’s Bank dollar","cldr_symbol":"CNX","symbol":"CNX","code_points":[67,78,88]},"CNY":{"currency":"CNY","name":"Chinese yuan","cldr_symbol":"CN¥","symbol":"¥","code_points":[165]},"COP":{"currency":"COP","name":"Colombian peso","cldr_symbol":"$","symbol":"$","code_points":[36]},"COU":{"currency":"COU","name":"Colombian real value unit","cldr_symbol":"COU","symbol":"COU","code_points":[67,79,85]},"CRC":{"currency":"CRC","name":"Costa Rican colón","cldr_symbol":"₡","symbol":"₡","code_points":[8353]},"CSD":{"currency":"CSD","name":"Serbian dinar (2002–2006)","cldr_symbol":"CSD","symbol":"CSD","code_points":[67,83,68]},"CSK":{"currency":"CSK","name":"Czechoslovak hard koruna","cldr_symbol":"CSK","symbol":"CSK","code_points":[67,83,75]},"CUC":{"currency":"CUC","name":"Cuban convertible peso","cldr_symbol":"CUC","symbol":"CUC","code_points":[67,85,67]},"CUP":{"currency":"CUP","name":"Cuban peso","cldr_symbol":"$","symbol":"₱","code_points":[8369]},"CVE":{"currency":"CVE","name":"Cape Verdean escudo","cldr_symbol":"CVE","symbol":"CVE","code_points":[67,86,69]},"CYP":{"currency":"CYP","name":"Cypriot pound","cldr_symbol":"CYP","symbol":"CYP","code_points":[67,89,80]},"CZK":{"currency":"CZK","name":"Czech Republic koruna","cldr_symbol":"CZK","symbol":"Kč","code_points":[75,269]},"DDM":{"currency":"DDM","name":"East German mark","cldr_symbol":"DDM","symbol":"DDM","code_points":[68,68,77]},"DEM":{"currency":"DEM","name":"German mark","cldr_symbol":"DEM","symbol":"DEM","code_points":[68,69,77]},"DJF":{"currency":"DJF","name":"Djiboutian franc","cldr_symbol":"DJF","symbol":"DJF","code_points":[68,74,70]},"DKK":{"currency":"DKK","name":"Danish krone","cldr_symbol":"DKK","symbol":"kr","code_points":[107,114]},"DOP":{"currency":"DOP","name":"Dominican peso","cldr_symbol":"$","symbol":"RD$","code_points":[82,68,36]},"DZD":{"currency":"DZD","name":"Algerian dinar","cldr_symbol":"DZD","symbol":"DZD","code_points":[68,90,68]},"ECS":{"currency":"ECS","name":"Ecuadorian sucre","cldr_symbol":"ECS","symbol":"ECS","code_points":[69,67,83]},"ECV":{"currency":"ECV","name":"Ecuadorian unit of constant value","cldr_symbol":"ECV","symbol":"ECV","code_points":[69,67,86]},"EEK":{"currency":"EEK","name":"Estonian kroon","cldr_symbol":"EEK","symbol":"kr","code_points":[107,114]},"EGP":{"currency":"EGP","name":"Egyptian pound","cldr_symbol":"EGP","symbol":"£","code_points":[163]},"ERN":{"currency":"ERN","name":"Eritrean nakfa","cldr_symbol":"ERN","symbol":"ERN","code_points":[69,82,78]},"ESA":{"currency":"ESA","name":"Spanish peseta (A account)","cldr_symbol":"ESA","symbol":"ESA","code_points":[69,83,65]},"ESB":{"currency":"ESB","name":"Spanish peseta (convertible account)","cldr_symbol":"ESB","symbol":"ESB","code_points":[69,83,66]},"ESP":{"currency":"ESP","name":"Spanish peseta","cldr_symbol":"₧","symbol":"₧","code_points":[8359]},"ETB":{"currency":"ETB","name":"Ethiopian birr","cldr_symbol":"ETB","symbol":"ETB","code_points":[69,84,66]},"EUR":{"currency":"EUR","name":"euro","cldr_symbol":"€","symbol":"€","code_points":[8364]},"FIM":{"currency":"FIM","name":"Finnish markka","cldr_symbol":"FIM","symbol":"FIM","code_points":[70,73,77]},"FJD":{"currency":"FJD","name":"Fijian dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"FKP":{"currency":"FKP","name":"Falkland Islands pound","cldr_symbol":"FKP","symbol":"£","code_points":[163]},"FRF":{"currency":"FRF","name":"French franc","cldr_symbol":"FRF","symbol":"FRF","code_points":[70,82,70]},"GBP":{"currency":"GBP","name":"British pound sterling","cldr_symbol":"£","symbol":"£","code_points":[163]},"GEK":{"currency":"GEK","name":"Georgian kupon larit","cldr_symbol":"GEK","symbol":"GEK","code_points":[71,69,75]},"GEL":{"currency":"GEL","name":"Georgian lari","cldr_symbol":"GEL","symbol":"GEL","code_points":[71,69,76]},"GHC":{"currency":"GHC","name":"Ghanaian cedi (1979–2007)","cldr_symbol":"GHC","symbol":"GHC","code_points":[71,72,67]},"GHS":{"currency":"GHS","name":"Ghanaian cedi","cldr_symbol":"₵","symbol":"¢","code_points":[162]},"GIP":{"currency":"GIP","name":"Gibraltar pound","cldr_symbol":"£","symbol":"£","code_points":[163]},"GMD":{"currency":"GMD","name":"Gambian dalasi","cldr_symbol":"GMD","symbol":"GMD","code_points":[71,77,68]},"GNF":{"currency":"GNF","name":"Guinean franc","cldr_symbol":"GNF","symbol":"GNF","code_points":[71,78,70]},"GNS":{"currency":"GNS","name":"Guinean syli","cldr_symbol":"GNS","symbol":"GNS","code_points":[71,78,83]},"GQE":{"currency":"GQE","name":"Equatorial Guinean ekwele","cldr_symbol":"GQE","symbol":"GQE","code_points":[71,81,69]},"GRD":{"currency":"GRD","name":"Greek drachma","cldr_symbol":"GRD","symbol":"GRD","code_points":[71,82,68]},"GTQ":{"currency":"GTQ","name":"Guatemalan quetzal","cldr_symbol":"GTQ","symbol":"Q","code_points":[81]},"GWE":{"currency":"GWE","name":"Portuguese Guinea escudo","cldr_symbol":"GWE","symbol":"GWE","code_points":[71,87,69]},"GWP":{"currency":"GWP","name":"Guinea-Bissau peso","cldr_symbol":"GWP","symbol":"GWP","code_points":[71,87,80]},"GYD":{"currency":"GYD","name":"Guyanaese dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"HKD":{"currency":"HKD","name":"Hong Kong dollar","cldr_symbol":"HK$","symbol":"$","code_points":[36]},"HNL":{"currency":"HNL","name":"Honduran lempira","cldr_symbol":"HNL","symbol":"L","code_points":[76]},"HRD":{"currency":"HRD","name":"Croatian dinar","cldr_symbol":"HRD","symbol":"HRD","code_points":[72,82,68]},"HRK":{"currency":"HRK","name":"Croatian kuna","cldr_symbol":"HRK","symbol":"kn","code_points":[107,110]},"HTG":{"currency":"HTG","name":"Haitian gourde","cldr_symbol":"HTG","symbol":"HTG","code_points":[72,84,71]},"HUF":{"currency":"HUF","name":"Hungarian forint","cldr_symbol":"HUF","symbol":"Ft","code_points":[70,116]},"IDR":{"currency":"IDR","name":"Indonesian rupiah","cldr_symbol":"IDR","symbol":"Rp","code_points":[82,112]},"IEP":{"currency":"IEP","name":"Irish pound","cldr_symbol":"IEP","symbol":"IEP","code_points":[73,69,80]},"ILP":{"currency":"ILP","name":"Israeli pound","cldr_symbol":"ILP","symbol":"ILP","code_points":[73,76,80]},"ILR":{"currency":"ILR","name":"Israeli sheqel (1980–1985)","cldr_symbol":"ILR","symbol":"ILR","code_points":[73,76,82]},"ILS":{"currency":"ILS","name":"Israeli new sheqel","cldr_symbol":"₪","symbol":"₪","code_points":[8362]},"INR":{"currency":"INR","name":"Indian rupee","cldr_symbol":"₹","symbol":"₨","code_points":[8360]},"IQD":{"currency":"IQD","name":"Iraqi dinar","cldr_symbol":"IQD","symbol":"IQD","code_points":[73,81,68]},"IRR":{"currency":"IRR","name":"Iranian rial","cldr_symbol":"IRR","symbol":"﷼","code_points":[65020]},"ISJ":{"currency":"ISJ","name":"Icelandic króna (1918–1981)","cldr_symbol":"ISJ","symbol":"ISJ","code_points":[73,83,74]},"ISK":{"currency":"ISK","name":"Icelandic króna","cldr_symbol":"ISK","symbol":"kr","code_points":[107,114]},"ITL":{"currency":"ITL","name":"Italian lira","cldr_symbol":"ITL","symbol":"ITL","code_points":[73,84,76]},"JMD":{"currency":"JMD","name":"Jamaican dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"JOD":{"currency":"JOD","name":"Jordanian dinar","cldr_symbol":"JOD","symbol":"JOD","code_points":[74,79,68]},"JPY":{"currency":"JPY","name":"Japanese yen","cldr_symbol":"¥","symbol":"¥","code_points":[165]},"KES":{"currency":"KES","name":"Kenyan shilling","cldr_symbol":"KES","symbol":"KES","code_points":[75,69,83]},"KGS":{"currency":"KGS","name":"Kyrgystani som","cldr_symbol":"KGS","symbol":"лв","code_points":[1083,1074]},"KHR":{"currency":"KHR","name":"Cambodian riel","cldr_symbol":"៛","symbol":"៛","code_points":[6107]},"KMF":{"currency":"KMF","name":"Comorian franc","cldr_symbol":"KMF","symbol":"KMF","code_points":[75,77,70]},"KPW":{"currency":"KPW","name":"North Korean won","cldr_symbol":"KPW","symbol":"₩","code_points":[8361]},"KRH":{"currency":"KRH","name":"South Korean hwan (1953–1962)","cldr_symbol":"KRH","symbol":"KRH","code_points":[75,82,72]},"KRO":{"currency":"KRO","name":"South Korean won (1945–1953)","cldr_symbol":"KRO","symbol":"KRO","code_points":[75,82,79]},"KRW":{"currency":"KRW","name":"South Korean won","cldr_symbol":"₩","symbol":"₩","code_points":[8361]},"KWD":{"currency":"KWD","name":"Kuwaiti dinar","cldr_symbol":"KWD","symbol":"KWD","code_points":[75,87,68]},"KYD":{"currency":"KYD","name":"Cayman Islands dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"KZT":{"currency":"KZT","name":"Kazakhstani tenge","cldr_symbol":"₸","symbol":"лв","code_points":[1083,1074]},"LAK":{"currency":"LAK","name":"Laotian kip","cldr_symbol":"₭","symbol":"₭","code_points":[8365]},"LBP":{"currency":"LBP","name":"Lebanese pound","cldr_symbol":"LBP","symbol":"£","code_points":[163]},"LKR":{"currency":"LKR","name":"Sri Lankan rupee","cldr_symbol":"LKR","symbol":"₨","code_points":[8360]},"LRD":{"currency":"LRD","name":"Liberian dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"LSL":{"currency":"LSL","name":"Lesotho loti","cldr_symbol":"LSL","symbol":"LSL","code_points":[76,83,76]},"LTL":{"currency":"LTL","name":"Lithuanian litas","cldr_symbol":"LTL","symbol":"Lt","code_points":[76,116]},"LTT":{"currency":"LTT","name":"Lithuanian talonas","cldr_symbol":"LTT","symbol":"LTT","code_points":[76,84,84]},"LUC":{"currency":"LUC","name":"Luxembourgian convertible franc","cldr_symbol":"LUC","symbol":"LUC","code_points":[76,85,67]},"LUF":{"currency":"LUF","name":"Luxembourgian franc","cldr_symbol":"LUF","symbol":"LUF","code_points":[76,85,70]},"LUL":{"currency":"LUL","name":"Luxembourg financial franc","cldr_symbol":"LUL","symbol":"LUL","code_points":[76,85,76]},"LVL":{"currency":"LVL","name":"Latvian lats","cldr_symbol":"LVL","symbol":"Ls","code_points":[76,115]},"LVR":{"currency":"LVR","name":"Latvian ruble","cldr_symbol":"LVR","symbol":"LVR","code_points":[76,86,82]},"LYD":{"currency":"LYD","name":"Libyan dinar","cldr_symbol":"LYD","symbol":"LYD","code_points":[76,89,68]},"MAD":{"currency":"MAD","name":"Moroccan dirham","cldr_symbol":"MAD","symbol":"MAD","code_points":[77,65,68]},"MAF":{"currency":"MAF","name":"Moroccan franc","cldr_symbol":"MAF","symbol":"MAF","code_points":[77,65,70]},"MCF":{"currency":"MCF","name":"Monegasque franc","cldr_symbol":"MCF","symbol":"MCF","code_points":[77,67,70]},"MDC":{"currency":"MDC","name":"Moldovan cupon","cldr_symbol":"MDC","symbol":"MDC","code_points":[77,68,67]},"MDL":{"currency":"MDL","name":"Moldovan leu","cldr_symbol":"MDL","symbol":"MDL","code_points":[77,68,76]},"MGA":{"currency":"MGA","name":"Malagasy Ariary","cldr_symbol":"MGA","symbol":"MGA","code_points":[77,71,65]},"MGF":{"currency":"MGF","name":"Malagasy franc","cldr_symbol":"MGF","symbol":"MGF","code_points":[77,71,70]},"MKD":{"currency":"MKD","name":"Macedonian denar","cldr_symbol":"MKD","symbol":"MKD","code_points":[77,75,68]},"MKN":{"currency":"MKN","name":"Macedonian denar (1992–1993)","cldr_symbol":"MKN","symbol":"MKN","code_points":[77,75,78]},"MLF":{"currency":"MLF","name":"Malian franc","cldr_symbol":"MLF","symbol":"MLF","code_points":[77,76,70]},"MMK":{"currency":"MMK","name":"Myanmar kyat","cldr_symbol":"MMK","symbol":"MMK","code_points":[77,77,75]},"MNT":{"currency":"MNT","name":"Mongolian tugrik","cldr_symbol":"₮","symbol":"₮","code_points":[8366]},"MOP":{"currency":"MOP","name":"Macanese pataca","cldr_symbol":"MOP","symbol":"MOP","code_points":[77,79,80]},"MRO":{"currency":"MRO","name":"Mauritanian ouguiya","cldr_symbol":"MRO","symbol":"MRO","code_points":[77,82,79]},"MTL":{"currency":"MTL","name":"Maltese lira","cldr_symbol":"MTL","symbol":"MTL","code_points":[77,84,76]},"MTP":{"currency":"MTP","name":"Maltese pound","cldr_symbol":"MTP","symbol":"MTP","code_points":[77,84,80]},"MUR":{"currency":"MUR","name":"Mauritian rupee","cldr_symbol":"MUR","symbol":"₨","code_points":[8360]},"MVP":{"currency":"MVP","name":"Maldivian rupee","cldr_symbol":"MVP","symbol":"MVP","code_points":[77,86,80]},"MVR":{"currency":"MVR","name":"Maldivian rufiyaa","cldr_symbol":"MVR","symbol":"MVR","code_points":[77,86,82]},"MWK":{"currency":"MWK","name":"Malawian Kwacha","cldr_symbol":"MWK","symbol":"MWK","code_points":[77,87,75]},"MXN":{"currency":"MXN","name":"Mexican peso","cldr_symbol":"MX$","symbol":"$","code_points":[36]},"MXP":{"currency":"MXP","name":"Mexican silver peso (1861–1992)","cldr_symbol":"MXP","symbol":"MXP","code_points":[77,88,80]},"MXV":{"currency":"MXV","name":"Mexican investment unit","cldr_symbol":"MXV","symbol":"MXV","code_points":[77,88,86]},"MYR":{"currency":"MYR","name":"Malaysian ringgit","cldr_symbol":"MYR","symbol":"RM","code_points":[82,77]},"MZE":{"currency":"MZE","name":"Mozambican escudo","cldr_symbol":"MZE","symbol":"MZE","code_points":[77,90,69]},"MZM":{"currency":"MZM","name":"Mozambican metical (1980–2006)","cldr_symbol":"MZM","symbol":"MZM","code_points":[77,90,77]},"MZN":{"currency":"MZN","name":"Mozambican metical","cldr_symbol":"MZN","symbol":"MT","code_points":[77,84]},"NAD":{"currency":"NAD","name":"Namibian dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"NGN":{"currency":"NGN","name":"Nigerian naira","cldr_symbol":"₦","symbol":"₦","code_points":[8358]},"NIC":{"currency":"NIC","name":"Nicaraguan córdoba (1988–1991)","cldr_symbol":"NIC","symbol":"NIC","code_points":[78,73,67]},"NIO":{"currency":"NIO","name":"Nicaraguan córdoba","cldr_symbol":"NIO","symbol":"C$","code_points":[67,36]},"NLG":{"currency":"NLG","name":"Dutch guilder","cldr_symbol":"NLG","symbol":"NLG","code_points":[78,76,71]},"NOK":{"currency":"NOK","name":"Norwegian krone","cldr_symbol":"NOK","symbol":"kr","code_points":[107,114]},"NPR":{"currency":"NPR","name":"Nepalese rupee","cldr_symbol":"NPR","symbol":"₨","code_points":[8360]},"NZD":{"currency":"NZD","name":"New Zealand dollar","cldr_symbol":"NZ$","symbol":"$","code_points":[36]},"OMR":{"currency":"OMR","name":"Omani rial","cldr_symbol":"OMR","symbol":"﷼","code_points":[65020]},"PAB":{"currency":"PAB","name":"Panamanian balboa","cldr_symbol":"PAB","symbol":"B/.","code_points":[66,47,46]},"PEI":{"currency":"PEI","name":"Peruvian inti","cldr_symbol":"PEI","symbol":"PEI","code_points":[80,69,73]},"PEN":{"currency":"PEN","name":"Peruvian nuevo sol","cldr_symbol":"PEN","symbol":"S/.","code_points":[83,47,46]},"PES":{"currency":"PES","name":"Peruvian sol (1863–1965)","cldr_symbol":"PES","symbol":"PES","code_points":[80,69,83]},"PGK":{"currency":"PGK","name":"Papua New Guinean kina","cldr_symbol":"PGK","symbol":"PGK","code_points":[80,71,75]},"PHP":{"currency":"PHP","name":"Philippine peso","cldr_symbol":"₱","symbol":"Php","code_points":[80,104,112]},"PKR":{"currency":"PKR","name":"Pakistani rupee","cldr_symbol":"PKR","symbol":"₨","code_points":[8360]},"PLN":{"currency":"PLN","name":"Polish zloty","cldr_symbol":"PLN","symbol":"zł","code_points":[122,322]},"PLZ":{"currency":"PLZ","name":"Polish zloty (PLZ)","cldr_symbol":"PLZ","symbol":"PLZ","code_points":[80,76,90]},"PTE":{"currency":"PTE","name":"Portuguese escudo","cldr_symbol":"PTE","symbol":"PTE","code_points":[80,84,69]},"PYG":{"currency":"PYG","name":"Paraguayan guarani","cldr_symbol":"₲","symbol":"Gs","code_points":[71,115]},"QAR":{"currency":"QAR","name":"Qatari rial","cldr_symbol":"QAR","symbol":"﷼","code_points":[65020]},"RHD":{"currency":"RHD","name":"Rhodesian dollar","cldr_symbol":"RHD","symbol":"RHD","code_points":[82,72,68]},"ROL":{"currency":"ROL","name":"Romanian leu (1952–2006)","cldr_symbol":"ROL","symbol":"ROL","code_points":[82,79,76]},"RON":{"currency":"RON","name":"Romanian leu","cldr_symbol":"RON","symbol":"lei","code_points":[108,101,105]},"RSD":{"currency":"RSD","name":"Serbian dinar","cldr_symbol":"RSD","symbol":"Дин.","code_points":[1044,1080,1085,46]},"RUB":{"currency":"RUB","name":"Russian ruble","cldr_symbol":"RUB","symbol":"руб","code_points":[1088,1091,1073]},"RUR":{"currency":"RUR","name":"Russian ruble (1991–1998)","cldr_symbol":"р.","symbol":"р.","code_points":[1088,46]},"RWF":{"currency":"RWF","name":"Rwandan franc","cldr_symbol":"RWF","symbol":"RWF","code_points":[82,87,70]},"SAR":{"currency":"SAR","name":"Saudi riyal","cldr_symbol":"SAR","symbol":"﷼","code_points":[65020]},"SBD":{"currency":"SBD","name":"Solomon Islands dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"SCR":{"currency":"SCR","name":"Seychellois rupee","cldr_symbol":"SCR","symbol":"₨","code_points":[8360]},"SDD":{"currency":"SDD","name":"Sudanese dinar (1992–2007)","cldr_symbol":"SDD","symbol":"SDD","code_points":[83,68,68]},"SDG":{"currency":"SDG","name":"Sudanese pound","cldr_symbol":"SDG","symbol":"SDG","code_points":[83,68,71]},"SDP":{"currency":"SDP","name":"Sudanese pound (1957–1998)","cldr_symbol":"SDP","symbol":"SDP","code_points":[83,68,80]},"SEK":{"currency":"SEK","name":"Swedish krona","cldr_symbol":"SEK","symbol":"kr","code_points":[107,114]},"SGD":{"currency":"SGD","name":"Singapore dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"SHP":{"currency":"SHP","name":"Saint Helena pound","cldr_symbol":"SHP","symbol":"£","code_points":[163]},"SIT":{"currency":"SIT","name":"Slovenian tolar","cldr_symbol":"SIT","symbol":"SIT","code_points":[83,73,84]},"SKK":{"currency":"SKK","name":"Slovak koruna","cldr_symbol":"SKK","symbol":"SKK","code_points":[83,75,75]},"SLL":{"currency":"SLL","name":"Sierra Leonean leone","cldr_symbol":"SLL","symbol":"SLL","code_points":[83,76,76]},"SOS":{"currency":"SOS","name":"Somali shilling","cldr_symbol":"SOS","symbol":"S","code_points":[83]},"SRD":{"currency":"SRD","name":"Surinamese dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"SRG":{"currency":"SRG","name":"Surinamese guilder","cldr_symbol":"SRG","symbol":"SRG","code_points":[83,82,71]},"SSP":{"currency":"SSP","name":"South Sudanese pound","cldr_symbol":"£","symbol":"£","code_points":[163]},"STD":{"currency":"STD","name":"São Tomé and Príncipe dobra","cldr_symbol":"STD","symbol":"STD","code_points":[83,84,68]},"SUR":{"currency":"SUR","name":"Soviet rouble","cldr_symbol":"SUR","symbol":"SUR","code_points":[83,85,82]},"SVC":{"currency":"SVC","name":"Salvadoran colón","cldr_symbol":"SVC","symbol":"SVC","code_points":[83,86,67]},"SYP":{"currency":"SYP","name":"Syrian pound","cldr_symbol":"SYP","symbol":"£","code_points":[163]},"SZL":{"currency":"SZL","name":"Swazi lilangeni","cldr_symbol":"SZL","symbol":"SZL","code_points":[83,90,76]},"THB":{"currency":"THB","name":"Thai baht","cldr_symbol":"฿","symbol":"฿","code_points":[3647]},"TJR":{"currency":"TJR","name":"Tajikistani ruble","cldr_symbol":"TJR","symbol":"TJR","code_points":[84,74,82]},"TJS":{"currency":"TJS","name":"Tajikistani somoni","cldr_symbol":"TJS","symbol":"TJS","code_points":[84,74,83]},"TMM":{"currency":"TMM","name":"Turkmenistani manat (1993–2009)","cldr_symbol":"TMM","symbol":"TMM","code_points":[84,77,77]},"TMT":{"currency":"TMT","name":"Turkmenistani manat","cldr_symbol":"TMT","symbol":"TMT","code_points":[84,77,84]},"TND":{"currency":"TND","name":"Tunisian dinar","cldr_symbol":"TND","symbol":"TND","code_points":[84,78,68]},"TOP":{"currency":"TOP","name":"Tongan paʻanga","cldr_symbol":"TOP","symbol":"TOP","code_points":[84,79,80]},"TPE":{"currency":"TPE","name":"Timorese escudo","cldr_symbol":"TPE","symbol":"TPE","code_points":[84,80,69]},"TRL":{"currency":"TRL","name":"Turkish lira (1922–2005)","cldr_symbol":"TRL","symbol":"TRL","code_points":[84,82,76]},"TRY":{"currency":"TRY","name":"Turkish lira","cldr_symbol":"₺","symbol":"TL","code_points":[84,76]},"TTD":{"currency":"TTD","name":"Trinidad and Tobago dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"TWD":{"currency":"TWD","name":"New Taiwan dollar","cldr_symbol":"NT$","symbol":"NT$","code_points":[78,84,36]},"TZS":{"currency":"TZS","name":"Tanzanian shilling","cldr_symbol":"TZS","symbol":"TZS","code_points":[84,90,83]},"UAH":{"currency":"UAH","name":"Ukrainian hryvnia","cldr_symbol":"₴","symbol":"₴","code_points":[8372]},"UAK":{"currency":"UAK","name":"Ukrainian karbovanets","cldr_symbol":"UAK","symbol":"UAK","code_points":[85,65,75]},"UGS":{"currency":"UGS","name":"Ugandan shilling (1966–1987)","cldr_symbol":"UGS","symbol":"UGS","code_points":[85,71,83]},"UGX":{"currency":"UGX","name":"Ugandan shilling","cldr_symbol":"UGX","symbol":"UGX","code_points":[85,71,88]},"USD":{"currency":"USD","name":"US dollar","cldr_symbol":"$","symbol":"$","code_points":[36]},"USN":{"currency":"USN","name":"US dollar (next day)","cldr_symbol":"USN","symbol":"USN","code_points":[85,83,78]},"USS":{"currency":"USS","name":"US dollar (same day)","cldr_symbol":"USS","symbol":"USS","code_points":[85,83,83]},"UYI":{"currency":"UYI","name":"Uruguayan peso (indexed units)","cldr_symbol":"UYI","symbol":"UYI","code_points":[85,89,73]},"UYP":{"currency":"UYP","name":"Uruguayan peso (1975–1993)","cldr_symbol":"UYP","symbol":"UYP","code_points":[85,89,80]},"UYU":{"currency":"UYU","name":"Uruguayan peso","cldr_symbol":"$","symbol":"$U","code_points":[36,85]},"UZS":{"currency":"UZS","name":"Uzbekistan som","cldr_symbol":"UZS","symbol":"лв","code_points":[1083,1074]},"VEB":{"currency":"VEB","name":"Venezuelan bolívar (1871–2008)","cldr_symbol":"VEB","symbol":"VEB","code_points":[86,69,66]},"VEF":{"currency":"VEF","name":"Venezuelan bolívar","cldr_symbol":"VEF","symbol":"Bs","code_points":[66,115]},"VND":{"currency":"VND","name":"Vietnamese dong","cldr_symbol":"₫","symbol":"₫","code_points":[8363]},"VNN":{"currency":"VNN","name":"Vietnamese dong (1978–1985)","cldr_symbol":"VNN","symbol":"VNN","code_points":[86,78,78]},"VUV":{"currency":"VUV","name":"Vanuatu vatu","cldr_symbol":"VUV","symbol":"VUV","code_points":[86,85,86]},"WST":{"currency":"WST","name":"Samoan tala","cldr_symbol":"WST","symbol":"WST","code_points":[87,83,84]},"XAF":{"currency":"XAF","name":"CFA franc BEAC","cldr_symbol":"FCFA","symbol":"FCFA","code_points":[70,67,70,65]},"XAG":{"currency":"XAG","name":"troy ounce of silver","cldr_symbol":"XAG","symbol":"XAG","code_points":[88,65,71]},"XAU":{"currency":"XAU","name":"troy ounce of gold","cldr_symbol":"XAU","symbol":"XAU","code_points":[88,65,85]},"XBA":{"currency":"XBA","name":"European composite unit","cldr_symbol":"XBA","symbol":"XBA","code_points":[88,66,65]},"XBB":{"currency":"XBB","name":"European monetary unit","cldr_symbol":"XBB","symbol":"XBB","code_points":[88,66,66]},"XBC":{"currency":"XBC","name":"European unit of account (XBC)","cldr_symbol":"XBC","symbol":"XBC","code_points":[88,66,67]},"XBD":{"currency":"XBD","name":"European unit of account (XBD)","cldr_symbol":"XBD","symbol":"XBD","code_points":[88,66,68]},"XCD":{"currency":"XCD","name":"East Caribbean dollar","cldr_symbol":"EC$","symbol":"$","code_points":[36]},"XDR":{"currency":"XDR","name":"special drawing rights","cldr_symbol":"XDR","symbol":"XDR","code_points":[88,68,82]},"XEU":{"currency":"XEU","name":"European currency unit","cldr_symbol":"XEU","symbol":"XEU","code_points":[88,69,85]},"XFO":{"currency":"XFO","name":"French gold franc","cldr_symbol":"XFO","symbol":"XFO","code_points":[88,70,79]},"XFU":{"currency":"XFU","name":"French UIC-franc","cldr_symbol":"XFU","symbol":"XFU","code_points":[88,70,85]},"XOF":{"currency":"XOF","name":"CFA franc BCEAO","cldr_symbol":"CFA","symbol":"CFA","code_points":[67,70,65]},"XPD":{"currency":"XPD","name":"troy ounce of palladium","cldr_symbol":"XPD","symbol":"XPD","code_points":[88,80,68]},"XPF":{"currency":"XPF","name":"CFP franc","cldr_symbol":"CFPF","symbol":"CFPF","code_points":[67,70,80,70]},"XPT":{"currency":"XPT","name":"troy ounce of platinum","cldr_symbol":"XPT","symbol":"XPT","code_points":[88,80,84]},"XRE":{"currency":"XRE","name":"RINET Funds unit","cldr_symbol":"XRE","symbol":"XRE","code_points":[88,82,69]},"XSU":{"currency":"XSU","name":"Sucre","cldr_symbol":"XSU","symbol":"XSU","code_points":[88,83,85]},"XTS":{"currency":"XTS","name":"Testing Currency unit","cldr_symbol":"XTS","symbol":"XTS","code_points":[88,84,83]},"XUA":{"currency":"XUA","name":"ADB unit of account","cldr_symbol":"XUA","symbol":"XUA","code_points":[88,85,65]},"XXX":{"currency":"XXX","name":"(unknown unit of currency)","cldr_symbol":"XXX","symbol":"XXX","code_points":[88,88,88]},"YDD":{"currency":"YDD","name":"Yemeni dinar","cldr_symbol":"YDD","symbol":"YDD","code_points":[89,68,68]},"YER":{"currency":"YER","name":"Yemeni rial","cldr_symbol":"YER","symbol":"﷼","code_points":[65020]},"YUD":{"currency":"YUD","name":"Yugoslavian hard dinar (1966–1990)","cldr_symbol":"YUD","symbol":"YUD","code_points":[89,85,68]},"YUM":{"currency":"YUM","name":"Yugoslavian new dinar (1994–2002)","cldr_symbol":"YUM","symbol":"YUM","code_points":[89,85,77]},"YUN":{"currency":"YUN","name":"Yugoslavian convertible dinar (1990–1992)","cldr_symbol":"YUN","symbol":"YUN","code_points":[89,85,78]},"YUR":{"currency":"YUR","name":"Yugoslavian reformed dinar (1992–1993)","cldr_symbol":"YUR","symbol":"YUR","code_points":[89,85,82]},"ZAL":{"currency":"ZAL","name":"South African rand (financial)","cldr_symbol":"ZAL","symbol":"ZAL","code_points":[90,65,76]},"ZAR":{"currency":"ZAR","name":"South African rand","cldr_symbol":"ZAR","symbol":"R","code_points":[82]},"ZMK":{"currency":"ZMK","name":"Zambian kwacha (1968–2012)","cldr_symbol":"ZMK","symbol":"ZMK","code_points":[90,77,75]},"ZMW":{"currency":"ZMW","name":"Zambian kwacha","cldr_symbol":"ZMW","symbol":"ZMW","code_points":[90,77,87]},"ZRN":{"currency":"ZRN","name":"Zairean new zaire (1993–1998)","cldr_symbol":"ZRN","symbol":"ZRN","code_points":[90,82,78]},"ZRZ":{"currency":"ZRZ","name":"Zairean zaire (1971–1993)","cldr_symbol":"ZRZ","symbol":"ZRZ","code_points":[90,82,90]},"ZWD":{"currency":"ZWD","name":"Zimbabwean dollar (1980–2008)","cldr_symbol":"ZWD","symbol":"Z$","code_points":[90,36]},"ZWL":{"currency":"ZWL","name":"Zimbabwean dollar (2009)","cldr_symbol":"ZWL","symbol":"ZWL","code_points":[90,87,76]},"ZWR":{"currency":"ZWR","name":"Zimbabwean dollar (2008)","cldr_symbol":"ZWR","symbol":"ZWR","code_points":[90,87,82]}};
|
1239
|
+
|
1240
|
+
Currencies.currency_codes = function() {
|
1241
|
+
var data, _;
|
1242
|
+
return this.codes || (this.codes = (function() {
|
1243
|
+
var _ref, _results;
|
1244
|
+
_ref = this.currencies;
|
1245
|
+
_results = [];
|
1246
|
+
for (_ in _ref) {
|
1247
|
+
data = _ref[_];
|
1248
|
+
_results.push(data.code);
|
1249
|
+
}
|
1250
|
+
return _results;
|
1251
|
+
}).call(this));
|
1252
|
+
};
|
1253
|
+
|
1254
|
+
Currencies.for_code = function(currency_code) {
|
1255
|
+
var country_name, data, result, _ref;
|
1256
|
+
result = null;
|
1257
|
+
_ref = this.currencies;
|
1258
|
+
for (country_name in _ref) {
|
1259
|
+
data = _ref[country_name];
|
1260
|
+
if (data.currency === currency_code) {
|
1261
|
+
result = {
|
1262
|
+
country: country_name,
|
1263
|
+
cldr_symbol: data.cldr_symbol,
|
1264
|
+
symbol: data.symbol,
|
1265
|
+
currency: data.currency
|
1266
|
+
};
|
1267
|
+
break;
|
1268
|
+
}
|
1269
|
+
}
|
1270
|
+
return result;
|
1271
|
+
};
|
1272
|
+
|
1273
|
+
return Currencies;
|
1274
|
+
|
1275
|
+
})();
|
1276
|
+
|
1277
|
+
TwitterCldr.ListFormatter = (function() {
|
1278
|
+
function ListFormatter(options) {
|
1279
|
+
if (options == null) {
|
1280
|
+
options = {};
|
1281
|
+
}
|
1282
|
+
this.formats = {"2":"{0} y {1}","end":"{0} y {1}","middle":"{0}, {1}","start":"{0}, {1}"};
|
1283
|
+
}
|
1284
|
+
|
1285
|
+
ListFormatter.prototype.format = function(list) {
|
1286
|
+
if (this.formats[list.length.toString()] != null) {
|
1287
|
+
return this.compose(this.formats[list.length.toString()], list);
|
1288
|
+
} else {
|
1289
|
+
return this.compose_list(list);
|
1290
|
+
}
|
1291
|
+
};
|
1292
|
+
|
1293
|
+
ListFormatter.prototype.compose_list = function(list) {
|
1294
|
+
var format_key, i, result, _i, _ref;
|
1295
|
+
result = this.compose(this.formats.end || this.formats.middle || "", [list[list.length - 2], list[list.length - 1]]);
|
1296
|
+
if (list.length > 2) {
|
1297
|
+
for (i = _i = 3, _ref = list.length; 3 <= _ref ? _i <= _ref : _i >= _ref; i = 3 <= _ref ? ++_i : --_i) {
|
1298
|
+
format_key = i === list.length ? "start" : "middle";
|
1299
|
+
if (this.formats[format_key] == null) {
|
1300
|
+
format_key = "middle";
|
1301
|
+
}
|
1302
|
+
result = this.compose(this.formats[format_key] || "", [list[list.length - i], result]);
|
1303
|
+
}
|
1304
|
+
}
|
1305
|
+
return result;
|
1306
|
+
};
|
1307
|
+
|
1308
|
+
ListFormatter.prototype.compose = function(format, elements) {
|
1309
|
+
var element, result;
|
1310
|
+
elements = (function() {
|
1311
|
+
var _i, _len, _results;
|
1312
|
+
_results = [];
|
1313
|
+
for (_i = 0, _len = elements.length; _i < _len; _i++) {
|
1314
|
+
element = elements[_i];
|
1315
|
+
if (element != null) {
|
1316
|
+
_results.push(element);
|
1317
|
+
}
|
1318
|
+
}
|
1319
|
+
return _results;
|
1320
|
+
})();
|
1321
|
+
if (elements.length > 1) {
|
1322
|
+
result = format.replace(/\{(\d+)\}/g, '$1');
|
1323
|
+
if (TwitterCldr.is_rtl) {
|
1324
|
+
result = TwitterCldr.Bidi.from_string(result, {
|
1325
|
+
"direction": "RTL"
|
1326
|
+
}).reorder_visually().toString();
|
1327
|
+
}
|
1328
|
+
return result.replace(/(\d+)/g, function(match) {
|
1329
|
+
return elements[parseInt(match)];
|
1330
|
+
});
|
1331
|
+
} else {
|
1332
|
+
return elements[0] || "";
|
1333
|
+
}
|
1334
|
+
};
|
1335
|
+
|
1336
|
+
return ListFormatter;
|
1337
|
+
|
1338
|
+
})();
|
1339
|
+
|
1340
|
+
TwitterCldr.Bidi = (function() {
|
1341
|
+
var MAX_DEPTH;
|
1342
|
+
|
1343
|
+
MAX_DEPTH = 62;
|
1344
|
+
|
1345
|
+
function Bidi(options) {
|
1346
|
+
if (options == null) {
|
1347
|
+
options = {};
|
1348
|
+
}
|
1349
|
+
this.bidi_classes = {"BN":{"8":[0],"13":[14],"5":[127,8298],"25":[134],"0":[173,65279,917505],"2":[8203],"4":[8288],"7":[119155],"95":[917536]},"S":{"0":[9,11,31]},"B":{"0":[10,13,133,8233],"2":[28]},"WS":{"0":[12,32,5760,6158,8232,8287,12288],"10":[8192]},"ON":{"1":[33,171,174,697,884,900,1542,1550,5787,6468,8189,8448,8456,8506,12342,12443,12829,13278,42622,64830,65120,65281,126704,127338],"4":[38,187,8512,65286,65529,127942],"5":[59,91,3059,8478,11493,65307,65339,127792],"3":[123,166,2038,3898,8451,8522,12289,13004,13175,43048,43124,128249,128320],"0":[161,180,215,247,894,903,1014,1418,1758,1769,3066,5120,6464,8125,8468,8485,8487,8489,8585,12336,12448,12539,13311,42611,42888,65021,65105,65108,65128,65131,65793,67871,119365,120539,120597,120655,120713,120771,128064],"2":[182,8127,8141,8157,8173,8316,8332,8470,12349,12924,42509,65124,65506],"13":[706,722,127153],"8":[741,65110],"16":[751,127968],"6":[3192,11513,65512,68409],"9":[5008,6128,11088,65040],"10":[6144,9280,65371,128581],"33":[6622,42752],"23":[8208,128336],"14":[8245,12977,127136,127169,127185],"25":[8261,9083,11904],"15":[8528,12880],"129":[8592],"289":[8724],"93":[9110],"38":[9216],"39":[9312],"449":[9450],"82":[9901],"254":[9985],"588":[10496],"59":[11776],"88":[11931],"213":[12032],"11":[12272,65936],"24":[12296],"35":[12736],"63":[19904],"54":[42128],"31":[65072],"74":[65856],"19":[69714,127872],"65":[119296],"86":[119552],"43":[126976],"99":[127024],"32":[127744],"69":[127799,128507,128640],"36":[127904],"62":[128000],"181":[128066],"61":[128256],"115":[128768]},"ET":{"2":[35,65283],"3":[162],"1":[176,1545,2546,43064,65129,65504,65509],"0":[1423,1642,2555,2801,3065,3647,6107,8494,8723,65119],"4":[8240],"25":[8352]},"ES":{"0":[43,45,8722,64297,65291,65293],"1":[8314,8330,65122]},"CS":{"0":[44,58,160,1548,8239,8260,65104,65106,65109,65292,65306],"1":[46,65294]},"EN":{"9":[48,1776,8320,65296],"1":[178],"0":[185,8304],"5":[8308],"19":[9352],"49":[120782],"10":[127232]},"L":{"25":[65,97,5761,6576,65313,65345,65549],"0":[170,181,186,750,902,908,1417,2363,2482,2510,2519,2563,2654,2691,2761,2768,2880,2903,2947,2972,3024,3031,3133,3199,3294,3406,3415,3517,3716,3722,3725,3749,3751,3773,3782,3894,3896,3967,3973,4145,4152,4295,4301,4696,4800,6070,6108,6314,6743,6753,6965,6971,7082,7143,7150,7379,7393,8025,8027,8029,8126,8206,8305,8319,8450,8455,8469,8484,8486,8488,9109,9900,11559,11565,43047,43597,43697,43712,43714,65792,65794,69632,69932,71340,71350,119970,119995,120134],"22":[192,3090,3218,6656,11648],"30":[216,8031,13280,66304,127248],"448":[248],"6":[699,1369,2425,2474,2548,2602,2730,2858,3449,3520,3648,3737,4688,4792,6100,8118,8134,8182,11680,11688,11696,11704,11712,11720,11728,11736,43808,43816,64256,69703,69819,119997,120086,120138],"1":[720,886,2434,2447,2503,2507,2524,2575,2610,2613,2616,2738,2763,2784,2818,2831,2866,2877,2887,2891,2908,2969,2974,2979,3006,3009,3160,3168,3202,3274,3285,3296,3313,3330,3424,3458,3634,3713,3719,3754,3762,4155,4227,5941,6087,6448,6755,7078,7154,7220,7413,8526,11506,11631,12334,43346,43444,43450,43486,43567,43571,43701,44006,65596,69815,71342,110592,119171,119966,119973,127568],"4":[736,2741,2869,3125,3253,3776,3976,6512,6973,8473,8517,12337,12344,43705,64275,120128],"3":[880,890,2365,2377,2486,2493,2649,2749,2962,3137,3389,3732,3757,3804,4186,4682,4698,4746,4786,4802,4882,5902,6435,7401,8144,8490,8508,11499,12540,42896,43015,44009,66336,74864,119977,120071,120123],"2":[904,2382,2527,2622,2674,2703,2911,2958,2984,3014,3018,3073,3086,3214,3270,3342,3398,3402,3535,3570,3745,5998,6441,6681,7146,8130,8178,12293,12445,43011,43584,65498],"19":[910,2404],"82":[931],"139":[1015],"157":[1162,66560],"37":[1329,7968,11520,43264],"38":[1377,119040],"54":[2307],"9":[2392,2662,3114,3174,3242,3302,3792,3902,6112,6160,6784,6800,8458,43000,43250,43600,44016,66720,69734,69872,70079,70096,71360],"7":[2437,2821,3077,3205,3261,3333,3544,4030,6078,7360,8016,43056,43588,43758,120077,120772],"21":[2451,2579,2707,2835],"11":[2534,2990,12992,43214,65536,119982],"5":[2565,2949,4039,4231,6451,6765,7406,7960,8008,8150,42738,42889,43777,43785,43793,65474,65482,65490],"8":[2693,3507,6979,7028,12321,65847,119146,127552],"10":[2790,6608,8495,42912,43471],"17":[2918,3461,5920,5952,119648],"12":[3046,3663,4046,4213,5888,5984,8160,8336,94099],"40":[3346,4704,6272,8544,12549,43520],"15":[3430,4193,4992],"23":[3482,3840,42624],"47":[3585,6916,7164,12832,43395,43648,119214],"26":[3866,6992,66352],"35":[3913,69891],"44":[4096,12784,65799,66000],"24":[4159,43020,43310,69840],"14":[4238,4808,7227,65599],"39":[4254,6470],"376":[4304],"32":[4752],"56":[4824,120540,120598,120656,120714],"66":[4888],"28":[4960,6400,66176,127462],"84":[5024,119808],"638":[5121],"80":[5792],"51":[6016,43072,70018],"87":[6176],"69":[6320],"43":[6528],"55":[6686,11568],"13":[6816,65616,66504,69942],"31":[7042,43612],"57":[7084,127280],"50":[7245,120488],"191":[7424],"277":[7680],"52":[8064],"68":[9014,93952],"77":[9372],"255":[10240],"46":[11264,11312,13008,42560,94032],"132":[11360],"85":[12353],"89":[12449],"93":[12593],"42":[12688,71296,127344,127504],"27":[12896,42512,120094],"49":[12927],"118":[13056],"98":[13179,74752],"6591":[13312],"22156":[19968],"316":[42192],"79":[42656],"101":[42786],"67":[43136],"29":[43359,66432,119180],"16":[43453,43739],"36":[43968,66463],"11206":[44032],"48":[55243,66208,69762],"8813":[55296],"105":[64112],"88":[65382],"18":[65576],"122":[65664],"53":[69634],"878":[73728],"1070":[77824],"568":[92160],"245":[118784],"61":[119081],"70":[119894],"64":[120005],"339":[120146],"42719":[131072],"4383":[173824],"541":[194560],"131071":[983040]},"NSM":{"111":[768],"6":[1155,1750,2385,3636,6071,6744,7394,65056,119173],"44":[1425],"0":[1471,1479,1648,1809,2362,2364,2381,2433,2492,2509,2620,2641,2677,2748,2765,2817,2876,2879,2893,2902,2946,3008,3021,3260,3405,3530,3542,3633,3761,3893,3895,3897,4038,4226,4237,4253,6086,6109,6313,6450,6742,6752,6754,6783,6964,6972,6978,7083,7142,7149,7405,7412,11647,42655,43010,43014,43019,43204,43443,43452,43587,43596,43696,43713,43766,44005,44008,44013,64286,66045,68159,69633,71339,71341,71351],"1":[1473,1476,1767,2402,2530,2561,2625,2631,2672,2689,2759,2786,2914,3157,3170,3276,3298,3426,3771,3864,3974,4153,4157,4184,4229,5970,6002,6068,6439,6679,7040,7080,7144,7222,12441,42736,43045,43569,43573,43703,43710,43756,68101,69760,69817,70016],"10":[1552,1958,3981,6089,43335],"20":[1611],"5":[1759,3764,3784,4146,43561,71344],"3":[1770,2070,2497,2881,3146,3393,4141,4209,6912,7074,7676,12330,42607,43446,68108,69811,94095,119210],"26":[1840,2276],"8":[2027,2075,7019,70070],"2":[2085,2137,2304,2635,3134,3142,3538,4190,4957,5906,5938,6155,6432,6457,7151,7376,11503,43392,43698,68097,68152,69888,119143,119362],"4":[2089,2753,3968,6966,69927],"7":[2369,3655,6757,7212,43302,69933,119163],"13":[3953],"35":[3993],"9":[6771,42612],"12":[7380],"38":[7616],"32":[8400],"31":[11744],"17":[43232],"15":[65024],"14":[69688],"239":[917760]},"R":{"0":[1470,1472,1475,1478,2042,2074,2084,2088,2142,8207,64285,64318,67592,67644,67903,68096],"26":[1488,68121,68440],"4":[1520,64312],"42":[1984],"1":[2036,64320,64323,67639,68030],"21":[2048,68416],"14":[2096],"24":[2112],"9":[64287,64326],"12":[64298],"5":[67584],"43":[67594],"22":[67647],"8":[67671,68176],"27":[67840],"25":[67872],"55":[67968],"3":[68112],"2":[68117],"7":[68160,68472],"31":[68192],"53":[68352],"72":[68608]},"AN":{"4":[1536],"9":[1632],"1":[1643],"0":[1757],"30":[69216]},"AL":{"0":[1544,1547,1549,1563,1969,2208,126500,126503,126521,126523,126530,126535,126537,126539,126548,126551,126553,126555,126557,126559,126564,126590],"44":[1566],"2":[1645,126541,126625],"100":[1649],"1":[1765,1774,1807,126497,126545,126561],"19":[1786],"29":[1810],"88":[1869],"10":[2210],"113":[64336],"362":[64467],"63":[64848],"53":[64914],"12":[65008],"4":[65136,126629],"134":[65142],"3":[126464,126516,126567,126580,126585],"26":[126469],"9":[126505,126592],"6":[126572],"16":[126603,126635]},"LRE":{"0":[8234]},"RLE":{"0":[8235]},"PDF":{"0":[8236]},"LRO":{"0":[8237]},"RLO":{"0":[8238]}};
|
1350
|
+
this.string_arr = options.string_arr || options.types;
|
1351
|
+
this.types = options.types || [];
|
1352
|
+
this.levels = [];
|
1353
|
+
this.runs = [];
|
1354
|
+
this.direction = options.direction;
|
1355
|
+
this.default_direction = options.default_direction || "LTR";
|
1356
|
+
this.length = this.types.length;
|
1357
|
+
this.run_bidi();
|
1358
|
+
}
|
1359
|
+
|
1360
|
+
Bidi.bidi_class_for = function(code_point) {
|
1361
|
+
var bidi_class, end, range, range_list, range_offset, ranges, start, _i, _len, _ref;
|
1362
|
+
_ref = this.bidi_classes;
|
1363
|
+
for (bidi_class in _ref) {
|
1364
|
+
ranges = _ref[bidi_class];
|
1365
|
+
for (range_offset in ranges) {
|
1366
|
+
range_list = ranges[range_offset];
|
1367
|
+
for (_i = 0, _len = range_list.length; _i < _len; _i++) {
|
1368
|
+
range = range_list[_i];
|
1369
|
+
start = range;
|
1370
|
+
end = start + parseInt(range_offset);
|
1371
|
+
if ((code_point >= start) && (code_point <= end)) {
|
1372
|
+
return bidi_class;
|
1373
|
+
}
|
1374
|
+
}
|
1375
|
+
}
|
1376
|
+
}
|
1377
|
+
return null;
|
1378
|
+
};
|
1379
|
+
|
1380
|
+
Bidi.from_string = function(str, options) {
|
1381
|
+
var string_arr;
|
1382
|
+
if (options == null) {
|
1383
|
+
options = {};
|
1384
|
+
}
|
1385
|
+
string_arr = TwitterCldr.Utilities.unpack_string(str);
|
1386
|
+
options.types || (options.types = this.compute_types(string_arr));
|
1387
|
+
options.string_arr || (options.string_arr = string_arr);
|
1388
|
+
return new TwitterCldr.Bidi(options);
|
1389
|
+
};
|
1390
|
+
|
1391
|
+
Bidi.from_type_array = function(types, options) {
|
1392
|
+
if (options == null) {
|
1393
|
+
options = {};
|
1394
|
+
}
|
1395
|
+
options.types || (options.types = types);
|
1396
|
+
return new TwitterCldr.Bidi(options);
|
1397
|
+
};
|
1398
|
+
|
1399
|
+
Bidi.compute_types = function(arr) {
|
1400
|
+
var code_point, _i, _len, _results;
|
1401
|
+
_results = [];
|
1402
|
+
for (_i = 0, _len = arr.length; _i < _len; _i++) {
|
1403
|
+
code_point = arr[_i];
|
1404
|
+
_results.push(TwitterCldr.Bidi.bidi_class_for(code_point));
|
1405
|
+
}
|
1406
|
+
return _results;
|
1407
|
+
};
|
1408
|
+
|
1409
|
+
Bidi.prototype.toString = function() {
|
1410
|
+
return TwitterCldr.Utilities.pack_array(this.string_arr);
|
1411
|
+
};
|
1412
|
+
|
1413
|
+
Bidi.prototype.reorder_visually = function() {
|
1414
|
+
var depth, finish, i, level, lowest_odd, max, start, tmpb, tmpo, _i, _j, _k, _len, _ref, _ref1;
|
1415
|
+
if (!this.string_arr) {
|
1416
|
+
throw "No string given!";
|
1417
|
+
}
|
1418
|
+
max = 0;
|
1419
|
+
lowest_odd = MAX_DEPTH + 1;
|
1420
|
+
_ref = this.levels;
|
1421
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1422
|
+
level = _ref[_i];
|
1423
|
+
max = TwitterCldr.Utilities.max([level, max]);
|
1424
|
+
if (!TwitterCldr.Utilities.is_even(level)) {
|
1425
|
+
lowest_odd = TwitterCldr.Utilities.min([lowest_odd, level]);
|
1426
|
+
}
|
1427
|
+
}
|
1428
|
+
for (depth = _j = max; max <= 0 ? _j < 0 : _j > 0; depth = max <= 0 ? ++_j : --_j) {
|
1429
|
+
start = 0;
|
1430
|
+
while (start < this.levels.length) {
|
1431
|
+
while (start < this.levels.length && this.levels[start] < depth) {
|
1432
|
+
start += 1;
|
1433
|
+
}
|
1434
|
+
if (start === this.levels.length) {
|
1435
|
+
break;
|
1436
|
+
}
|
1437
|
+
finish = start + 1;
|
1438
|
+
while (finish < this.levels.length && this.levels[finish] >= depth) {
|
1439
|
+
finish += 1;
|
1440
|
+
}
|
1441
|
+
for (i = _k = 0, _ref1 = (finish - start) / 2; 0 <= _ref1 ? _k < _ref1 : _k > _ref1; i = 0 <= _ref1 ? ++_k : --_k) {
|
1442
|
+
tmpb = this.levels[finish - i - 1];
|
1443
|
+
this.levels[finish - i - 1] = this.levels[start + i];
|
1444
|
+
this.levels[start + i] = tmpb;
|
1445
|
+
tmpo = this.string_arr[finish - i - 1];
|
1446
|
+
this.string_arr[finish - i - 1] = this.string_arr[start + i];
|
1447
|
+
this.string_arr[start + i] = tmpo;
|
1448
|
+
}
|
1449
|
+
start = finish + 1;
|
1450
|
+
}
|
1451
|
+
}
|
1452
|
+
return this;
|
1453
|
+
};
|
1454
|
+
|
1455
|
+
Bidi.prototype.compute_paragraph_embedding_level = function() {
|
1456
|
+
var type, _i, _len, _ref;
|
1457
|
+
if (["LTR", "RTL"].indexOf(this.direction) > -1) {
|
1458
|
+
if (this.direction === "LTR") {
|
1459
|
+
return 0;
|
1460
|
+
} else {
|
1461
|
+
return 1;
|
1462
|
+
}
|
1463
|
+
} else {
|
1464
|
+
_ref = this.types;
|
1465
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1466
|
+
type = _ref[_i];
|
1467
|
+
if (type === "L") {
|
1468
|
+
return 0;
|
1469
|
+
}
|
1470
|
+
if (type === "R") {
|
1471
|
+
return 1;
|
1472
|
+
}
|
1473
|
+
}
|
1474
|
+
if (this.default_direction === "LTR") {
|
1475
|
+
return 0;
|
1476
|
+
} else {
|
1477
|
+
return 1;
|
1478
|
+
}
|
1479
|
+
}
|
1480
|
+
};
|
1481
|
+
|
1482
|
+
Bidi.prototype.compute_explicit_levels = function() {
|
1483
|
+
var current_embedding, directional_override, embedding_stack, i, input, is_ltr, is_special, len, new_embedding, next_fmt, output, size, sp, _i, _j, _ref, _ref1;
|
1484
|
+
current_embedding = this.base_embedding;
|
1485
|
+
directional_override = -1;
|
1486
|
+
embedding_stack = [];
|
1487
|
+
this.formatter_indices || (this.formatter_indices = []);
|
1488
|
+
sp = 0;
|
1489
|
+
for (i = _i = 0, _ref = this.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
|
1490
|
+
is_ltr = false;
|
1491
|
+
is_special = true;
|
1492
|
+
is_ltr = this.types[i] === "LRE" || this.types[i] === "LRO";
|
1493
|
+
switch (this.types[i]) {
|
1494
|
+
case "RLE":
|
1495
|
+
case "RLO":
|
1496
|
+
case "LRE":
|
1497
|
+
case "LRO":
|
1498
|
+
new_embedding = is_ltr ? (current_embedding & ~1) + 2 : (current_embedding + 1) | 1;
|
1499
|
+
if (new_embedding < MAX_DEPTH) {
|
1500
|
+
if (directional_override !== -1) {
|
1501
|
+
current_embedding |= -0x80;
|
1502
|
+
}
|
1503
|
+
embedding_stack[sp] = current_embedding;
|
1504
|
+
current_embedding = new_embedding;
|
1505
|
+
sp += 1;
|
1506
|
+
directional_override = this.types[i] === "LRO" ? "L" : this.types[i] === "RLO" ? "R" : -1;
|
1507
|
+
}
|
1508
|
+
break;
|
1509
|
+
case "PDF":
|
1510
|
+
if (sp > 0) {
|
1511
|
+
sp -= 1;
|
1512
|
+
new_embedding = embedding_stack[sp];
|
1513
|
+
current_embedding = new_embedding & 0x7f;
|
1514
|
+
directional_override = new_embedding < 0 ? (_ref1 = (new_embedding & 1) === 0) != null ? _ref1 : {
|
1515
|
+
"L": "R"
|
1516
|
+
} : -1;
|
1517
|
+
}
|
1518
|
+
break;
|
1519
|
+
default:
|
1520
|
+
is_special = false;
|
1521
|
+
}
|
1522
|
+
this.levels[i] = current_embedding;
|
1523
|
+
if (is_special) {
|
1524
|
+
this.formatter_indices.push(i);
|
1525
|
+
} else if (directional_override !== -1) {
|
1526
|
+
this.types[i] = directional_override;
|
1527
|
+
}
|
1528
|
+
}
|
1529
|
+
output = 0;
|
1530
|
+
input = 0;
|
1531
|
+
size = this.formatter_indices.length;
|
1532
|
+
for (i = _j = 0; 0 <= size ? _j <= size : _j >= size; i = 0 <= size ? ++_j : --_j) {
|
1533
|
+
next_fmt = i === size ? this.length : this.formatter_indices[i];
|
1534
|
+
len = next_fmt - input;
|
1535
|
+
TwitterCldr.Utilities.arraycopy(this.levels, input, this.levels, output, len);
|
1536
|
+
TwitterCldr.Utilities.arraycopy(this.types, input, this.types, output, len);
|
1537
|
+
output += len;
|
1538
|
+
input = next_fmt + 1;
|
1539
|
+
}
|
1540
|
+
return this.length -= this.formatter_indices.length;
|
1541
|
+
};
|
1542
|
+
|
1543
|
+
Bidi.prototype.compute_runs = function() {
|
1544
|
+
var current_embedding, i, last_run_start, run_count, where, _i, _j, _ref, _ref1;
|
1545
|
+
run_count = 0;
|
1546
|
+
current_embedding = this.base_embedding;
|
1547
|
+
for (i = _i = 0, _ref = this.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
|
1548
|
+
if (this.levels[i] !== current_embedding) {
|
1549
|
+
current_embedding = this.levels[i];
|
1550
|
+
run_count += 1;
|
1551
|
+
}
|
1552
|
+
}
|
1553
|
+
where = 0;
|
1554
|
+
last_run_start = 0;
|
1555
|
+
current_embedding = this.base_embedding;
|
1556
|
+
for (i = _j = 0, _ref1 = this.length; 0 <= _ref1 ? _j < _ref1 : _j > _ref1; i = 0 <= _ref1 ? ++_j : --_j) {
|
1557
|
+
if (this.levels[i] !== current_embedding) {
|
1558
|
+
this.runs[where] = last_run_start;
|
1559
|
+
where += 1;
|
1560
|
+
last_run_start = i;
|
1561
|
+
current_embedding = this.levels[i];
|
1562
|
+
}
|
1563
|
+
}
|
1564
|
+
return this.runs[where] = last_run_start;
|
1565
|
+
};
|
1566
|
+
|
1567
|
+
Bidi.prototype.resolve_weak_types = function() {
|
1568
|
+
var eor, finish, i, j, k, level, next_level, next_type, prev_strong_type, prev_type, previous_level, run_count, run_idx, sor, start, _i, _j, _k;
|
1569
|
+
run_count = this.runs.length;
|
1570
|
+
previous_level = this.base_embedding;
|
1571
|
+
for (run_idx = _i = 0; 0 <= run_count ? _i < run_count : _i > run_count; run_idx = 0 <= run_count ? ++_i : --_i) {
|
1572
|
+
start = this.get_run_start(run_idx);
|
1573
|
+
finish = this.get_run_limit(run_idx);
|
1574
|
+
level = this.get_run_level(run_idx) || 0;
|
1575
|
+
sor = TwitterCldr.Utilities.is_even(TwitterCldr.Utilities.max([previous_level, level])) ? "L" : "R";
|
1576
|
+
next_level = run_idx === (run_count - 1) ? this.base_embedding : this.get_run_level(run_idx + 1) || 0;
|
1577
|
+
eor = TwitterCldr.Utilities.is_even(TwitterCldr.Utilities.max([level, next_level])) ? "L" : "R";
|
1578
|
+
prev_type = sor;
|
1579
|
+
prev_strong_type = sor;
|
1580
|
+
for (i = _j = start; start <= finish ? _j < finish : _j > finish; i = start <= finish ? ++_j : --_j) {
|
1581
|
+
next_type = i === (finish - 1) ? eor : this.types[i + 1];
|
1582
|
+
if (this.types[i] === "NSM") {
|
1583
|
+
this.types[i] = prev_type;
|
1584
|
+
} else {
|
1585
|
+
prev_type = this.types[i];
|
1586
|
+
}
|
1587
|
+
if (this.types[i] === "EN") {
|
1588
|
+
if (prev_strong_type === "AL") {
|
1589
|
+
this.types[i] = "AN";
|
1590
|
+
}
|
1591
|
+
} else if (this.types[i] === "L" || this.types[i] === "R" || this.types[i] === "AL") {
|
1592
|
+
prev_strong_type = this.types[i];
|
1593
|
+
}
|
1594
|
+
if (this.types[i] === "AL") {
|
1595
|
+
this.types[i] = "R";
|
1596
|
+
}
|
1597
|
+
if (prev_type === "EN" && next_type === "EN") {
|
1598
|
+
if (this.types[i] === "ES" || this.types[i] === "CS") {
|
1599
|
+
this.types[i] = nextType;
|
1600
|
+
}
|
1601
|
+
} else if (prev_type === "AN" && next_type === "AN" && this.types[i] === "CS") {
|
1602
|
+
this.types[i] = next_type;
|
1603
|
+
}
|
1604
|
+
if (this.types[i] === "ET" || this.types[i] === "BN") {
|
1605
|
+
if (prev_type === "EN") {
|
1606
|
+
this.types[i] = prev_type;
|
1607
|
+
} else {
|
1608
|
+
j = i + 1;
|
1609
|
+
while (j < finish && this.types[j] === "ET" || this.types[j] === "BN") {
|
1610
|
+
j += 1;
|
1611
|
+
}
|
1612
|
+
if (j < finish && this.types[j] === "EN") {
|
1613
|
+
for (k = _k = i; i <= j ? _k < j : _k > j; k = i <= j ? ++_k : --_k) {
|
1614
|
+
this.types[k] = "EN";
|
1615
|
+
}
|
1616
|
+
}
|
1617
|
+
}
|
1618
|
+
}
|
1619
|
+
if (this.types[i] === "ET" || this.types[i] === "CS" || this.types[i] === "BN") {
|
1620
|
+
this.types[i] = "ON";
|
1621
|
+
}
|
1622
|
+
if (prev_strong_type === "L" && this.types[i] === "EN") {
|
1623
|
+
this.types[i] = prev_strong_type;
|
1624
|
+
}
|
1625
|
+
}
|
1626
|
+
previous_level = level;
|
1627
|
+
}
|
1628
|
+
};
|
1629
|
+
|
1630
|
+
Bidi.prototype.get_run_count = function() {
|
1631
|
+
return this.runs.length;
|
1632
|
+
};
|
1633
|
+
|
1634
|
+
Bidi.prototype.get_run_level = function(which) {
|
1635
|
+
return this.levels[this.runs[which]];
|
1636
|
+
};
|
1637
|
+
|
1638
|
+
Bidi.prototype.get_run_limit = function(which) {
|
1639
|
+
if (which === (this.runs.length - 1)) {
|
1640
|
+
return this.length;
|
1641
|
+
} else {
|
1642
|
+
return this.runs[which + 1];
|
1643
|
+
}
|
1644
|
+
};
|
1645
|
+
|
1646
|
+
Bidi.prototype.get_run_start = function(which) {
|
1647
|
+
return this.runs[which];
|
1648
|
+
};
|
1649
|
+
|
1650
|
+
Bidi.prototype.resolve_implicit_levels = function() {
|
1651
|
+
var i, _i, _ref;
|
1652
|
+
for (i = _i = 0, _ref = this.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
|
1653
|
+
if ((this.levels[i] & 1) === 0) {
|
1654
|
+
if (this.types[i] === "R") {
|
1655
|
+
this.levels[i] += 1;
|
1656
|
+
} else if (this.types[i] === "AN" || this.types[i] === "EN") {
|
1657
|
+
this.levels[i] += 2;
|
1658
|
+
}
|
1659
|
+
} else {
|
1660
|
+
if (this.types[i] === "L" || this.types[i] === "AN" || this.types[i] === "EN") {
|
1661
|
+
this.levels[i] += 1;
|
1662
|
+
}
|
1663
|
+
}
|
1664
|
+
}
|
1665
|
+
};
|
1666
|
+
|
1667
|
+
Bidi.prototype.resolve_neutral_types = function() {
|
1668
|
+
var embedding_direction, eor, finish, i, j, level, neutral_start, new_strong, next_level, override, prev_strong, previous_level, run, run_count, sor, start, this_type, _i, _j, _k;
|
1669
|
+
run_count = this.get_run_count();
|
1670
|
+
previous_level = this.base_embedding;
|
1671
|
+
for (run = _i = 0; 0 <= run_count ? _i < run_count : _i > run_count; run = 0 <= run_count ? ++_i : --_i) {
|
1672
|
+
start = this.get_run_start(run);
|
1673
|
+
finish = this.get_run_limit(run);
|
1674
|
+
level = this.get_run_level(run);
|
1675
|
+
if (level == null) {
|
1676
|
+
continue;
|
1677
|
+
}
|
1678
|
+
embedding_direction = TwitterCldr.Utilities.is_even(level) ? "L" : "R";
|
1679
|
+
sor = TwitterCldr.Utilities.is_even(TwitterCldr.Utilities.max([previous_level, level])) ? "L" : "R";
|
1680
|
+
next_level = run === (run_count - 1) ? this.base_embedding : this.get_run_level(run + 1);
|
1681
|
+
eor = TwitterCldr.Utilities.is_even(TwitterCldr.Utilities.max([level, next_level])) ? "L" : "R";
|
1682
|
+
prev_strong = sor;
|
1683
|
+
neutral_start = -1;
|
1684
|
+
for (i = _j = start; start <= finish ? _j <= finish : _j >= finish; i = start <= finish ? ++_j : --_j) {
|
1685
|
+
new_strong = -1;
|
1686
|
+
this_type = i === finish ? eor : this.types[i];
|
1687
|
+
switch (this_type) {
|
1688
|
+
case "L":
|
1689
|
+
new_strong = "L";
|
1690
|
+
break;
|
1691
|
+
case "R":
|
1692
|
+
case "AN":
|
1693
|
+
case "EN":
|
1694
|
+
new_strong = "R";
|
1695
|
+
break;
|
1696
|
+
case "BN":
|
1697
|
+
case "ON":
|
1698
|
+
case "S":
|
1699
|
+
case "B":
|
1700
|
+
case "WS":
|
1701
|
+
if (neutral_start === -1) {
|
1702
|
+
neutral_start = i;
|
1703
|
+
}
|
1704
|
+
}
|
1705
|
+
if (new_strong !== -1) {
|
1706
|
+
if (neutral_start !== -1) {
|
1707
|
+
override = prev_strong === new_strong ? prev_strong : embedding_direction;
|
1708
|
+
for (j = _k = neutral_start; neutral_start <= i ? _k < i : _k > i; j = neutral_start <= i ? ++_k : --_k) {
|
1709
|
+
this.types[j] = override;
|
1710
|
+
}
|
1711
|
+
}
|
1712
|
+
prev_strong = new_strong;
|
1713
|
+
neutral_start = -1;
|
1714
|
+
}
|
1715
|
+
}
|
1716
|
+
previous_level = level;
|
1717
|
+
}
|
1718
|
+
};
|
1719
|
+
|
1720
|
+
Bidi.prototype.reinsert_formatting_codes = function() {
|
1721
|
+
var index, input, left_level, len, next_fmt, output, right_level, _i, _ref;
|
1722
|
+
if ((this.formatter_indices != null) && this.formatter_indices.length > 0) {
|
1723
|
+
input = this.length;
|
1724
|
+
output = this.levels.length;
|
1725
|
+
for (index = _i = _ref = this.formatter_indices.length - 1; _ref <= 0 ? _i <= 0 : _i >= 0; index = _ref <= 0 ? ++_i : --_i) {
|
1726
|
+
next_fmt = this.formatter_indices[index];
|
1727
|
+
len = output - next_fmt - 1;
|
1728
|
+
output = next_fmt;
|
1729
|
+
input -= len;
|
1730
|
+
if (next_fmt + 1 < this.levels.length) {
|
1731
|
+
TwitterCldr.Utilities.arraycopy(this.levels, input, this.levels, next_fmt + 1, len);
|
1732
|
+
}
|
1733
|
+
right_level = output === this.levels.length - 1 ? this.base_embedding : this.levels[output + 1] != null ? this.levels[output + 1] : 0;
|
1734
|
+
left_level = input === 0 ? this.base_embedding : this.levels[input] != null ? this.levels[input] : 0;
|
1735
|
+
this.levels[output] = TwitterCldr.Utilities.max([left_level, right_level]);
|
1736
|
+
}
|
1737
|
+
}
|
1738
|
+
return this.length = this.levels.length;
|
1739
|
+
};
|
1740
|
+
|
1741
|
+
Bidi.prototype.run_bidi = function() {
|
1742
|
+
this.base_embedding = this.compute_paragraph_embedding_level();
|
1743
|
+
this.compute_explicit_levels();
|
1744
|
+
this.compute_runs();
|
1745
|
+
this.resolve_weak_types();
|
1746
|
+
this.resolve_neutral_types();
|
1747
|
+
this.resolve_implicit_levels();
|
1748
|
+
this.reinsert_formatting_codes();
|
1749
|
+
this.compute_runs();
|
1750
|
+
};
|
1751
|
+
|
1752
|
+
return Bidi;
|
1753
|
+
|
1754
|
+
})();
|
1755
|
+
|
1756
|
+
TwitterCldr.Calendar = (function() {
|
1757
|
+
var REDIRECT_PREFIX;
|
1758
|
+
|
1759
|
+
function Calendar() {}
|
1760
|
+
|
1761
|
+
REDIRECT_PREFIX = "calendars.gregorian.";
|
1762
|
+
|
1763
|
+
Calendar.calendar = {"additional_formats":{"EHm":"E, H:mm","EHms":"E, H:mm:ss","Ed":"E d","Ehm":"E, h:mm a","Ehms":"E, h:mm:ss a","Gy":"y G","GyMMM":"MMM 'de' y G","GyMMMEd":"E, d 'de' MMMM 'de' y G","GyMMMd":"d MMM 'de' y G","H":"H","Hm":"H:mm","Hms":"H:mm:ss","M":"L","MEd":"E, d/M","MMM":"LLL","MMMEd":"E d 'de' MMM","MMMMd":"d 'de' MMMM","MMMd":"d 'de' MMM","MMMdd":"dd-MMM","MMd":"d/M","MMdd":"d/M","Md":"d/M","d":"d","h":"h a","hm":"h:mm a","hms":"h:mm:ss a","ms":"mm:ss","y":"y","yM":"M/y","yMEd":"E d/M/y","yMM":"M/y","yMMM":"MMM 'de' y","yMMMEd":"EEE, d 'de' MMMM 'de' y","yMMMM":"MMMM 'de' y","yMMMd":"d 'de' MMM 'de' y","yMd":"d/M/y","yQQQ":"QQQ y","yQQQQ":"QQQQ 'de' y"},"days":{"format":{"abbreviated":{"fri":"vie.","mon":"lun.","sat":"sáb.","sun":"dom.","thu":"jue.","tue":"mar.","wed":"mié."},"narrow":{"fri":"V","mon":"L","sat":"S","sun":"D","thu":"J","tue":"M","wed":"X"},"short":{"fri":"VI","mon":"LU","sat":"SA","sun":"DO","thu":"JU","tue":"MA","wed":"MI"},"wide":{"fri":"viernes","mon":"lunes","sat":"sábado","sun":"domingo","thu":"jueves","tue":"martes","wed":"miércoles"}},"stand-alone":{"abbreviated":{"fri":"Vie.","mon":"Lun.","sat":"Sáb.","sun":"Dom.","thu":"Jue.","tue":"Mar.","wed":"Mié."},"narrow":{"fri":"V","mon":"L","sat":"S","sun":"D","thu":"J","tue":"M","wed":"M"},"short":{"fri":"VI","mon":"LU","sat":"SA","sun":"DO","thu":"JU","tue":"MA","wed":"MI"},"wide":{"fri":"Viernes","mon":"Lunes","sat":"Sábado","sun":"Domingo","thu":"Jueves","tue":"Martes","wed":"Miércoles"}}},"eras":{"abbr":{"0":"a. e. c.","1":"e. c."},"name":{"0":"antes de Cristo","1":"anno Dómini"},"narrow":{"0":"B","1":"A"}},"fields":{"day":"día","dayperiod":"periodo del día","era":"era","hour":"hora","minute":"minuto","month":"mes","second":"segundo","week":"semana","weekday":"día de la semana","year":"año","zone":"zona horaria"},"formats":{"date":{"full":{"pattern":"EEEE, d 'de' MMMM 'de' y"},"long":{"pattern":"d 'de' MMMM 'de' y"},"medium":{"pattern":"d/M/y"},"short":{"pattern":"d/M/yy"}},"datetime":{"full":{"pattern":"{{date}}, {{time}}"},"long":{"pattern":"{{date}}, {{time}}"},"medium":{"pattern":"{{date}} {{time}}"},"short":{"pattern":"{{date}} {{time}}"}},"time":{"full":{"pattern":"H:mm:ss (zzzz)"},"long":{"pattern":"H:mm:ss z"},"medium":{"pattern":"H:mm:ss"},"short":{"pattern":"H:mm"}}},"months":{"format":{"abbreviated":{"1":"ene.","10":"oct.","11":"nov.","12":"dic.","2":"feb.","3":"mar.","4":"abr.","5":"may.","6":"jun.","7":"jul.","8":"ago.","9":"sept."},"narrow":{"1":"E","10":"O","11":"N","12":"D","2":"F","3":"M","4":"A","5":"M","6":"J","7":"J","8":"A","9":"S"},"wide":{"1":"enero","10":"octubre","11":"noviembre","12":"diciembre","2":"febrero","3":"marzo","4":"abril","5":"mayo","6":"junio","7":"julio","8":"agosto","9":"septiembre"}},"stand-alone":{"abbreviated":{"1":"Ene.","10":"Oct.","11":"Nov.","12":"Dic.","2":"Feb.","3":"Mar.","4":"Abr.","5":"May.","6":"Jun.","7":"Jul.","8":"Ago.","9":"Sept."},"narrow":{"1":"E","10":"O","11":"N","12":"D","2":"F","3":"M","4":"A","5":"M","6":"J","7":"J","8":"A","9":"S"},"wide":{"1":"Enero","10":"Octubre","11":"Noviembre","12":"Diciembre","2":"Febrero","3":"Marzo","4":"Abril","5":"Mayo","6":"Junio","7":"Julio","8":"Agosto","9":"Septiembre"}}},"periods":{"format":{"abbreviated":"calendars.gregorian.dayPeriods.format.wide","narrow":{"am":"a.m.","noon":"n","pm":"p.m."},"wide":{"am":"a. m.","noon":"noon","pm":"p. m.","variant":{"am":"a.m.","pm":"p.m."}}},"stand-alone":{}},"quarters":{"format":{"abbreviated":{"1":"T1","2":"T2","3":"T3","4":"T4"},"narrow":{"1":1,"2":2,"3":3,"4":4},"wide":{"1":"1.er trimestre","2":"2.º trimestre","3":"3.er trimestre","4":"4.º trimestre"}},"stand-alone":{"abbreviated":{"1":"T1","2":"T2","3":"T3","4":"T4"},"narrow":{"1":"1T","2":"2T","3":"3T","4":"4T"},"wide":{"1":"1.er trimestre","2":"2.º trimestre","3":"3.er trimestre","4":"4.º trimestre"}}}};
|
1764
|
+
|
1765
|
+
Calendar.months = function(options) {
|
1766
|
+
var key, result, root, val;
|
1767
|
+
if (options == null) {
|
1768
|
+
options = {};
|
1769
|
+
}
|
1770
|
+
root = this.get_root("months", options);
|
1771
|
+
result = [];
|
1772
|
+
for (key in root) {
|
1773
|
+
val = root[key];
|
1774
|
+
result[parseInt(key) - 1] = val;
|
1775
|
+
}
|
1776
|
+
return result;
|
1777
|
+
};
|
1778
|
+
|
1779
|
+
Calendar.weekdays = function(options) {
|
1780
|
+
if (options == null) {
|
1781
|
+
options = {};
|
1782
|
+
}
|
1783
|
+
return this.get_root("days", options);
|
1784
|
+
};
|
1785
|
+
|
1786
|
+
Calendar.get_root = function(key, options) {
|
1787
|
+
var data, format, names_form, root, _ref, _ref1, _ref2, _ref3;
|
1788
|
+
if (options == null) {
|
1789
|
+
options = {};
|
1790
|
+
}
|
1791
|
+
root = this.calendar[key];
|
1792
|
+
names_form = options["names_form"] || "wide";
|
1793
|
+
format = options.format || ((root != null ? (_ref = root["stand-alone"]) != null ? _ref[names_form] : void 0 : void 0) != null ? "stand-alone" : "format");
|
1794
|
+
data = root[format][names_form];
|
1795
|
+
if (typeof data === "string" && data.indexOf(REDIRECT_PREFIX) === 0) {
|
1796
|
+
_ref1 = data.slice(REDIRECT_PREFIX.length).split("."), key = _ref1[0], format = _ref1[1], names_form = _ref1[2];
|
1797
|
+
return ((_ref2 = this.calendar[key]) != null ? (_ref3 = _ref2[format]) != null ? _ref3[names_form] : void 0 : void 0) || (function() {
|
1798
|
+
throw "invalid redirect " + data;
|
1799
|
+
})();
|
1800
|
+
} else {
|
1801
|
+
return data;
|
1802
|
+
}
|
1803
|
+
};
|
1804
|
+
|
1805
|
+
return Calendar;
|
1806
|
+
|
1807
|
+
})();
|
1808
|
+
|
1809
|
+
TwitterCldr.PhoneCodes = (function() {
|
1810
|
+
function PhoneCodes() {}
|
1811
|
+
|
1812
|
+
PhoneCodes.phone_codes = {"ac":"247","ad":"376","ae":"971","af":"93","ag":"1","ai":"1","al":"355","am":"374","ao":"244","aq":"672","ar":"54","as":"1","at":"43","au":"61","aw":"297","ax":"358","az":"994","ba":"387","bb":"1","bd":"880","be":"32","bf":"226","bg":"359","bh":"973","bi":"257","bj":"229","bl":"590","bm":"1","bn":"673","bo":"591","bq":"599","br":"55","bs":"1","bt":"975","bw":"267","by":"375","bz":"501","ca":"1","cc":"61","cd":"243","cf":"236","cg":"242","ch":"41","ci":"225","ck":"682","cl":"56","cm":"237","cn":"86","co":"57","cr":"506","cu":"53","cv":"238","cw":"599","cx":"61","cy":"357","cz":"420","de":"49","dj":"253","dk":"45","dm":"1","do":"1","dz":"213","ec":"593","ee":"372","eg":"20","eh":"212","er":"291","es":"34","et":"251","fi":"358","fj":"679","fk":"500","fm":"691","fo":"298","fr":"33","ga":"241","gb":"44","gd":"1","ge":"995","gf":"594","gg":"44","gh":"233","gi":"350","gl":"299","gm":"220","gn":"224","gp":"590","gq":"240","gr":"30","gs":"500","gt":"502","gu":"1","gw":"245","gy":"592","hk":"852","hn":"504","hr":"385","ht":"509","hu":"36","id":"62","ie":"353","il":"972","im":"44","in":"91","io":"246","iq":"964","ir":"98","is":"354","it":"39","je":"44","jm":"1","jo":"962","jp":"81","ke":"254","kg":"996","kh":"855","ki":"686","km":"269","kn":"1","kp":"850","kr":"82","kw":"965","ky":"1","kz":"7","la":"856","lb":"961","lc":"1","li":"423","lk":"94","lr":"231","ls":"266","lt":"370","lu":"352","lv":"371","ly":"218","ma":"212","mc":"377","md":"373","me":"382","mf":"590","mg":"261","mh":"692","mk":"389","ml":"223","mm":"95","mn":"976","mo":"853","mp":"1","mq":"596","mr":"222","ms":"1","mt":"356","mu":"230","mv":"960","mw":"265","mx":"52","my":"60","mz":"258","na":"264","nc":"687","ne":"227","nf":"672","ng":"234","ni":"505","nl":"31","no":"47","np":"977","nr":"674","nu":"683","nz":"64","om":"968","pa":"507","pe":"51","pf":"689","pg":"675","ph":"63","pk":"92","pl":"48","pm":"508","pn":"870","pr":"1","ps":"972","pt":"351","pw":"680","py":"595","qa":"974","re":"262","ro":"40","rs":"381","ru":"7","rw":"250","sa":"966","sb":"677","sc":"248","sd":"249","se":"46","sg":"65","sh":"290","si":"386","sj":"47","sk":"421","sl":"232","sm":"378","sn":"221","so":"252","sr":"597","ss":"211","st":"239","sv":"503","sx":"1","sy":"963","sz":"268","tc":"1","td":"235","tf":"262","tg":"228","th":"66","tj":"992","tk":"690","tl":"670","tm":"993","tn":"216","to":"676","tr":"90","tt":"1","tv":"688","tw":"886","tz":"255","ua":"380","ug":"256","um":"1","us":"1","uy":"598","uz":"998","va":"39","vc":"1","ve":"58","vg":"1","vi":"1","vn":"84","vu":"678","wf":"681","ws":"685","xk":"377","ye":"967","yt":"262","za":"27","zm":"260","zw":"263"};
|
1813
|
+
|
1814
|
+
PhoneCodes.territories = function() {
|
1815
|
+
var data, _;
|
1816
|
+
return this.codes || (this.codes = (function() {
|
1817
|
+
var _ref, _results;
|
1818
|
+
_ref = this.phone_codes;
|
1819
|
+
_results = [];
|
1820
|
+
for (data in _ref) {
|
1821
|
+
_ = _ref[data];
|
1822
|
+
_results.push(data);
|
1823
|
+
}
|
1824
|
+
return _results;
|
1825
|
+
}).call(this));
|
1826
|
+
};
|
1827
|
+
|
1828
|
+
PhoneCodes.code_for_territory = function(territory) {
|
1829
|
+
var result;
|
1830
|
+
result = this.phone_codes[territory];
|
1831
|
+
if (result != null) {
|
1832
|
+
return result;
|
1833
|
+
} else {
|
1834
|
+
return null;
|
1835
|
+
}
|
1836
|
+
};
|
1837
|
+
|
1838
|
+
return PhoneCodes;
|
1839
|
+
|
1840
|
+
})();
|
1841
|
+
|
1842
|
+
TwitterCldr.PostalCodes = (function() {
|
1843
|
+
var find_regex, postal_codes;
|
1844
|
+
|
1845
|
+
function PostalCodes() {}
|
1846
|
+
|
1847
|
+
postal_codes = {"ad":"AD\\d{3}","am":"(37)?\\d{4}","ar":"([A-HJ-NP-Z])?\\d{4}([A-Z]{3})?","as":"96799","at":"\\d{4}","au":"\\d{4}","ax":"22\\d{3}","az":"\\d{4}","ba":"\\d{5}","bb":"(BB\\d{5})?","bd":"\\d{4}","be":"\\d{4}","bg":"\\d{4}","bh":"((1[0-2]|[2-9])\\d{2})?","bm":"[A-Z]{2}[ ]?[A-Z0-9]{2}","bn":"[A-Z]{2}[ ]?\\d{4}","br":"\\d{5}[\\-]?\\d{3}","by":"\\d{6}","ca":"[ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJ-NPRSTV-Z][ ]?\\d[ABCEGHJ-NPRSTV-Z]\\d","cc":"6799","ch":"\\d{4}","ck":"\\d{4}","cl":"\\d{7}","cn":"\\d{6}","cr":"\\d{4,5}|\\d{3}-\\d{4}","cs":"\\d{5}","cv":"\\d{4}","cx":"6798","cy":"\\d{4}","cz":"\\d{3}[ ]?\\d{2}","de":"\\d{5}","dk":"\\d{4}","do":"\\d{5}","dz":"\\d{5}","ec":"([A-Z]\\d{4}[A-Z]|(?:[A-Z]{2})?\\d{6})?","ee":"\\d{5}","eg":"\\d{5}","es":"\\d{5}","et":"\\d{4}","fi":"\\d{5}","fk":"FIQQ 1ZZ","fm":"(9694[1-4])([ \\-]\\d{4})?","fo":"\\d{3}","fr":"\\d{2}[ ]?\\d{3}","gb":"GIR[ ]?0AA|((AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|SM|SN|SO|SP|SR|SS|ST|SW|SY|TA|TD|TF|TN|TQ|TR|TS|TW|UB|W|WA|WC|WD|WF|WN|WR|WS|WV|YO|ZE)(\\d[\\dA-Z]?[ ]?\\d[ABD-HJLN-UW-Z]{2}))|BFPO[ ]?\\d{1,4}","ge":"\\d{4}","gf":"9[78]3\\d{2}","gg":"GY\\d[\\dA-Z]?[ ]?\\d[ABD-HJLN-UW-Z]{2}","gl":"39\\d{2}","gn":"\\d{3}","gp":"9[78][01]\\d{2}","gr":"\\d{3}[ ]?\\d{2}","gs":"SIQQ 1ZZ","gt":"\\d{5}","gu":"969[123]\\d([ \\-]\\d{4})?","gw":"\\d{4}","hm":"\\d{4}","hn":"(?:\\d{5})?","hr":"\\d{5}","ht":"\\d{4}","hu":"\\d{4}","id":"\\d{5}","il":"\\d{5}","im":"IM\\d[\\dA-Z]?[ ]?\\d[ABD-HJLN-UW-Z]{2}","in":"\\d{6}","io":"BBND 1ZZ","iq":"\\d{5}","is":"\\d{3}","it":"\\d{5}","je":"JE\\d[\\dA-Z]?[ ]?\\d[ABD-HJLN-UW-Z]{2}","jo":"\\d{5}","jp":"\\d{3}-\\d{4}","ke":"\\d{5}","kg":"\\d{6}","kh":"\\d{5}","kr":"\\d{3}[\\-]\\d{3}","kw":"\\d{5}","kz":"\\d{6}","la":"\\d{5}","lb":"(\\d{4}([ ]?\\d{4})?)?","li":"(948[5-9])|(949[0-7])","lk":"\\d{5}","lr":"\\d{4}","ls":"\\d{3}","lt":"\\d{5}","lu":"\\d{4}","lv":"\\d{4}","ma":"\\d{5}","mc":"980\\d{2}","md":"\\d{4}","me":"8\\d{4}","mg":"\\d{3}","mh":"969[67]\\d([ \\-]\\d{4})?","mk":"\\d{4}","mn":"\\d{6}","mp":"9695[012]([ \\-]\\d{4})?","mq":"9[78]2\\d{2}","mt":"[A-Z]{3}[ ]?\\d{2,4}","mu":"(\\d{3}[A-Z]{2}\\d{3})?","mv":"\\d{5}","mx":"\\d{5}","my":"\\d{5}","nc":"988\\d{2}","ne":"\\d{4}","nf":"2899","ng":"(\\d{6})?","ni":"((\\d{4}-)?\\d{3}-\\d{3}(-\\d{1})?)?","nl":"\\d{4}[ ]?[A-Z]{2}","no":"\\d{4}","np":"\\d{5}","nz":"\\d{4}","om":"(PC )?\\d{3}","pf":"987\\d{2}","pg":"\\d{3}","ph":"\\d{4}","pk":"\\d{5}","pl":"\\d{2}-\\d{3}","pm":"9[78]5\\d{2}","pn":"PCRN 1ZZ","pr":"00[679]\\d{2}([ \\-]\\d{4})?","pt":"\\d{4}([\\-]\\d{3})?","pw":"96940","py":"\\d{4}","re":"9[78]4\\d{2}","ro":"\\d{6}","rs":"\\d{6}","ru":"\\d{6}","sa":"\\d{5}","se":"\\d{3}[ ]?\\d{2}","sg":"\\d{6}","sh":"(ASCN|STHL) 1ZZ","si":"\\d{4}","sj":"\\d{4}","sk":"\\d{3}[ ]?\\d{2}","sm":"4789\\d","sn":"\\d{5}","so":"\\d{5}","sz":"[HLMS]\\d{3}","tc":"TKCA 1ZZ","th":"\\d{5}","tj":"\\d{6}","tm":"\\d{6}","tn":"\\d{4}","tr":"\\d{5}","tw":"\\d{3}(\\d{2})?","ua":"\\d{5}","us":"\\d{5}([ \\-]\\d{4})?","uy":"\\d{5}","uz":"\\d{6}","va":"00120","ve":"\\d{4}","vi":"008(([0-4]\\d)|(5[01]))([ \\-]\\d{4})?","wf":"986\\d{2}","xk":"\\d{5}","yt":"976\\d{2}","yu":"\\d{5}","za":"\\d{4}","zm":"\\d{5}"};
|
1848
|
+
|
1849
|
+
find_regex = function(territory) {
|
1850
|
+
var regex_str;
|
1851
|
+
regex_str = postal_codes[territory];
|
1852
|
+
if (regex_str != null) {
|
1853
|
+
return regex_str;
|
1854
|
+
} else {
|
1855
|
+
return null;
|
1856
|
+
}
|
1857
|
+
};
|
1858
|
+
|
1859
|
+
PostalCodes.territories = function() {
|
1860
|
+
var data, _;
|
1861
|
+
return this.codes || (this.codes = (function() {
|
1862
|
+
var _results;
|
1863
|
+
_results = [];
|
1864
|
+
for (data in postal_codes) {
|
1865
|
+
_ = postal_codes[data];
|
1866
|
+
_results.push(data);
|
1867
|
+
}
|
1868
|
+
return _results;
|
1869
|
+
})());
|
1870
|
+
};
|
1871
|
+
|
1872
|
+
PostalCodes.regex_for_territory = function(territory) {
|
1873
|
+
var regex;
|
1874
|
+
regex = find_regex(territory);
|
1875
|
+
if (regex != null) {
|
1876
|
+
return new RegExp(regex);
|
1877
|
+
} else {
|
1878
|
+
return null;
|
1879
|
+
}
|
1880
|
+
};
|
1881
|
+
|
1882
|
+
PostalCodes.is_valid = function(territory, postal_code) {
|
1883
|
+
var regex;
|
1884
|
+
regex = this.regex_for_territory(territory);
|
1885
|
+
return regex.test(postal_code);
|
1886
|
+
};
|
1887
|
+
|
1888
|
+
return PostalCodes;
|
1889
|
+
|
1890
|
+
})();
|
1891
|
+
|
1892
|
+
TwitterCldr.Languages = (function() {
|
1893
|
+
var rtl_data;
|
1894
|
+
|
1895
|
+
function Languages() {}
|
1896
|
+
|
1897
|
+
Languages.all = {"aa":"afar","ab":"abjasio","ace":"acehnés","ach":"acoli","ada":"adangme","ady":"adigeo","ae":"avéstico","af":"afrikáans","afa":"lengua afroasiática","afh":"afrihili","agq":"aghem","ain":"ainu","ak":"akan","akk":"acadio","ale":"aleutiano","alg":"lenguas algonquinas","alt":"altái meridional","am":"amárico","an":"aragonés","ang":"inglés antiguo","anp":"angika","apa":"lenguas apache","ar":"árabe","ar-001":"árabe estándar moderno","arc":"arameo","arn":"araucano","arp":"arapaho","art":"lengua artificial","arw":"arahuaco","as":"asamés","asa":"asu","ast":"asturiano","ath":"lenguas atabascas","aus":"lenguas australianas","av":"avar","awa":"avadhi","ay":"aimara","az":"azerí","ba":"bashkir","bad":"banda","bai":"lenguas bamileke","bal":"baluchi","ban":"balinés","bas":"basa","bat":"lengua báltica","bax":"bamun","bbj":"ghomala","be":"bielorruso","bej":"beja","bem":"bemba","ber":"bereber","bez":"bena","bfd":"bafut","bg":"búlgaro","bh":"bihari","bho":"bhojpuri","bi":"bislama","bik":"bicol","bin":"bini","bkm":"kom","bla":"siksika","bm":"bambara","bn":"bengalí","bnt":"bantú","bo":"tibetano","br":"bretón","bra":"braj","brx":"bodo","bs":"bosnio","bss":"akoose","btk":"batak","bua":"buriat","bug":"buginés","bum":"bulu","byn":"blin","byv":"medumba","ca":"catalán","cad":"caddo","cai":"lengua india centroamericana","car":"caribe","cau":"lengua caucásica","cay":"cayuga","cch":"atsam","ce":"checheno","ceb":"cebuano","cel":"lengua celta","cgg":"chiga","ch":"chamorro","chb":"chibcha","chg":"chagatái","chk":"trukés","chm":"marí","chn":"jerga chinuk","cho":"choctaw","chp":"chipewyan","chr":"cherokee","chy":"cheyene","ckb":"kurdo central","cmc":"lenguas chámicas","co":"corso","cop":"copto","cpe":"lengua criolla o pidgin basada en el inglés","cpf":"lengua criolla o pidgin basada en el francés","cpp":"lengua criolla o pidgin basada en el portugués","cr":"cree","crh":"tártaro de Crimea","crp":"lengua criolla o pidgin","cs":"checo","csb":"casubio","cu":"eslavo eclesiástico","cus":"lengua cusita","cv":"chuvash","cy":"galés","da":"danés","dak":"dakota","dar":"dargva","dav":"taita","day":"dayak","de":"alemán","de-AT":"alemán austríaco","de-CH":"alto alemán de Suiza","del":"delaware","den":"slave","dgr":"dogrib","din":"dinka","dje":"zarma","doi":"dogri","dra":"lengua dravídica","dsb":"sorbio inferior","dua":"duala","dum":"neerlandés medieval","dv":"divehi","dyo":"jola-fonyi","dyu":"diula","dz":"dzongkha","dzg":"dazaga","ebu":"embu","ee":"ewe","efi":"efik","egy":"egipcio antiguo","eka":"ekajuk","el":"griego","elx":"elamita","en":"inglés","en-AU":"inglés australiano","en-CA":"inglés canadiense","en-GB":"inglés británico","en-US":"inglés estadounidense","enm":"inglés medieval","eo":"esperanto","es":"español","es-419":"español de América","es-ES":"español de España","es-MX":"Mexican Spanish","et":"estonio","eu":"vasco","ewo":"ewondo","fa":"persa","fan":"fang","fat":"fanti","ff":"fula","fi":"finés","fil":"filipino","fiu":"lengua finoúgria","fj":"fiyiano","fo":"feroés","fon":"fon","fr":"francés","fr-CA":"francés canadiense","fr-CH":"francés de Suiza","frm":"francés medieval","fro":"francés antiguo","frr":"frisón septentrional","frs":"frisón oriental","fur":"friulano","fy":"frisón occidental","ga":"irlandés","gaa":"ga","gay":"gayo","gba":"gbaya","gd":"gaélico escocés","gem":"lengua germánica","gez":"geez","gil":"gilbertés","gl":"gallego","gmh":"alemán de la alta edad media","gn":"guaraní","goh":"alemán de la alta edad antigua","gon":"gondi","gor":"gorontalo","got":"gótico","grb":"grebo","grc":"griego antiguo","gsw":"alemán suizo","gu":"gujarati","guz":"gusii","gv":"gaélico manés","gwi":"kutchin","ha":"hausa","hai":"haida","haw":"hawaiano","he":"hebreo","hi":"hindi","hil":"hiligaynon","him":"himachali","hit":"hitita","hmn":"hmong","ho":"hiri motu","hr":"croata","hsb":"sorbio superior","ht":"haitiano","hu":"húngaro","hup":"hupa","hy":"armenio","hz":"herero","ia":"interlingua","iba":"iban","ibb":"ibibio","id":"indonesio","ie":"interlingue","ig":"igbo","ii":"sichuan yi","ijo":"ijo","ik":"inupiaq","ilo":"ilocano","inc":"lengua índica","ine":"lengua indoeuropea","inh":"ingush","io":"ido","ira":"lengua irania","iro":"lenguas iroquesas","is":"islandés","it":"italiano","iu":"inuktitut","ja":"japonés","jbo":"lojban","jgo":"Ngomba","jmc":"machame","jpr":"judeo-persa","jrb":"judeo-árabe","jv":"javanés","ka":"georgiano","kaa":"karakalpako","kab":"cabila","kac":"kachin","kaj":"jju","kam":"kamba","kar":"karen","kaw":"kawi","kbd":"kabardiano","kbl":"kanembu","kcg":"tyap","kde":"makonde","kea":"criollo caboverdiano","kfo":"koro","kg":"kongo","kha":"khasi","khi":"lengua joisana","kho":"kotanés","khq":"koyra chiini","ki":"kikuyu","kj":"kuanyama","kk":"kazajo","kkj":"kako","kl":"groenlandés","kln":"kalenyin","km":"jemer","kmb":"kimbundu","kn":"canarés","ko":"coreano","kok":"konkani","kos":"kosraeano","kpe":"kpelle","kr":"kanuri","krc":"karachay-balkar","krl":"carelio","kro":"kru","kru":"kurukh","ks":"cachemiro","ksb":"shambala","ksf":"bafia","ksh":"kölsch","ku":"kurdo","kum":"kumyk","kut":"kutenai","kv":"komi","kw":"córnico","ky":"kirghiz","la":"latín","lad":"ladino","lag":"langi","lah":"lahnda","lam":"lamba","lb":"luxemburgués","lez":"lezgiano","lg":"ganda","li":"limburgués","lkt":"Lakota","ln":"lingala","lo":"laosiano","lol":"mongo","loz":"lozi","lt":"lituano","lu":"luba-katanga","lua":"luba-lulua","lui":"luiseño","lun":"lunda","luo":"luo","lus":"lushai","luy":"luyia","lv":"letón","mad":"madurés","maf":"mafa","mag":"magahi","mai":"maithili","mak":"macasar","man":"mandingo","map":"lengua austronesia","mas":"masai","mde":"maba","mdf":"moksha","mdr":"mandar","men":"mende","mer":"meru","mfe":"criollo mauriciano","mg":"malgache","mga":"irlandés medieval","mgh":"makhuwa-meetto","mgo":"meta'","mh":"marshalés","mi":"maorí","mic":"micmac","min":"minangkabau","mis":"lenguas varias","mk":"macedonio","mkh":"lengua mon-jemer","ml":"malayalam","mn":"mongol","mnc":"manchú","mni":"manipuri","mno":"lenguas manobo","mo":"moldavo","moh":"mohawk","mos":"mossi","mr":"marathi","ms":"malayo","mt":"maltés","mua":"mundang","mul":"lenguas múltiples","mun":"lenguas munda","mus":"creek","mwl":"mirandés","mwr":"marwari","my":"birmano","mye":"myene","myn":"maya","myv":"erzya","na":"nauruano","nah":"náhuatl","nai":"lengua india norteamericana","nap":"napolitano","naq":"nama","nb":"bokmal noruego","nd":"ndebele septentrional","nds":"bajo alemán","ne":"nepalí","new":"newari","ng":"ndonga","nia":"nias","nic":"lengua níger-cordofana","niu":"niueano","nl":"neerlandés","nl-BE":"flamenco","nmg":"kwasio","nn":"nynorsk noruego","nnh":"ngiemboon","no":"noruego","nog":"nogai","non":"nórdico antiguo","nqo":"n’ko","nr":"ndebele meridional","nso":"sotho septentrional","nub":"lenguas nubias","nus":"nuer","nv":"navajo","nwc":"newari clásico","ny":"nyanja","nym":"nyamwezi","nyn":"nyankole","nyo":"nyoro","nzi":"nzima","oc":"occitano","oj":"ojibwa","om":"oromo","or":"oriya","os":"osético","osa":"osage","ota":"turco otomano","oto":"lenguas otomanas","pa":"punjabí","paa":"lengua papú","pag":"pangasinán","pal":"pahlavi","pam":"pampanga","pap":"papiamento","pau":"palauano","peo":"persa antiguo","phi":"lengua filipina","phn":"fenicio","pi":"pali","pl":"polaco","pon":"pohnpeiano","pra":"lenguas prácritas","pro":"provenzal antiguo","ps":"Pastú","pt":"portugués","pt-BR":"portugués de Brasil","pt-PT":"portugués de Portugal","qu":"quechua","raj":"rajasthani","rap":"rapanui","rar":"rarotongano","rm":"retorrománico","rn":"kiroundi","ro":"rumano","roa":"lengua romance","rof":"rombo","rom":"romaní","root":"raíz","ru":"ruso","rup":"arrumano","rw":"kinyarwanda","rwk":"rwa","sa":"sánscrito","sad":"sandawe","sah":"sakha","sai":"lengua india sudamericana","sal":"lenguas salish","sam":"arameo samaritano","saq":"samburu","sas":"sasak","sat":"santali","sba":"ngambay","sbp":"sangu","sc":"sardo","scn":"siciliano","sco":"escocés","sd":"sindhi","se":"sami septentrional","see":"seneca","seh":"sena","sel":"selkup","sem":"lengua semítica","ses":"koyraboro senni","sg":"sango","sga":"irlandés antiguo","sgn":"lenguajes de signos","sh":"serbocroata","shi":"tashelhit","shn":"shan","shu":"árabe chadiano","si":"cingalés","sid":"sidamo","sio":"lenguas sioux","sit":"lengua sino-tibetana","sk":"eslovaco","sl":"esloveno","sla":"lengua eslava","sm":"samoano","sma":"sami meridional","smi":"lengua sami","smj":"sami lule","smn":"sami inari","sms":"sami skolt","sn":"shona","snk":"soninké","so":"somalí","sog":"sogdiano","son":"songhai","sq":"albanés","sr":"serbio","srn":"sranan tongo","srr":"serer","ss":"siswati","ssa":"lengua nilo-sahariana","ssy":"saho","st":"sesotho meridional","su":"sundanés","suk":"sukuma","sus":"susu","sux":"sumerio","sv":"sueco","sw":"swahili","swb":"comorense","swc":"swahili del Congo","syc":"siríaco clásico","syr":"siriaco","ta":"tamil","tai":"lengua tai","te":"telugu","tem":"temne","teo":"teso","ter":"tereno","tet":"tetún","tg":"tayiko","th":"tailandés","ti":"tigriña","tig":"tigré","tiv":"tiv","tk":"turcomano","tkl":"tokelauano","tl":"tagalo","tlh":"klingon","tli":"tlingit","tmh":"tamashek","tn":"setchwana","to":"tongano","tog":"tonga del Nyasa","tpi":"tok pisin","tr":"turco","trv":"taroko","ts":"tsonga","tsi":"tsimshiano","tt":"tártaro","tum":"tumbuka","tup":"lenguas tupí","tut":"lengua altaica","tvl":"tuvaluano","tw":"twi","twq":"tasawaq","ty":"tahitiano","tyv":"tuviniano","tzm":"tamazight del Marruecos Central","udm":"udmurt","ug":"Uyghur","uga":"ugarítico","uk":"ucraniano","umb":"umbundu","und":"lengua desconocida","ur":"urdu","uz":"uzbeko","vai":"vai","ve":"venda","vi":"vietnamita","vo":"volapük","vot":"vótico","vun":"kivunyo","wa":"valón","wae":"walser","wak":"lenguas wakasha","wal":"walamo","war":"waray","was":"washo","wen":"lenguas sorbias","wo":"uolof","xal":"kalmyk","xh":"xhosa","xog":"soga","yao":"yao","yap":"yapés","yav":"yangben","ybb":"yemba","yi":"yídish","yo":"yoruba","ypk":"lenguas yupik","yue":"cantonés","za":"zhuang","zap":"zapoteco","zbl":"símbolos Bliss","zen":"zenaga","zgh":"tamazight","zh":"chino","zh-Hans":"chino simplificado","zh-Hant":"chino tradicional","znd":"zande","zu":"zulú","zun":"zuni","zxx":"sin contenido lingüístico","zza":"zazaki"};
|
1898
|
+
|
1899
|
+
rtl_data = {"af":false,"ar":true,"be":false,"bg":false,"bn":false,"ca":false,"cs":false,"cy":false,"da":false,"de":false,"de-CH":false,"el":false,"en":false,"en-150":false,"en-AU":false,"en-CA":false,"en-GB":false,"en-IE":false,"en-SG":false,"en-ZA":false,"es":false,"es-419":false,"es-CO":false,"es-MX":false,"es-US":false,"eu":false,"fa":true,"fi":false,"fil":false,"fr":false,"fr-BE":false,"fr-CA":false,"fr-CH":false,"ga":false,"gl":false,"he":true,"hi":false,"hr":false,"hu":false,"id":false,"is":false,"it":false,"it-CH":false,"ja":false,"ko":false,"lv":false,"ms":false,"nb":false,"nl":false,"pl":false,"pt":false,"ro":false,"ru":false,"sk":false,"sq":false,"sr":false,"sv":false,"ta":false,"th":false,"tr":false,"uk":false,"ur":true,"vi":false,"zh":false,"zh-Hant":false};
|
1900
|
+
|
1901
|
+
Languages.from_code = function(code) {
|
1902
|
+
return this.all[code] || null;
|
1903
|
+
};
|
1904
|
+
|
1905
|
+
Languages.is_rtl = function(locale) {
|
1906
|
+
var result;
|
1907
|
+
result = rtl_data[locale];
|
1908
|
+
if (result != null) {
|
1909
|
+
return result;
|
1910
|
+
} else {
|
1911
|
+
return null;
|
1912
|
+
}
|
1913
|
+
};
|
1914
|
+
|
1915
|
+
return Languages;
|
1916
|
+
|
1917
|
+
})();
|
1918
|
+
|
1919
|
+
TwitterCldr.NumberParser = (function() {
|
1920
|
+
function NumberParser() {
|
1921
|
+
this.group_separator = ",";
|
1922
|
+
this.decimal_separator = "\\\.";
|
1923
|
+
this.separator_chars = ['\\.', ',', '\\s'].join("");
|
1924
|
+
}
|
1925
|
+
|
1926
|
+
NumberParser.prototype.parse = function(number_text, options) {
|
1927
|
+
var last, num, num_list, punct_list, result, separators, token, tokens, _i, _len;
|
1928
|
+
if (options == null) {
|
1929
|
+
options = {};
|
1930
|
+
}
|
1931
|
+
if (options.strict === void 0) {
|
1932
|
+
options.strict = true;
|
1933
|
+
}
|
1934
|
+
separators = this.get_separators(options.strict);
|
1935
|
+
tokens = this.tokenize(number_text, separators.group, separators.decimal);
|
1936
|
+
num_list = [];
|
1937
|
+
punct_list = [];
|
1938
|
+
for (_i = 0, _len = tokens.length; _i < _len; _i++) {
|
1939
|
+
token = tokens[_i];
|
1940
|
+
if (token.type === "numeric") {
|
1941
|
+
num_list.push(token);
|
1942
|
+
} else {
|
1943
|
+
punct_list.push(token);
|
1944
|
+
}
|
1945
|
+
}
|
1946
|
+
if (!this.is_punct_valid(punct_list)) {
|
1947
|
+
throw "Invalid number";
|
1948
|
+
}
|
1949
|
+
if (!(tokens.slice(-1)[0] && tokens.slice(-1)[0]["type"] === "numeric")) {
|
1950
|
+
throw "Invalid number";
|
1951
|
+
}
|
1952
|
+
if (punct_list.length > 0 && punct_list.slice(-1)[0]["type"] === "decimal") {
|
1953
|
+
result = parseInt(((function() {
|
1954
|
+
var _j, _len1, _ref, _results;
|
1955
|
+
_ref = num_list.slice(0, -1);
|
1956
|
+
_results = [];
|
1957
|
+
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
|
1958
|
+
num = _ref[_j];
|
1959
|
+
_results.push(num.value);
|
1960
|
+
}
|
1961
|
+
return _results;
|
1962
|
+
})()).join("")) || 0;
|
1963
|
+
last = num_list.slice(-1)[0];
|
1964
|
+
return result + parseInt(last.value) / Math.pow(10.0, last.value.length);
|
1965
|
+
} else {
|
1966
|
+
return parseInt(((function() {
|
1967
|
+
var _j, _len1, _results;
|
1968
|
+
_results = [];
|
1969
|
+
for (_j = 0, _len1 = num_list.length; _j < _len1; _j++) {
|
1970
|
+
num = num_list[_j];
|
1971
|
+
_results.push(num.value);
|
1972
|
+
}
|
1973
|
+
return _results;
|
1974
|
+
})()).join(""));
|
1975
|
+
}
|
1976
|
+
};
|
1977
|
+
|
1978
|
+
NumberParser.prototype.try_parse = function(number_text, default_value, callback, options) {
|
1979
|
+
var err, result;
|
1980
|
+
if (default_value == null) {
|
1981
|
+
default_value = null;
|
1982
|
+
}
|
1983
|
+
if (callback == null) {
|
1984
|
+
callback = null;
|
1985
|
+
}
|
1986
|
+
if (options == null) {
|
1987
|
+
options = {};
|
1988
|
+
}
|
1989
|
+
result = (function() {
|
1990
|
+
try {
|
1991
|
+
return this.parse(number_text, options);
|
1992
|
+
} catch (_error) {
|
1993
|
+
err = _error;
|
1994
|
+
if (err.toString() === "Invalid number") {
|
1995
|
+
return null;
|
1996
|
+
} else {
|
1997
|
+
throw err;
|
1998
|
+
}
|
1999
|
+
}
|
2000
|
+
}).call(this);
|
2001
|
+
if (callback) {
|
2002
|
+
return callback(result);
|
2003
|
+
} else {
|
2004
|
+
if (result === null) {
|
2005
|
+
return default_value;
|
2006
|
+
} else {
|
2007
|
+
return result;
|
2008
|
+
}
|
2009
|
+
}
|
2010
|
+
};
|
2011
|
+
|
2012
|
+
NumberParser.prototype.is_valid = function(number_text, options) {
|
2013
|
+
var err;
|
2014
|
+
if (options == null) {
|
2015
|
+
options = {};
|
2016
|
+
}
|
2017
|
+
try {
|
2018
|
+
this.parse(number_text, options);
|
2019
|
+
return true;
|
2020
|
+
} catch (_error) {
|
2021
|
+
err = _error;
|
2022
|
+
if (err.toString() === "Invalid number") {
|
2023
|
+
return false;
|
2024
|
+
} else {
|
2025
|
+
throw err;
|
2026
|
+
}
|
2027
|
+
}
|
2028
|
+
};
|
2029
|
+
|
2030
|
+
NumberParser.is_numeric = function(text, separators) {
|
2031
|
+
var regexp;
|
2032
|
+
if (separators == null) {
|
2033
|
+
separators = new NumberParser().separator_chars;
|
2034
|
+
}
|
2035
|
+
regexp = new RegExp("^[0-9" + separators + "]+$");
|
2036
|
+
return regexp.test(text);
|
2037
|
+
};
|
2038
|
+
|
2039
|
+
NumberParser.prototype.is_punct_valid = function(punct_list) {
|
2040
|
+
var index, punct, valid, _i, _len;
|
2041
|
+
valid = true;
|
2042
|
+
for (index = _i = 0, _len = punct_list.length; _i < _len; index = ++_i) {
|
2043
|
+
punct = punct_list[index];
|
2044
|
+
valid = valid && (punct.type === "group" || (index === (punct_list.length - 1) && punct.type === "decimal"));
|
2045
|
+
}
|
2046
|
+
return valid;
|
2047
|
+
};
|
2048
|
+
|
2049
|
+
NumberParser.prototype.get_separators = function(strict) {
|
2050
|
+
var decimal, group;
|
2051
|
+
if (strict == null) {
|
2052
|
+
strict = false;
|
2053
|
+
}
|
2054
|
+
group = strict ? this.group_separator : this.separator_chars;
|
2055
|
+
decimal = strict ? this.decimal_separator : this.separator_chars;
|
2056
|
+
return {
|
2057
|
+
group: group,
|
2058
|
+
decimal: decimal
|
2059
|
+
};
|
2060
|
+
};
|
2061
|
+
|
2062
|
+
NumberParser.prototype.tokenize = function(number_text, group, decimal) {
|
2063
|
+
var match, match_data, regexp, token, tokens, _i, _len, _results;
|
2064
|
+
regexp = new RegExp("([\\d]*)([" + group + "]{0,1})([\\d]*)([" + decimal + "]{0,1})([\\d]*)");
|
2065
|
+
match_data = number_text.split(regexp);
|
2066
|
+
match_data = (function() {
|
2067
|
+
var _i, _len, _results;
|
2068
|
+
_results = [];
|
2069
|
+
for (_i = 0, _len = match_data.length; _i < _len; _i++) {
|
2070
|
+
match = match_data[_i];
|
2071
|
+
if (match !== "") {
|
2072
|
+
_results.push(match);
|
2073
|
+
}
|
2074
|
+
}
|
2075
|
+
return _results;
|
2076
|
+
})();
|
2077
|
+
tokens = (function() {
|
2078
|
+
var _i, _len, _results;
|
2079
|
+
_results = [];
|
2080
|
+
for (_i = 0, _len = match_data.length; _i < _len; _i++) {
|
2081
|
+
match = match_data[_i];
|
2082
|
+
_results.push(this.identify(match, group, decimal));
|
2083
|
+
}
|
2084
|
+
return _results;
|
2085
|
+
}).call(this);
|
2086
|
+
_results = [];
|
2087
|
+
for (_i = 0, _len = tokens.length; _i < _len; _i++) {
|
2088
|
+
token = tokens[_i];
|
2089
|
+
if (token.type !== null) {
|
2090
|
+
_results.push(token);
|
2091
|
+
}
|
2092
|
+
}
|
2093
|
+
return _results;
|
2094
|
+
};
|
2095
|
+
|
2096
|
+
NumberParser.prototype.identify = function(text, group, decimal) {
|
2097
|
+
var decimal_regexp, group_regexp, result;
|
2098
|
+
result = {
|
2099
|
+
value: text
|
2100
|
+
};
|
2101
|
+
result.type = NumberParser.is_numeric(result.value, "") ? "numeric" : (group_regexp = new RegExp("[" + group + "]"), decimal_regexp = new RegExp("[" + decimal + "]"), group_regexp.test(result.value) ? "group" : decimal_regexp.test(result.value) ? "decimal" : null);
|
2102
|
+
return result;
|
2103
|
+
};
|
2104
|
+
|
2105
|
+
return NumberParser;
|
2106
|
+
|
2107
|
+
})();
|
2108
|
+
|
2109
|
+
TwitterCldr.TerritoriesContainment = (function() {
|
2110
|
+
function TerritoriesContainment() {}
|
2111
|
+
|
2112
|
+
TerritoriesContainment.territories_data = {"001":["002","009","019","142","150"],"002":["011","014","015","017","018"],"003":["013","021","029"],"005":["AR","BO","BR","CL","CO","EC","FK","GF","GY","PE","PY","SR","UY","VE"],"009":["053","054","057","061","QO"],"011":["BF","BJ","CI","CV","GH","GM","GN","GW","LR","ML","MR","NE","NG","SH","SL","SN","TG"],"013":["BZ","CR","GT","HN","MX","NI","PA","SV"],"014":["BI","DJ","ER","ET","KE","KM","MG","MU","MW","MZ","RE","RW","SC","SO","TZ","UG","YT","ZM","ZW"],"015":["DZ","EA","EG","EH","IC","LY","MA","SD","SS","TN"],"017":["AO","CD","CF","CG","CM","GA","GQ","ST","TD","ZR"],"018":["BW","LS","NA","SZ","ZA"],"019":["003","005","013","021","029","419"],"021":["BM","CA","GL","PM","US"],"029":["AG","AI","AN","AW","BB","BL","BQ","BS","CU","CW","DM","DO","GD","GP","HT","JM","KN","KY","LC","MF","MQ","MS","PR","SX","TC","TT","VC","VG","VI"],"030":["CN","HK","JP","KP","KR","MN","MO","TW"],"034":["AF","BD","BT","IN","IR","LK","MV","NP","PK"],"035":["BN","BU","ID","KH","LA","MM","MY","PH","SG","TH","TL","TP","VN"],"039":["AD","AL","BA","CS","ES","GI","GR","HR","IT","ME","MK","MT","PT","RS","SI","SM","VA","XK","YU"],"053":["AU","NF","NZ"],"054":["FJ","NC","PG","SB","VU"],"057":["FM","GU","KI","MH","MP","NR","PW"],"061":["AS","CK","NU","PF","PN","TK","TO","TV","WF","WS"],"142":["030","034","035","143","145"],"143":["KG","KZ","TJ","TM","UZ"],"145":["AE","AM","AZ","BH","CY","GE","IL","IQ","JO","KW","LB","NT","OM","PS","QA","SA","SY","TR","YD","YE"],"150":["039","151","154","155","EU","QU"],"151":["BG","BY","CZ","HU","MD","PL","RO","RU","SK","SU","UA"],"154":["AX","DK","EE","FI","FO","GB","GG","IE","IM","IS","JE","LT","LV","false","SE","SJ"],"155":["AT","BE","CH","DD","DE","FR","FX","LI","LU","MC","NL"],"419":["005","013","029"],"EU":["AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GR","HU","IE","IT","LT","LU","LV","MT","NL","PL","PT","RO","SE","SI","SK"],"QO":["AC","AQ","BV","CC","CP","CX","DG","GS","HM","IO","TA","TF","UM"]};
|
2113
|
+
|
2114
|
+
TerritoriesContainment.contains = function(parent_code, child_code) {
|
2115
|
+
var contains, immediate_child, immediate_children, _i, _len;
|
2116
|
+
this.validate_territory(parent_code);
|
2117
|
+
this.validate_territory(child_code);
|
2118
|
+
immediate_children = this.children(parent_code);
|
2119
|
+
contains = false;
|
2120
|
+
if (__indexOf.call(immediate_children, child_code) >= 0) {
|
2121
|
+
contains = true;
|
2122
|
+
} else {
|
2123
|
+
for (_i = 0, _len = immediate_children.length; _i < _len; _i++) {
|
2124
|
+
immediate_child = immediate_children[_i];
|
2125
|
+
if (this.contains(immediate_child, child_code)) {
|
2126
|
+
contains = true;
|
2127
|
+
break;
|
2128
|
+
}
|
2129
|
+
}
|
2130
|
+
}
|
2131
|
+
return contains;
|
2132
|
+
};
|
2133
|
+
|
2134
|
+
TerritoriesContainment.parents = function(territory_code) {
|
2135
|
+
this.validate_territory(territory_code);
|
2136
|
+
return this.parents_data[territory_code];
|
2137
|
+
};
|
2138
|
+
|
2139
|
+
TerritoriesContainment.children = function(territory_code) {
|
2140
|
+
this.validate_territory(territory_code);
|
2141
|
+
return this.territories_data[territory_code] || [];
|
2142
|
+
};
|
2143
|
+
|
2144
|
+
TerritoriesContainment.prepare_parents_data = function() {
|
2145
|
+
var child, children, data, territory, _i, _len, _ref;
|
2146
|
+
data = {};
|
2147
|
+
_ref = this.territories_data;
|
2148
|
+
for (territory in _ref) {
|
2149
|
+
children = _ref[territory];
|
2150
|
+
if (!(territory in data)) {
|
2151
|
+
data[territory] = [];
|
2152
|
+
}
|
2153
|
+
for (_i = 0, _len = children.length; _i < _len; _i++) {
|
2154
|
+
child = children[_i];
|
2155
|
+
if (!(child in data)) {
|
2156
|
+
data[child] = [];
|
2157
|
+
}
|
2158
|
+
data[child].push(territory);
|
2159
|
+
}
|
2160
|
+
}
|
2161
|
+
return data;
|
2162
|
+
};
|
2163
|
+
|
2164
|
+
TerritoriesContainment.parents_data = TerritoriesContainment.prepare_parents_data();
|
2165
|
+
|
2166
|
+
TerritoriesContainment.validate_territory = function(territory_code) {
|
2167
|
+
if (!(territory_code in this.parents_data)) {
|
2168
|
+
throw "unknown territory code";
|
2169
|
+
}
|
2170
|
+
};
|
2171
|
+
|
2172
|
+
return TerritoriesContainment;
|
2173
|
+
|
2174
|
+
})();
|
2175
|
+
|
2176
|
+
root = typeof exports !== "undefined" && exports !== null ? exports : (this.TwitterCldr = {}, this.TwitterCldr);
|
2177
|
+
|
2178
|
+
for (key in TwitterCldr) {
|
2179
|
+
obj = TwitterCldr[key];
|
2180
|
+
root[key] = obj;
|
2181
|
+
}
|
2182
|
+
|
2183
|
+
}).call(this);
|