twitter_cldr_js 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -0
- data/History.txt +11 -1
- data/README.md +103 -13
- data/Rakefile +1 -1
- data/lib/assets/javascripts/twitter_cldr/af.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/ar.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/be.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/bg.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/bn.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/ca.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/cs.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/cy.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/da.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/de.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/el.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/en.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/es.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/eu.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/fa.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/fi.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/fil.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/fr.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/ga.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/gl.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/he.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/hi.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/hu.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/id.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/it.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/ja.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/ko.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/lv.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/msa.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/nl.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/no.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/pl.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/pt.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/ro.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/ru.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/sk.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/sq.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/sr.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/sv.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/ta.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/th.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/tr.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/uk.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/ur.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/zh-cn.js +1815 -0
- data/lib/assets/javascripts/twitter_cldr/zh-tw.js +1815 -0
- data/lib/twitter_cldr/js/compiler.rb +12 -3
- data/lib/twitter_cldr/js/mustache/bundle.coffee +19 -1
- data/lib/twitter_cldr/js/mustache/calendars/additional_date_format_selector.coffee +85 -0
- data/lib/twitter_cldr/js/mustache/calendars/datetime.coffee +248 -226
- data/lib/twitter_cldr/js/mustache/calendars/timespan.coffee +19 -18
- data/lib/twitter_cldr/js/mustache/numbers/numbers.coffee +62 -19
- data/lib/twitter_cldr/js/mustache/plurals/rules.coffee +1 -1
- data/lib/twitter_cldr/js/mustache/shared/bidi.coffee +433 -0
- data/lib/twitter_cldr/js/mustache/shared/calendar.coffee +25 -0
- data/lib/twitter_cldr/js/mustache/shared/currencies.coffee +5 -11
- data/lib/twitter_cldr/js/mustache/shared/lists.coffee +40 -0
- data/lib/twitter_cldr/js/mustache/shared/prerender/bidi_classes.json +1 -0
- data/lib/twitter_cldr/js/mustache/utilities.coffee +87 -0
- data/lib/twitter_cldr/js/renderers.rb +23 -19
- data/lib/twitter_cldr/js/renderers/bundle.rb +8 -2
- data/lib/twitter_cldr/js/renderers/calendars/additional_date_format_selector_renderer.rb +18 -0
- data/lib/twitter_cldr/js/renderers/calendars/datetime_renderer.rb +13 -9
- data/lib/twitter_cldr/js/renderers/numbers/numbers_renderer.rb +17 -3
- data/lib/twitter_cldr/js/renderers/shared/bidi_renderer.rb +77 -0
- data/lib/twitter_cldr/js/renderers/shared/calendar_renderer.rb +20 -0
- data/lib/twitter_cldr/js/renderers/shared/currencies_renderer.rb +2 -2
- data/lib/twitter_cldr/js/renderers/shared/list_renderer.rb +22 -0
- data/lib/twitter_cldr/js/tasks/tasks.rake +9 -5
- data/lib/twitter_cldr/js/tasks/tasks.rb +6 -5
- data/lib/twitter_cldr/js/version.rb +1 -1
- data/spec/js/calendars/additional_date_format_selector.spec.js +126 -0
- data/spec/js/calendars/datetime.spec.js +29 -2
- data/spec/js/calendars/timespan.spec.js +45 -1
- data/spec/js/numbers/abbreviated/abbreviated_number.spec.js +47 -0
- data/spec/js/numbers/abbreviated/long_decimal.spec.js +57 -0
- data/spec/js/numbers/abbreviated/short_decimal.spec.js +57 -0
- data/spec/js/numbers/currency.spec.js +2 -2
- data/spec/js/numbers/decimal.spec.js +1 -1
- data/spec/js/numbers/helpers/fraction.spec.js +1 -1
- data/spec/js/numbers/helpers/integer.spec.js +1 -1
- data/spec/js/numbers/number.spec.js +1 -1
- data/spec/js/numbers/percent.spec.js +1 -1
- data/spec/js/plurals/plural_rules.spec.js +1 -1
- data/spec/js/shared/bidi.spec.js +105 -0
- data/spec/js/shared/calendar.spec.js +51 -0
- data/spec/js/shared/classpath_bidi_test.txt +217202 -0
- data/spec/js/shared/lists.spec.js +100 -0
- data/spec/js/utilities.spec.js +120 -0
- data/twitter_cldr_js.gemspec +1 -1
- metadata +68 -37
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_af.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_ar.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_ca.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_cs.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_da.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_de.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_el.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_en.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_es.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_eu.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_fa.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_fi.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_fil.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_fr.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_he.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_hi.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_hu.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_id.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_it.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_ja.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_ko.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_msa.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_nl.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_no.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_pl.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_pt.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_ru.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_sv.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_th.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_tr.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_uk.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_ur.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_zh-cn.js +0 -887
- data/lib/assets/javascripts/twitter_cldr/twitter_cldr_zh-tw.js +0 -887
@@ -1,887 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
// Copyright 2012 Twitter, Inc
|
3
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
4
|
-
|
5
|
-
// TwitterCLDR (JavaScript) v1.8.0
|
6
|
-
// Authors: Cameron Dutro [@camertron]
|
7
|
-
Kirill Lashuk [@KL_7]
|
8
|
-
portions by Sven Fuchs [@svenfuchs]
|
9
|
-
// Homepage: https://twitter.com
|
10
|
-
// Description: Provides date, time, number, and list formatting functionality for various Twitter-supported locales in Javascript.
|
11
|
-
*/
|
12
|
-
|
13
|
-
var BaseHelper, Currencies, CurrencyFormatter, DateTimeFormatter, DecimalFormatter, FractionHelper, IntegerHelper, NumberFormatter, PercentFormatter, PluralRules, TimespanFormatter, TwitterCldr, key, obj,
|
14
|
-
__hasProp = {}.hasOwnProperty,
|
15
|
-
__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; };
|
16
|
-
|
17
|
-
TwitterCldr = {};
|
18
|
-
|
19
|
-
TwitterCldr.PluralRules = PluralRules = (function() {
|
20
|
-
|
21
|
-
function PluralRules() {}
|
22
|
-
|
23
|
-
PluralRules.rules = {"keys": ["one","few","many","other"], "rule": function(n) { return (function() { if (n % 10 == 1 && !(n % 100 == 11)) { return "one" } else { return (function() { if ([2, 3, 4].indexOf(n % 10) >= 0 && !([12, 13, 14].indexOf(n % 100) >= 0)) { return "few" } else { return (function() { if (n % 10 == 0 || [5, 6, 7, 8, 9].indexOf(n % 10) >= 0 || [11, 12, 13, 14].indexOf(n % 100) >= 0) { return "many" } else { return "other" } })(); } })(); } })(); }};
|
24
|
-
|
25
|
-
PluralRules.all = function() {
|
26
|
-
return this.rules.keys;
|
27
|
-
};
|
28
|
-
|
29
|
-
PluralRules.rule_for = function(number) {
|
30
|
-
try {
|
31
|
-
return this.rules.rule(number);
|
32
|
-
} catch (error) {
|
33
|
-
return "other";
|
34
|
-
}
|
35
|
-
};
|
36
|
-
|
37
|
-
return PluralRules;
|
38
|
-
|
39
|
-
})();
|
40
|
-
|
41
|
-
TwitterCldr.TimespanFormatter = TimespanFormatter = (function() {
|
42
|
-
|
43
|
-
function TimespanFormatter() {
|
44
|
-
this.default_type = "default";
|
45
|
-
this.tokens = {"ago":{"second":{"default":{"one":[{"value":"1 секунду тому","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" секунди тому","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" секунд тому","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" секунди тому","type":"plaintext"}]}},"minute":{"default":{"one":[{"value":"1 хвилину тому","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" хвилини тому","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" хвилин тому","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" хвилини тому","type":"plaintext"}]}},"hour":{"default":{"one":[{"value":"1 годину тому","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" години тому","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" годин тому","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" години тому","type":"plaintext"}]}},"day":{"default":{"one":[{"value":"1 день тому","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" дні тому","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" днів тому","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" дня тому","type":"plaintext"}]}},"week":{"default":{"one":[{"value":"1 тиждень тому","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" тижні тому","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" тижнів тому","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" тижня тому","type":"plaintext"}]}},"month":{"default":{"one":[{"value":"1 місяць тому","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" місяці тому","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" місяців тому","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" місяця тому","type":"plaintext"}]}},"year":{"default":{"one":[{"value":"1 рік тому","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" роки тому","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" років тому","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" року тому","type":"plaintext"}]}}},"until":{"second":{"default":{"one":[{"value":"Через 1 секунду","type":"plaintext"}],"few":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" секунди","type":"plaintext"}],"many":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" секунд","type":"plaintext"}],"other":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" секунди","type":"plaintext"}]}},"minute":{"default":{"one":[{"value":"Через 1 хвилину","type":"plaintext"}],"few":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" хвилини","type":"plaintext"}],"many":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" хвилин","type":"plaintext"}],"other":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" хвилини","type":"plaintext"}]}},"hour":{"default":{"one":[{"value":"Через 1 годину","type":"plaintext"}],"few":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" години","type":"plaintext"}],"many":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" годин","type":"plaintext"}],"other":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" години","type":"plaintext"}]}},"day":{"default":{"one":[{"value":"Через 1 день","type":"plaintext"}],"few":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" дні","type":"plaintext"}],"many":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" днів","type":"plaintext"}],"other":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" дня","type":"plaintext"}]}},"week":{"default":{"one":[{"value":"Через 1 тиждень","type":"plaintext"}],"few":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" тижні","type":"plaintext"}],"many":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" тижнів","type":"plaintext"}],"other":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" тижня","type":"plaintext"}]}},"month":{"default":{"one":[{"value":"Через 1 місяць","type":"plaintext"}],"few":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" місяці","type":"plaintext"}],"many":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" місяців","type":"plaintext"}],"other":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" місяця","type":"plaintext"}]}},"year":{"default":{"one":[{"value":"Через 1 рік","type":"plaintext"}],"few":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" роки","type":"plaintext"}],"many":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" років","type":"plaintext"}],"other":[{"value":"Через ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" року","type":"plaintext"}]}}},"none":{"second":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" секунда","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" секунди","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" секунд","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" секунди","type":"plaintext"}]},"short":{"one":[{"value":"{0}","type":"placeholder"},{"value":" сек.","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" сек.","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" сек.","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" сек.","type":"plaintext"}]},"abbreviated":{"one":[{"value":"{0}","type":"placeholder"},{"value":"с","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":"с","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":"с","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":"с","type":"plaintext"}]}},"minute":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" хвилина","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" хвилини","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" хвилин","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" хвилини","type":"plaintext"}]},"short":{"one":[{"value":"{0}","type":"placeholder"},{"value":" хв.","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" хв.","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" хв.","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" хв.","type":"plaintext"}]},"abbreviated":{"one":[{"value":"{0}","type":"placeholder"},{"value":" хв.","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" хв.","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" хв.","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" хв.","type":"plaintext"}]}},"hour":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" година","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" години","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" годин","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" години","type":"plaintext"}]},"short":{"one":[{"value":"{0}","type":"placeholder"},{"value":" год.","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" год.","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" год.","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" год.","type":"plaintext"}]},"abbreviated":{"one":[{"value":"{0}","type":"placeholder"},{"value":" год.","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" год.","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" год.","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" год.","type":"plaintext"}]}},"day":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" день","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" дні","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" днів","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" дня","type":"plaintext"}]},"short":{"one":[{"value":"{0}","type":"placeholder"},{"value":" день","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" дні","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" днів","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" дня","type":"plaintext"}]},"abbreviated":{"one":[{"value":"{0}","type":"placeholder"},{"value":" дн.","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" дн.","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" дн.","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" дн.","type":"plaintext"}]}},"week":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" тиждень","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" тижні","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" тижнів","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" тижня","type":"plaintext"}]},"short":{"one":[{"value":"{0}","type":"placeholder"},{"value":" тиж.","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" тиж.","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" тиж.","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" тиж.","type":"plaintext"}]}},"month":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" місяць","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" місяці","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" місяців","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" місяця","type":"plaintext"}]},"short":{"one":[{"value":"{0}","type":"placeholder"},{"value":" міс.","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" міс.","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" міс.","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" міс.","type":"plaintext"}]}},"year":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" рік","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" роки","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" років","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" року","type":"plaintext"}]},"short":{"one":[{"value":"{0}","type":"placeholder"},{"value":" р.","type":"plaintext"}],"few":[{"value":"{0}","type":"placeholder"},{"value":" р.","type":"plaintext"}],"many":[{"value":"{0}","type":"placeholder"},{"value":" р.","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" р.","type":"plaintext"}]}}}};
|
46
|
-
this.time_in_seconds = {
|
47
|
-
"second": 1,
|
48
|
-
"minute": 60,
|
49
|
-
"hour": 3600,
|
50
|
-
"day": 86400,
|
51
|
-
"week": 604800,
|
52
|
-
"month": 2629743.83,
|
53
|
-
"year": 31556926
|
54
|
-
};
|
55
|
-
}
|
56
|
-
|
57
|
-
TimespanFormatter.prototype.format = function(seconds, options) {
|
58
|
-
var number, strings, token;
|
59
|
-
if (options == null) {
|
60
|
-
options = {};
|
61
|
-
}
|
62
|
-
options["direction"] || (options["direction"] = (seconds < 0 ? "ago" : "until"));
|
63
|
-
if (options["unit"] === null || options["unit"] === void 0) {
|
64
|
-
options["unit"] = this.calculate_unit(Math.abs(seconds));
|
65
|
-
}
|
66
|
-
options["type"] || (options["type"] = this.default_type);
|
67
|
-
options["number"] = this.calculate_time(Math.abs(seconds), options["unit"]);
|
68
|
-
number = this.calculate_time(Math.abs(seconds), options["unit"]);
|
69
|
-
options["rule"] = TwitterCldr.PluralRules.rule_for(number);
|
70
|
-
strings = (function() {
|
71
|
-
var _i, _len, _ref, _results;
|
72
|
-
_ref = this.tokens[options["direction"]][options["unit"]][options["type"]][options["rule"]];
|
73
|
-
_results = [];
|
74
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
75
|
-
token = _ref[_i];
|
76
|
-
_results.push(token.value);
|
77
|
-
}
|
78
|
-
return _results;
|
79
|
-
}).call(this);
|
80
|
-
return strings.join("").replace(/\{[0-9]\}/, number.toString());
|
81
|
-
};
|
82
|
-
|
83
|
-
TimespanFormatter.prototype.calculate_unit = function(seconds) {
|
84
|
-
if (seconds < 30) {
|
85
|
-
return "second";
|
86
|
-
} else if (seconds < 2670) {
|
87
|
-
return "minute";
|
88
|
-
} else if (seconds < 86369) {
|
89
|
-
return "hour";
|
90
|
-
} else if (seconds < 604800) {
|
91
|
-
return "day";
|
92
|
-
} else if (seconds < 2591969) {
|
93
|
-
return "week";
|
94
|
-
} else if (seconds < 31556926) {
|
95
|
-
return "month";
|
96
|
-
} else {
|
97
|
-
return "year";
|
98
|
-
}
|
99
|
-
};
|
100
|
-
|
101
|
-
TimespanFormatter.prototype.calculate_time = function(seconds, unit) {
|
102
|
-
return Math.round(seconds / this.time_in_seconds[unit]);
|
103
|
-
};
|
104
|
-
|
105
|
-
return TimespanFormatter;
|
106
|
-
|
107
|
-
})();
|
108
|
-
|
109
|
-
TwitterCldr.DateTimeFormatter = DateTimeFormatter = (function() {
|
110
|
-
|
111
|
-
function DateTimeFormatter() {
|
112
|
-
this.tokens = {"date_time":{"default":[{"value":"d","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"HH","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":" ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" 'р'.","type":"plaintext"},{"value":" ","type":"plaintext"},{"value":"HH","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"zzzz","type":"pattern"}],"long":[{"value":"d","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" 'р'.","type":"plaintext"},{"value":" ","type":"plaintext"},{"value":"HH","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":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"HH","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"short":[{"value":"dd","type":"pattern"},{"value":".","type":"plaintext"},{"value":"MM","type":"pattern"},{"value":".","type":"plaintext"},{"value":"yy","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"HH","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"}]},"time":{"default":[{"value":"HH","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"full":[{"value":"HH","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"zzzz","type":"pattern"}],"long":[{"value":"HH","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":"HH","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"short":[{"value":"HH","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"}]},"date":{"default":[{"value":"d","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"full":[{"value":"EEEE","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" 'р'.","type":"plaintext"}],"long":[{"value":"d","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" 'р'.","type":"plaintext"}],"medium":[{"value":"d","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"short":[{"value":"dd","type":"pattern"},{"value":".","type":"plaintext"},{"value":"MM","type":"pattern"},{"value":".","type":"plaintext"},{"value":"yy","type":"pattern"}]}};
|
113
|
-
this.calendar = {"days":{"format":{"abbreviated":{"fri":"Пт","mon":"Пн","sat":"Сб","sun":"Нд","thu":"Чт","tue":"Вт","wed":"Ср"},"narrow":{"fri":"П","mon":"П","sat":"С","sun":"Н","thu":"Ч","tue":"В","wed":"С"},"wide":{"fri":"Пʼятниця","mon":"Понеділок","sat":"Субота","sun":"Неділя","thu":"Четвер","tue":"Вівторок","wed":"Середа"}},"stand-alone":{"abbreviated":{"fri":"Пт","mon":"Пн","sat":"Сб","sun":"Нд","thu":"Чт","tue":"Вт","wed":"Ср"},"narrow":{"fri":"П","mon":"П","sat":"С","sun":"Н","thu":"Ч","tue":"В","wed":"С"},"wide":{"fri":"Пʼятниця","mon":"Понеділок","sat":"Субота","sun":"Неділя","thu":"Четвер","tue":"Вівторок","wed":"Середа"}}},"eras":{"abbr":{"0":"до н.е.","1":"н.е."},"name":{"0":"до нашої ери","1":"нашої ери"},"narrow":{"0":""}},"fields":{"day":"День","dayperiod":"Частина доби","era":"Ера","hour":"Година","minute":"Хвилина","month":"Місяць","second":"Секунда","week":"Тиждень","weekday":"День тижня","year":"Рік","zone":"Зона"},"formats":{"date":{"default":{"pattern":"d MMM y"},"full":{"pattern":"EEEE, d MMMM y 'р'."},"long":{"pattern":"d MMMM y 'р'."},"medium":{"pattern":"d MMM y"},"short":{"pattern":"dd.MM.yy"}},"datetime":{"default":{"pattern":"{{date}} {{time}}"},"full":{"pattern":"{{date}} {{time}}"},"long":{"pattern":"{{date}} {{time}}"},"medium":{"pattern":"{{date}} {{time}}"},"short":{"pattern":"{{date}} {{time}}"}},"time":{"default":{"pattern":"HH:mm:ss"},"full":{"pattern":"HH:mm:ss zzzz"},"long":{"pattern":"HH:mm:ss z"},"medium":{"pattern":"HH:mm:ss"},"short":{"pattern":"HH:mm"}}},"months":{"format":{"abbreviated":{"1":"січ.","10":"жовт.","11":"лист.","12":"груд.","2":"лют.","3":"бер.","4":"квіт.","5":"трав.","6":"черв.","7":"лип.","8":"серп.","9":"вер."},"narrow":{"1":"С","10":"Ж","11":"Л","12":"Г","2":"Л","3":"Б","4":"К","5":"Т","6":"Ч","7":"Л","8":"С","9":"В"},"wide":{"1":"січня","10":"жовтня","11":"листопада","12":"грудня","2":"лютого","3":"березня","4":"квітня","5":"травня","6":"червня","7":"липня","8":"серпня","9":"вересня"}},"stand-alone":{"abbreviated":{"1":"Січ","10":"Жов","11":"Лис","12":"Гру","2":"Лют","3":"Бер","4":"Кві","5":"Тра","6":"Чер","7":"Лип","8":"Сер","9":"Вер"},"narrow":{"1":"С","10":"Ж","11":"Л","12":"Г","2":"Л","3":"Б","4":"К","5":"Т","6":"Ч","7":"Л","8":"С","9":"В"},"wide":{"1":"Січень","10":"Жовтень","11":"Листопад","12":"Грудень","2":"Лютий","3":"Березень","4":"Квітень","5":"Травень","6":"Червень","7":"Липень","8":"Серпень","9":"Вересень"}}},"periods":{"format":{"abbreviated":null,"narrow":null,"wide":{"afternoon":"дня","am":"дп","evening":"вечора","morning":"ранку","night":"ночі","pm":"пп"}},"stand-alone":{}},"quarters":{"format":{"abbreviated":{"1":"I кв.","2":"II кв.","3":"III кв.","4":"IV кв."},"narrow":{"1":1,"2":2,"3":3,"4":4},"wide":{"1":"I квартал","2":"II квартал","3":"III квартал","4":"IV квартал"}},"stand-alone":{"abbreviated":{"1":"1-й кв.","2":"2-й кв.","3":"3-й кв.","4":"4-й кв."},"narrow":{"1":1,"2":2,"3":3,"4":4},"wide":{"1":"1-й квартал","2":"2-й квартал","3":"3-й квартал","4":"4-й квартал"}}}};
|
114
|
-
this.weekday_keys = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
|
115
|
-
this.methods = {
|
116
|
-
'G': 'era',
|
117
|
-
'y': 'year',
|
118
|
-
'Y': 'year_of_week_of_year',
|
119
|
-
'Q': 'quarter',
|
120
|
-
'q': 'quarter_stand_alone',
|
121
|
-
'M': 'month',
|
122
|
-
'L': 'month_stand_alone',
|
123
|
-
'w': 'week_of_year',
|
124
|
-
'W': 'week_of_month',
|
125
|
-
'd': 'day',
|
126
|
-
'D': 'day_of_month',
|
127
|
-
'F': 'day_of_week_in_month',
|
128
|
-
'E': 'weekday',
|
129
|
-
'e': 'weekday_local',
|
130
|
-
'c': 'weekday_local_stand_alone',
|
131
|
-
'a': 'period',
|
132
|
-
'h': 'hour',
|
133
|
-
'H': 'hour',
|
134
|
-
'K': 'hour',
|
135
|
-
'k': 'hour',
|
136
|
-
'm': 'minute',
|
137
|
-
's': 'second',
|
138
|
-
'S': 'second_fraction',
|
139
|
-
'z': 'timezone',
|
140
|
-
'Z': 'timezone',
|
141
|
-
'v': 'timezone_generic_non_location',
|
142
|
-
'V': 'timezone_metazone'
|
143
|
-
};
|
144
|
-
}
|
145
|
-
|
146
|
-
DateTimeFormatter.prototype.format = function(obj, options) {
|
147
|
-
var format_token, token, tokens,
|
148
|
-
_this = this;
|
149
|
-
format_token = function(token) {
|
150
|
-
var result;
|
151
|
-
result = "";
|
152
|
-
switch (token.type) {
|
153
|
-
case "pattern":
|
154
|
-
return _this.result_for_token(token, obj);
|
155
|
-
default:
|
156
|
-
if (token.value.length > 0 && token.value[0] === "'" && token.value[token.value.length - 1] === "'") {
|
157
|
-
return token.value.substring(1, token.value.length - 1);
|
158
|
-
} else {
|
159
|
-
return token.value;
|
160
|
-
}
|
161
|
-
}
|
162
|
-
};
|
163
|
-
tokens = this.get_tokens(obj, options);
|
164
|
-
return ((function() {
|
165
|
-
var _i, _len, _results;
|
166
|
-
_results = [];
|
167
|
-
for (_i = 0, _len = tokens.length; _i < _len; _i++) {
|
168
|
-
token = tokens[_i];
|
169
|
-
_results.push(format_token(token));
|
170
|
-
}
|
171
|
-
return _results;
|
172
|
-
})()).join("");
|
173
|
-
};
|
174
|
-
|
175
|
-
DateTimeFormatter.prototype.get_tokens = function(obj, options) {
|
176
|
-
return this.tokens[options.format || "date_time"][options.type || "default"];
|
177
|
-
};
|
178
|
-
|
179
|
-
DateTimeFormatter.prototype.result_for_token = function(token, date) {
|
180
|
-
return this[this.methods[token.value[0]]](date, token.value, token.value.length);
|
181
|
-
};
|
182
|
-
|
183
|
-
DateTimeFormatter.prototype.era = function(date, pattern, length) {
|
184
|
-
var choices, index;
|
185
|
-
switch (length) {
|
186
|
-
case 1:
|
187
|
-
case 2:
|
188
|
-
case 3:
|
189
|
-
choices = this.calendar["eras"]["abbr"];
|
190
|
-
break;
|
191
|
-
default:
|
192
|
-
choices = this.calendar["eras"]["name"];
|
193
|
-
}
|
194
|
-
index = date.getFullYear() < 0 ? 0 : 1;
|
195
|
-
return choices[index];
|
196
|
-
};
|
197
|
-
|
198
|
-
DateTimeFormatter.prototype.year = function(date, pattern, length) {
|
199
|
-
var year;
|
200
|
-
year = date.getFullYear().toString();
|
201
|
-
if (length === 2) {
|
202
|
-
if (year.length !== 1) {
|
203
|
-
year = year.slice(-2);
|
204
|
-
}
|
205
|
-
}
|
206
|
-
if (length > 1) {
|
207
|
-
year = ("0000" + year).slice(-length);
|
208
|
-
}
|
209
|
-
return year;
|
210
|
-
};
|
211
|
-
|
212
|
-
DateTimeFormatter.prototype.year_of_week_of_year = function(date, pattern, length) {
|
213
|
-
throw 'not implemented';
|
214
|
-
};
|
215
|
-
|
216
|
-
DateTimeFormatter.prototype.day_of_week_in_month = function(date, pattern, length) {
|
217
|
-
throw 'not implemented';
|
218
|
-
};
|
219
|
-
|
220
|
-
DateTimeFormatter.prototype.quarter = function(date, pattern, length) {
|
221
|
-
var quarter;
|
222
|
-
quarter = ((date.getMonth() / 3) | 0) + 1;
|
223
|
-
switch (length) {
|
224
|
-
case 1:
|
225
|
-
return quarter.toString();
|
226
|
-
case 2:
|
227
|
-
return ("0000" + quarter.toString()).slice(-length);
|
228
|
-
case 3:
|
229
|
-
return this.calendar.quarters.format.abbreviated[quarter];
|
230
|
-
case 4:
|
231
|
-
return this.calendar.quarters.format.wide[quarter];
|
232
|
-
}
|
233
|
-
};
|
234
|
-
|
235
|
-
DateTimeFormatter.prototype.quarter_stand_alone = function(date, pattern, length) {
|
236
|
-
var quarter;
|
237
|
-
quarter = (date.getMonth() - 1) / 3 + 1;
|
238
|
-
switch (length) {
|
239
|
-
case 1:
|
240
|
-
return quarter.toString();
|
241
|
-
case 2:
|
242
|
-
return ("0000" + quarter.toString()).slice(-length);
|
243
|
-
case 3:
|
244
|
-
throw 'not yet implemented (requires cldr\'s "multiple inheritance")';
|
245
|
-
break;
|
246
|
-
case 4:
|
247
|
-
throw 'not yet implemented (requires cldr\'s "multiple inheritance")';
|
248
|
-
break;
|
249
|
-
case 5:
|
250
|
-
return this.calendar.quarters['stand-alone'].narrow[quarter];
|
251
|
-
}
|
252
|
-
};
|
253
|
-
|
254
|
-
DateTimeFormatter.prototype.month = function(date, pattern, length) {
|
255
|
-
var month_str;
|
256
|
-
month_str = (date.getMonth() + 1).toString();
|
257
|
-
switch (length) {
|
258
|
-
case 1:
|
259
|
-
return month_str;
|
260
|
-
case 2:
|
261
|
-
return ("0000" + month_str).slice(-length);
|
262
|
-
case 3:
|
263
|
-
return this.calendar.months.format.abbreviated[month_str];
|
264
|
-
case 4:
|
265
|
-
return this.calendar.months.format.wide[month_str];
|
266
|
-
case 5:
|
267
|
-
throw 'not yet implemented (requires cldr\'s "multiple inheritance")';
|
268
|
-
break;
|
269
|
-
default:
|
270
|
-
throw "Unknown date format";
|
271
|
-
}
|
272
|
-
};
|
273
|
-
|
274
|
-
DateTimeFormatter.prototype.month_stand_alone = function(date, pattern, length) {
|
275
|
-
switch (length) {
|
276
|
-
case 1:
|
277
|
-
return date.getMonth().toString();
|
278
|
-
case 2:
|
279
|
-
return ("0000" + date.getMonth().toString()).slice(-length);
|
280
|
-
case 3:
|
281
|
-
throw 'not yet implemented (requires cldr\'s "multiple inheritance")';
|
282
|
-
break;
|
283
|
-
case 4:
|
284
|
-
throw 'not yet implemented (requires cldr\'s "multiple inheritance")';
|
285
|
-
break;
|
286
|
-
case 5:
|
287
|
-
return this.calendar.months['stand-alone'].narrow[date.month];
|
288
|
-
default:
|
289
|
-
throw "Unknown date format";
|
290
|
-
}
|
291
|
-
};
|
292
|
-
|
293
|
-
DateTimeFormatter.prototype.day = function(date, pattern, length) {
|
294
|
-
switch (length) {
|
295
|
-
case 1:
|
296
|
-
return date.getDate().toString();
|
297
|
-
case 2:
|
298
|
-
return ("0000" + date.getDate().toString()).slice(-length);
|
299
|
-
}
|
300
|
-
};
|
301
|
-
|
302
|
-
DateTimeFormatter.prototype.weekday = function(date, pattern, length) {
|
303
|
-
var key;
|
304
|
-
key = this.weekday_keys[date.getDay()];
|
305
|
-
switch (length) {
|
306
|
-
case 1:
|
307
|
-
case 2:
|
308
|
-
case 3:
|
309
|
-
return this.calendar.days.format.abbreviated[key];
|
310
|
-
case 4:
|
311
|
-
return this.calendar.days.format.wide[key];
|
312
|
-
case 5:
|
313
|
-
return this.calendar.days['stand-alone'].narrow[key];
|
314
|
-
}
|
315
|
-
};
|
316
|
-
|
317
|
-
DateTimeFormatter.prototype.weekday_local = function(date, pattern, length) {
|
318
|
-
var day;
|
319
|
-
switch (length) {
|
320
|
-
case 1:
|
321
|
-
case 2:
|
322
|
-
day = date.getDay();
|
323
|
-
return (day === 0 ? "7" : day.toString());
|
324
|
-
default:
|
325
|
-
return this.weekday(date, pattern, length);
|
326
|
-
}
|
327
|
-
};
|
328
|
-
|
329
|
-
DateTimeFormatter.prototype.weekday_local_stand_alone = function(date, pattern, length) {
|
330
|
-
switch (length) {
|
331
|
-
case 1:
|
332
|
-
return this.weekday_local(date, pattern, length);
|
333
|
-
default:
|
334
|
-
return this.weekday(date, pattern, length);
|
335
|
-
}
|
336
|
-
};
|
337
|
-
|
338
|
-
DateTimeFormatter.prototype.period = function(time, pattern, length) {
|
339
|
-
if (time.getHours() > 11) {
|
340
|
-
return this.calendar.periods.format.wide["pm"];
|
341
|
-
} else {
|
342
|
-
return this.calendar.periods.format.wide["am"];
|
343
|
-
}
|
344
|
-
};
|
345
|
-
|
346
|
-
DateTimeFormatter.prototype.hour = function(time, pattern, length) {
|
347
|
-
var hour;
|
348
|
-
hour = time.getHours();
|
349
|
-
switch (pattern[0]) {
|
350
|
-
case 'h':
|
351
|
-
if (hour > 12) {
|
352
|
-
hour = hour - 12;
|
353
|
-
} else if (hour === 0) {
|
354
|
-
hour = 12;
|
355
|
-
}
|
356
|
-
break;
|
357
|
-
case 'K':
|
358
|
-
if (hour > 11) {
|
359
|
-
hour = hour - 12;
|
360
|
-
}
|
361
|
-
break;
|
362
|
-
case 'k':
|
363
|
-
if (hour === 0) {
|
364
|
-
hour = 24;
|
365
|
-
}
|
366
|
-
}
|
367
|
-
if (length === 1) {
|
368
|
-
return hour.toString();
|
369
|
-
} else {
|
370
|
-
return ("000000" + hour.toString()).slice(-length);
|
371
|
-
}
|
372
|
-
};
|
373
|
-
|
374
|
-
DateTimeFormatter.prototype.minute = function(time, pattern, length) {
|
375
|
-
if (length === 1) {
|
376
|
-
return time.getMinutes().toString();
|
377
|
-
} else {
|
378
|
-
return ("000000" + time.getMinutes().toString()).slice(-length);
|
379
|
-
}
|
380
|
-
};
|
381
|
-
|
382
|
-
DateTimeFormatter.prototype.second = function(time, pattern, length) {
|
383
|
-
if (length === 1) {
|
384
|
-
return time.getSeconds().toString();
|
385
|
-
} else {
|
386
|
-
return ("000000" + time.getSeconds().toString()).slice(-length);
|
387
|
-
}
|
388
|
-
};
|
389
|
-
|
390
|
-
DateTimeFormatter.prototype.second_fraction = function(time, pattern, length) {
|
391
|
-
if (length > 6) {
|
392
|
-
throw 'can not use the S format with more than 6 digits';
|
393
|
-
}
|
394
|
-
return ("000000" + Math.round(Math.pow(time.getMilliseconds() * 100.0, 6 - length)).toString()).slice(-length);
|
395
|
-
};
|
396
|
-
|
397
|
-
DateTimeFormatter.prototype.timezone = function(time, pattern, length) {
|
398
|
-
var hours, minutes;
|
399
|
-
hours = ("00" + (time.getTimezoneOffset() / 60).toString()).slice(-2);
|
400
|
-
minutes = ("00" + (time.getTimezoneOffset() % 60).toString()).slice(-2);
|
401
|
-
switch (length) {
|
402
|
-
case 1:
|
403
|
-
case 2:
|
404
|
-
case 3:
|
405
|
-
return "-" + hours + ":" + minutes;
|
406
|
-
default:
|
407
|
-
return "UTC -" + hours + ":" + minutes;
|
408
|
-
}
|
409
|
-
};
|
410
|
-
|
411
|
-
DateTimeFormatter.prototype.timezone_generic_non_location = function(time, pattern, length) {
|
412
|
-
throw 'not yet implemented (requires timezone translation data")';
|
413
|
-
};
|
414
|
-
|
415
|
-
return DateTimeFormatter;
|
416
|
-
|
417
|
-
})();
|
418
|
-
|
419
|
-
TwitterCldr.NumberFormatter = NumberFormatter = (function() {
|
420
|
-
|
421
|
-
function NumberFormatter() {
|
422
|
-
this.all_tokens = {"decimal":{"positive":["","#,##0.###"],"negative":["-","#,##0.###"]},"percent":{"positive":["","#,##0","%"],"negative":["-","#,##0","%"]},"currency":{"positive":["","#,##0.00"," ¤"],"negative":["-","#,##0.00"," ¤"]}};
|
423
|
-
this.tokens = [];
|
424
|
-
this.symbols = {"alias":"","decimal":",","exponential":"Е","group":" ","infinity":"∞","list":";","minus_sign":"-","nan":"Не число","per_mille":"‰","percent_sign":"%","plus_sign":"+"};
|
425
|
-
this.default_symbols = {
|
426
|
-
'group': ',',
|
427
|
-
'decimal': '.',
|
428
|
-
'plus_sign': '+',
|
429
|
-
'minus_sign': '-'
|
430
|
-
};
|
431
|
-
}
|
432
|
-
|
433
|
-
NumberFormatter.prototype.format = function(number, options) {
|
434
|
-
var fraction, fraction_format, int, integer_format, key, opts, prefix, result, sign, suffix, val, _ref, _ref1;
|
435
|
-
if (options == null) {
|
436
|
-
options = {};
|
437
|
-
}
|
438
|
-
opts = this.default_format_options_for(number);
|
439
|
-
for (key in options) {
|
440
|
-
val = options[key];
|
441
|
-
opts[key] = options[key] != null ? options[key] : opts[key];
|
442
|
-
}
|
443
|
-
_ref = this.partition_tokens(this.get_tokens(number, opts)), prefix = _ref[0], suffix = _ref[1], integer_format = _ref[2], fraction_format = _ref[3];
|
444
|
-
_ref1 = this.parse_number(number, opts), int = _ref1[0], fraction = _ref1[1];
|
445
|
-
result = integer_format.apply(parseFloat(int), opts);
|
446
|
-
if (fraction) {
|
447
|
-
result += fraction_format.apply(fraction, opts);
|
448
|
-
}
|
449
|
-
sign = number < 0 && prefix !== "-" ? this.symbols.minus_sign || this.default_symbols.minus_sign : "";
|
450
|
-
return "" + prefix + result + suffix;
|
451
|
-
};
|
452
|
-
|
453
|
-
NumberFormatter.prototype.partition_tokens = function(tokens) {
|
454
|
-
return [tokens[0] || "", tokens[2] || "", new IntegerHelper(tokens[1], this.symbols), new FractionHelper(tokens[1], this.symbols)];
|
455
|
-
};
|
456
|
-
|
457
|
-
NumberFormatter.prototype.parse_number = function(number, options) {
|
458
|
-
var precision;
|
459
|
-
if (options == null) {
|
460
|
-
options = {};
|
461
|
-
}
|
462
|
-
if (options.precision != null) {
|
463
|
-
precision = options.precision;
|
464
|
-
} else {
|
465
|
-
precision = this.precision_from(number);
|
466
|
-
}
|
467
|
-
number = this.round_to(number, precision);
|
468
|
-
return Math.abs(number).toFixed(precision).split(".");
|
469
|
-
};
|
470
|
-
|
471
|
-
NumberFormatter.prototype.precision_from = function(num) {
|
472
|
-
var parts;
|
473
|
-
parts = num.toString().split(".");
|
474
|
-
if (parts.length === 2) {
|
475
|
-
return parts[1].length;
|
476
|
-
} else {
|
477
|
-
return 0;
|
478
|
-
}
|
479
|
-
};
|
480
|
-
|
481
|
-
NumberFormatter.prototype.round_to = function(number, precision) {
|
482
|
-
var factor;
|
483
|
-
factor = Math.pow(10, precision);
|
484
|
-
return Math.round(number * factor) / factor;
|
485
|
-
};
|
486
|
-
|
487
|
-
NumberFormatter.prototype.get_tokens = function() {
|
488
|
-
throw "get_tokens() not implemented - use a derived class like PercentFormatter.";
|
489
|
-
};
|
490
|
-
|
491
|
-
return NumberFormatter;
|
492
|
-
|
493
|
-
})();
|
494
|
-
|
495
|
-
TwitterCldr.PercentFormatter = PercentFormatter = (function(_super) {
|
496
|
-
|
497
|
-
__extends(PercentFormatter, _super);
|
498
|
-
|
499
|
-
function PercentFormatter(options) {
|
500
|
-
if (options == null) {
|
501
|
-
options = {};
|
502
|
-
}
|
503
|
-
this.default_percent_sign = "%";
|
504
|
-
PercentFormatter.__super__.constructor.apply(this, arguments);
|
505
|
-
}
|
506
|
-
|
507
|
-
PercentFormatter.prototype.format = function(number, options) {
|
508
|
-
if (options == null) {
|
509
|
-
options = {};
|
510
|
-
}
|
511
|
-
return PercentFormatter.__super__.format.call(this, number, options).replace('¤', this.symbols.percent_sign || this.default_percent_sign);
|
512
|
-
};
|
513
|
-
|
514
|
-
PercentFormatter.prototype.default_format_options_for = function(number) {
|
515
|
-
return {
|
516
|
-
precision: 0
|
517
|
-
};
|
518
|
-
};
|
519
|
-
|
520
|
-
PercentFormatter.prototype.get_tokens = function(number, options) {
|
521
|
-
if (number < 0) {
|
522
|
-
return this.all_tokens.percent.negative;
|
523
|
-
} else {
|
524
|
-
return this.all_tokens.percent.positive;
|
525
|
-
}
|
526
|
-
};
|
527
|
-
|
528
|
-
return PercentFormatter;
|
529
|
-
|
530
|
-
})(NumberFormatter);
|
531
|
-
|
532
|
-
TwitterCldr.DecimalFormatter = DecimalFormatter = (function(_super) {
|
533
|
-
|
534
|
-
__extends(DecimalFormatter, _super);
|
535
|
-
|
536
|
-
function DecimalFormatter() {
|
537
|
-
return DecimalFormatter.__super__.constructor.apply(this, arguments);
|
538
|
-
}
|
539
|
-
|
540
|
-
DecimalFormatter.prototype.format = function(number, options) {
|
541
|
-
if (options == null) {
|
542
|
-
options = {};
|
543
|
-
}
|
544
|
-
try {
|
545
|
-
return DecimalFormatter.__super__.format.call(this, number, options);
|
546
|
-
} catch (error) {
|
547
|
-
return number;
|
548
|
-
}
|
549
|
-
};
|
550
|
-
|
551
|
-
DecimalFormatter.prototype.default_format_options_for = function(number) {
|
552
|
-
return {
|
553
|
-
precision: this.precision_from(number)
|
554
|
-
};
|
555
|
-
};
|
556
|
-
|
557
|
-
DecimalFormatter.prototype.get_tokens = function(number, options) {
|
558
|
-
if (options == null) {
|
559
|
-
options = {};
|
560
|
-
}
|
561
|
-
if (number < 0) {
|
562
|
-
return this.all_tokens.decimal.negative;
|
563
|
-
} else {
|
564
|
-
return this.all_tokens.decimal.positive;
|
565
|
-
}
|
566
|
-
};
|
567
|
-
|
568
|
-
return DecimalFormatter;
|
569
|
-
|
570
|
-
})(NumberFormatter);
|
571
|
-
|
572
|
-
TwitterCldr.CurrencyFormatter = CurrencyFormatter = (function(_super) {
|
573
|
-
|
574
|
-
__extends(CurrencyFormatter, _super);
|
575
|
-
|
576
|
-
function CurrencyFormatter(options) {
|
577
|
-
if (options == null) {
|
578
|
-
options = {};
|
579
|
-
}
|
580
|
-
this.default_currency_symbol = "$";
|
581
|
-
this.default_precision = 2;
|
582
|
-
CurrencyFormatter.__super__.constructor.apply(this, arguments);
|
583
|
-
}
|
584
|
-
|
585
|
-
CurrencyFormatter.prototype.format = function(number, options) {
|
586
|
-
var currency;
|
587
|
-
if (options == null) {
|
588
|
-
options = {};
|
589
|
-
}
|
590
|
-
if (options.currency) {
|
591
|
-
if (TwitterCldr.Currencies != null) {
|
592
|
-
currency = TwitterCldr.Currencies.for_code(options.currency);
|
593
|
-
currency || (currency = TwitterCldr.Currencies.for_country(options.currency));
|
594
|
-
currency || (currency = {
|
595
|
-
symbol: options.currency
|
596
|
-
});
|
597
|
-
} else {
|
598
|
-
currency = {
|
599
|
-
symbol: options.currency
|
600
|
-
};
|
601
|
-
}
|
602
|
-
} else {
|
603
|
-
currency = {
|
604
|
-
symbol: this.default_currency_symbol
|
605
|
-
};
|
606
|
-
}
|
607
|
-
return CurrencyFormatter.__super__.format.call(this, number, options).replace('¤', currency.symbol);
|
608
|
-
};
|
609
|
-
|
610
|
-
CurrencyFormatter.prototype.default_format_options_for = function(number) {
|
611
|
-
var precision;
|
612
|
-
precision = this.precision_from(number);
|
613
|
-
if (precision === 0) {
|
614
|
-
precision = this.default_precision;
|
615
|
-
}
|
616
|
-
return {
|
617
|
-
precision: precision
|
618
|
-
};
|
619
|
-
};
|
620
|
-
|
621
|
-
CurrencyFormatter.prototype.get_tokens = function(number, options) {
|
622
|
-
if (options == null) {
|
623
|
-
options = {};
|
624
|
-
}
|
625
|
-
if (number < 0) {
|
626
|
-
return this.all_tokens.currency.negative;
|
627
|
-
} else {
|
628
|
-
return this.all_tokens.currency.positive;
|
629
|
-
}
|
630
|
-
};
|
631
|
-
|
632
|
-
return CurrencyFormatter;
|
633
|
-
|
634
|
-
})(NumberFormatter);
|
635
|
-
|
636
|
-
TwitterCldr.NumberFormatter.BaseHelper = BaseHelper = (function() {
|
637
|
-
|
638
|
-
function BaseHelper() {}
|
639
|
-
|
640
|
-
BaseHelper.prototype.interpolate = function(string, value, orientation) {
|
641
|
-
var i, length, start;
|
642
|
-
if (orientation == null) {
|
643
|
-
orientation = "right";
|
644
|
-
}
|
645
|
-
value = value.toString();
|
646
|
-
length = value.length;
|
647
|
-
start = orientation === "left" ? 0 : -length;
|
648
|
-
if (string.length < length) {
|
649
|
-
string = (((function() {
|
650
|
-
var _i, _results;
|
651
|
-
_results = [];
|
652
|
-
for (i = _i = 0; 0 <= length ? _i < length : _i > length; i = 0 <= length ? ++_i : --_i) {
|
653
|
-
_results.push("#");
|
654
|
-
}
|
655
|
-
return _results;
|
656
|
-
})()).join("") + string).slice(-length);
|
657
|
-
}
|
658
|
-
if (start < 0) {
|
659
|
-
string = string.slice(0, start + string.length) + value;
|
660
|
-
} else {
|
661
|
-
string = string.slice(0, start) + value + string.slice(length);
|
662
|
-
}
|
663
|
-
return string.replace(/#/g, "");
|
664
|
-
};
|
665
|
-
|
666
|
-
return BaseHelper;
|
667
|
-
|
668
|
-
})();
|
669
|
-
|
670
|
-
TwitterCldr.NumberFormatter.IntegerHelper = IntegerHelper = (function(_super) {
|
671
|
-
|
672
|
-
__extends(IntegerHelper, _super);
|
673
|
-
|
674
|
-
function IntegerHelper(token, symbols) {
|
675
|
-
var format;
|
676
|
-
if (symbols == null) {
|
677
|
-
symbols = {};
|
678
|
-
}
|
679
|
-
format = token.split('.')[0];
|
680
|
-
this.format = this.prepare_format(format, symbols);
|
681
|
-
this.groups = this.parse_groups(format);
|
682
|
-
this.separator = symbols.group || ',';
|
683
|
-
}
|
684
|
-
|
685
|
-
IntegerHelper.prototype.apply = function(number, options) {
|
686
|
-
if (options == null) {
|
687
|
-
options = {};
|
688
|
-
}
|
689
|
-
return this.format_groups(this.interpolate(this.format, parseInt(number)));
|
690
|
-
};
|
691
|
-
|
692
|
-
IntegerHelper.prototype.format_groups = function(string) {
|
693
|
-
var cur_token, token, tokens;
|
694
|
-
if (this.groups.length === 0) {
|
695
|
-
return string;
|
696
|
-
}
|
697
|
-
tokens = [];
|
698
|
-
cur_token = this.chop_group(string, this.groups[0]);
|
699
|
-
tokens.push(cur_token);
|
700
|
-
if (cur_token) {
|
701
|
-
string = string.slice(0, string.length - cur_token.length);
|
702
|
-
}
|
703
|
-
while (string.length > this.groups[this.groups.length - 1]) {
|
704
|
-
cur_token = this.chop_group(string, this.groups[this.groups.length - 1]);
|
705
|
-
tokens.push(cur_token);
|
706
|
-
if (cur_token) {
|
707
|
-
string = string.slice(0, string.length - cur_token.length);
|
708
|
-
}
|
709
|
-
}
|
710
|
-
tokens.push(string);
|
711
|
-
return ((function() {
|
712
|
-
var _i, _len, _results;
|
713
|
-
_results = [];
|
714
|
-
for (_i = 0, _len = tokens.length; _i < _len; _i++) {
|
715
|
-
token = tokens[_i];
|
716
|
-
if (token !== null) {
|
717
|
-
_results.push(token);
|
718
|
-
}
|
719
|
-
}
|
720
|
-
return _results;
|
721
|
-
})()).reverse().join(this.separator);
|
722
|
-
};
|
723
|
-
|
724
|
-
IntegerHelper.prototype.parse_groups = function(format) {
|
725
|
-
var index, rest, width, widths;
|
726
|
-
if (!(index = format.lastIndexOf(','))) {
|
727
|
-
return [];
|
728
|
-
}
|
729
|
-
rest = format.slice(0, index);
|
730
|
-
widths = [format.length - index - 1];
|
731
|
-
if (rest.lastIndexOf(',') > -1) {
|
732
|
-
widths.push(rest.length - rest.lastIndexOf(',') - 1);
|
733
|
-
}
|
734
|
-
widths = (function() {
|
735
|
-
var _i, _len, _results;
|
736
|
-
_results = [];
|
737
|
-
for (_i = 0, _len = widths.length; _i < _len; _i++) {
|
738
|
-
width = widths[_i];
|
739
|
-
if (width !== null) {
|
740
|
-
_results.push(width);
|
741
|
-
}
|
742
|
-
}
|
743
|
-
return _results;
|
744
|
-
})();
|
745
|
-
widths.reverse();
|
746
|
-
return ((function() {
|
747
|
-
var _i, _ref, _results;
|
748
|
-
_results = [];
|
749
|
-
for (index = _i = 0, _ref = widths.length; 0 <= _ref ? _i < _ref : _i > _ref; index = 0 <= _ref ? ++_i : --_i) {
|
750
|
-
if (widths.indexOf(widths[index], index + 1) === -1) {
|
751
|
-
_results.push(widths[index]);
|
752
|
-
}
|
753
|
-
}
|
754
|
-
return _results;
|
755
|
-
})()).reverse();
|
756
|
-
};
|
757
|
-
|
758
|
-
IntegerHelper.prototype.chop_group = function(string, size) {
|
759
|
-
if (string.length > size) {
|
760
|
-
return string.slice(-size);
|
761
|
-
} else {
|
762
|
-
return null;
|
763
|
-
}
|
764
|
-
};
|
765
|
-
|
766
|
-
IntegerHelper.prototype.prepare_format = function(format, symbols) {
|
767
|
-
return format.replace(",", "").replace("+", symbols.plus_sign).replace("-", symbols.minus_sign);
|
768
|
-
};
|
769
|
-
|
770
|
-
return IntegerHelper;
|
771
|
-
|
772
|
-
})(BaseHelper);
|
773
|
-
|
774
|
-
TwitterCldr.NumberFormatter.FractionHelper = FractionHelper = (function(_super) {
|
775
|
-
|
776
|
-
__extends(FractionHelper, _super);
|
777
|
-
|
778
|
-
function FractionHelper(token, symbols) {
|
779
|
-
if (symbols == null) {
|
780
|
-
symbols = {};
|
781
|
-
}
|
782
|
-
this.format = token ? token.split('.').pop() : "";
|
783
|
-
this.decimal = symbols.decimal || ".";
|
784
|
-
this.precision = this.format.length;
|
785
|
-
}
|
786
|
-
|
787
|
-
FractionHelper.prototype.apply = function(fraction, options) {
|
788
|
-
var precision;
|
789
|
-
if (options == null) {
|
790
|
-
options = {};
|
791
|
-
}
|
792
|
-
precision = options.precision != null ? options.precision : this.precision;
|
793
|
-
if (precision > 0) {
|
794
|
-
return this.decimal + this.interpolate(this.format_for(options), fraction, "left");
|
795
|
-
} else {
|
796
|
-
return "";
|
797
|
-
}
|
798
|
-
};
|
799
|
-
|
800
|
-
FractionHelper.prototype.format_for = function(options) {
|
801
|
-
var i, precision;
|
802
|
-
precision = options.precision != null ? options.precision : this.precision;
|
803
|
-
if (precision) {
|
804
|
-
return ((function() {
|
805
|
-
var _i, _results;
|
806
|
-
_results = [];
|
807
|
-
for (i = _i = 0; 0 <= precision ? _i < precision : _i > precision; i = 0 <= precision ? ++_i : --_i) {
|
808
|
-
_results.push("0");
|
809
|
-
}
|
810
|
-
return _results;
|
811
|
-
})()).join("");
|
812
|
-
} else {
|
813
|
-
return this.format;
|
814
|
-
}
|
815
|
-
};
|
816
|
-
|
817
|
-
return FractionHelper;
|
818
|
-
|
819
|
-
})(BaseHelper);
|
820
|
-
|
821
|
-
TwitterCldr.Currencies = Currencies = (function() {
|
822
|
-
|
823
|
-
function Currencies() {}
|
824
|
-
|
825
|
-
Currencies.currencies = {"Afghanistan":{"code":"AFN","currency":"Afghani","symbol":"؋"},"Albania":{"code":"ALL","currency":"Lek","symbol":"Lek"},"Argentina":{"code":"ARS","currency":"Peso","symbol":"$"},"Aruba":{"code":"AWG","currency":"Guilder","symbol":"ƒ"},"Australia":{"code":"AUD","currency":"Dollar","symbol":"$"},"Azerbaijan":{"code":"AZN","currency":"New Manat","symbol":"ман"},"Bahamas":{"code":"BSD","currency":"Dollar","symbol":"$"},"Barbados":{"code":"BBD","currency":"Dollar","symbol":"$"},"Belarus":{"code":"BYR","currency":"Ruble","symbol":"p."},"Belize":{"code":"BZD","currency":"Dollar","symbol":"BZ$"},"Bermuda":{"code":"BMD","currency":"Dollar","symbol":"$"},"Bolivia":{"code":"BOB","currency":"Boliviano","symbol":"$b"},"Bosnia and Herzegovina":{"code":"BAM","currency":"Convertible Marka","symbol":"KM"},"Botswana":{"code":"BWP","currency":"Pula","symbol":"P"},"Brazil":{"code":"BRL","currency":"Real","symbol":"R$"},"Brunei Darussalam":{"code":"BND","currency":"Dollar","symbol":"$"},"Bulgaria":{"code":"BGN","currency":"Lev","symbol":"лв"},"Cambodia":{"code":"KHR","currency":"Riel","symbol":"៛"},"Canada":{"code":"CAD","currency":"Dollar","symbol":"$"},"Cayman Islands":{"code":"KYD","currency":"Dollar","symbol":"$"},"Chile":{"code":"CLP","currency":"Peso","symbol":"$"},"China":{"code":"CNY","currency":"Yuan Renminbi","symbol":"¥"},"Colombia":{"code":"COP","currency":"Peso","symbol":"$"},"Costa Rica":{"code":"CRC","currency":"Colon","symbol":"₡"},"Croatia":{"code":"HRK","currency":"Kuna","symbol":"kn"},"Cuba":{"code":"CUP","currency":"Peso","symbol":"₱"},"Czech Republic":{"code":"CZK","currency":"Koruna","symbol":"Kč"},"Denmark":{"code":"DKK","currency":"Krone","symbol":"kr"},"Dominican Republic":{"code":"DOP","currency":"Peso","symbol":"RD$"},"East Caribbean":{"code":"XCD","currency":"Dollar","symbol":"$"},"Egypt":{"code":"EGP","currency":"Pound","symbol":"£"},"El Salvador":{"code":"SVC","currency":"Colon","symbol":"$"},"Estonia":{"code":"EEK","currency":"Kroon","symbol":"kr"},"Euro Member Countries":{"code":"EUR","currency":"European Union","symbol":"€"},"Falkland Islands (Malvinas)":{"code":"FKP","currency":"Pound","symbol":"£"},"Fiji":{"code":"FJD","currency":"Dollar","symbol":"$"},"Ghana":{"code":"GHC","currency":"Cedis","symbol":"¢"},"Gibraltar":{"code":"GIP","currency":"Pound","symbol":"£"},"Guatemala":{"code":"GTQ","currency":"Quetzal","symbol":"Q"},"Guernsey":{"code":"GGP","currency":"Pound","symbol":"£"},"Guyana":{"code":"GYD","currency":"Dollar","symbol":"$"},"Honduras":{"code":"HNL","currency":"Lempira","symbol":"L"},"Hong Kong":{"code":"HKD","currency":"Dollar","symbol":"$"},"Hungary":{"code":"HUF","currency":"Forint","symbol":"Ft"},"Iceland":{"code":"ISK","currency":"Krona","symbol":"kr"},"India":{"code":"INR","currency":"Rupee","symbol":"₨"},"Indonesia":{"code":"IDR","currency":"Rupiah","symbol":"Rp"},"Iran":{"code":"IRR","currency":"Rial","symbol":"﷼"},"Isle of Man":{"code":"IMP","currency":"Pound","symbol":"£"},"Israel":{"code":"ILS","currency":"Shekel","symbol":"₪"},"Jamaica":{"code":"JMD","currency":"Dollar","symbol":"J$"},"Japan":{"code":"JPY","currency":"Yen","symbol":"¥"},"Jersey":{"code":"JEP","currency":"Pound","symbol":"£"},"Kazakhstan":{"code":"KZT","currency":"Tenge","symbol":"лв"},"Kyrgyzstan":{"code":"KGS","currency":"Som","symbol":"лв"},"Laos":{"code":"LAK","currency":"Kip","symbol":"₭"},"Latvia":{"code":"LVL","currency":"Lat","symbol":"Ls"},"Lebanon":{"code":"LBP","currency":"Pound","symbol":"£"},"Liberia":{"code":"LRD","currency":"Dollar","symbol":"$"},"Lithuania":{"code":"LTL","currency":"Litas","symbol":"Lt"},"Macedonia":{"code":"MKD","currency":"Denar","symbol":"ден"},"Malaysia":{"code":"MYR","currency":"Ringgit","symbol":"RM"},"Mauritius":{"code":"MUR","currency":"Rupee","symbol":"₨"},"Mexico":{"code":"MXN","currency":"Peso","symbol":"$"},"Mongolia":{"code":"MNT","currency":"Tughrik","symbol":"₮"},"Mozambique":{"code":"MZN","currency":"Metical","symbol":"MT"},"Namibia":{"code":"NAD","currency":"Dollar","symbol":"$"},"Nepal":{"code":"NPR","currency":"Rupee","symbol":"₨"},"Netherlands Antilles":{"code":"ANG","currency":"Guilder","symbol":"ƒ"},"New Zealand":{"code":"NZD","currency":"Dollar","symbol":"$"},"Nicaragua":{"code":"NIO","currency":"Cordoba","symbol":"C$"},"Nigeria":{"code":"NGN","currency":"Naira","symbol":"₦"},"North Korea":{"code":"KPW","currency":"Won","symbol":"₩"},"Norway":{"code":"NOK","currency":"Krone","symbol":"kr"},"Oman":{"code":"OMR","currency":"Rial","symbol":"﷼"},"Pakistan":{"code":"PKR","currency":"Rupee","symbol":"₨"},"Panama":{"code":"PAB","currency":"Balboa","symbol":"B/."},"Paraguay":{"code":"PYG","currency":"Guarani","symbol":"Gs"},"Peru":{"code":"PEN","currency":"Nuevo Sol","symbol":"S/."},"Philippines":{"code":"PHP","currency":"Peso","symbol":"₱"},"Poland":{"code":"PLN","currency":"Zloty","symbol":"zł"},"Qatar":{"code":"QAR","currency":"Riyal","symbol":"﷼"},"Romania":{"code":"RON","currency":"New Leu","symbol":"lei"},"Russia":{"code":"RUB","currency":"Ruble","symbol":"руб"},"Saint Helena":{"code":"SHP","currency":"Pound","symbol":"£"},"Saudi Arabia":{"code":"SAR","currency":"Riyal","symbol":"﷼"},"Serbia":{"code":"RSD","currency":"Dinar","symbol":"Дин."},"Seychelles":{"code":"SCR","currency":"Rupee","symbol":"₨"},"Singapore":{"code":"SGD","currency":"Dollar","symbol":"$"},"Solomon Islands":{"code":"SBD","currency":"Dollar","symbol":"$"},"Somalia":{"code":"SOS","currency":"Shilling","symbol":"S"},"South Africa":{"code":"ZAR","currency":"Rand","symbol":"R"},"South Korea":{"code":"KRW","currency":"Won","symbol":"₩"},"Sri Lanka":{"code":"LKR","currency":"Rupee","symbol":"₨"},"Suriname":{"code":"SRD","currency":"Dollar","symbol":"$"},"Sweden":{"code":"SEK","currency":"Krona","symbol":"kr"},"Switzerland":{"code":"CHF","currency":"Franc","symbol":"CHF"},"Syria":{"code":"SYP","currency":"Pound","symbol":"£"},"Taiwan":{"code":"TWD","currency":"New Dollar","symbol":"NT$"},"Thailand":{"code":"THB","currency":"Baht","symbol":"฿"},"Trinidad and Tobago":{"code":"TTD","currency":"Dollar","symbol":"TT$"},"Turkey":{"code":"TRY","currency":"Lira","symbol":"₤"},"Tuvalu":{"code":"TVD","currency":"Dollar","symbol":"$"},"Ukraine":{"code":"UAH","currency":"Hryvna","symbol":"₴"},"United Kingdom":{"code":"GBP","currency":"Pound","symbol":"£"},"United States":{"code":"USD","currency":"Dollar","symbol":"$"},"Uruguay":{"code":"UYU","currency":"Peso","symbol":"$U"},"Uzbekistan":{"code":"UZS","currency":"Som","symbol":"лв"},"Venezuela":{"code":"VEF","currency":"Bolivar Fuerte","symbol":"Bs"},"Viet Nam":{"code":"VND","currency":"Dong","symbol":"₫"},"Yemen":{"code":"YER","currency":"Rial","symbol":"﷼"},"Zimbabwe":{"code":"ZWD","currency":"Dollar","symbol":"Z$"}};
|
826
|
-
|
827
|
-
Currencies.countries = function() {
|
828
|
-
var country_name, data;
|
829
|
-
return this.names || (this.names = (function() {
|
830
|
-
var _ref, _results;
|
831
|
-
_ref = this.currencies;
|
832
|
-
_results = [];
|
833
|
-
for (country_name in _ref) {
|
834
|
-
data = _ref[country_name];
|
835
|
-
_results.push(country_name);
|
836
|
-
}
|
837
|
-
return _results;
|
838
|
-
}).call(this));
|
839
|
-
};
|
840
|
-
|
841
|
-
Currencies.currency_codes = function() {
|
842
|
-
var country_name, data;
|
843
|
-
return this.codes || (this.codes = (function() {
|
844
|
-
var _ref, _results;
|
845
|
-
_ref = this.currencies;
|
846
|
-
_results = [];
|
847
|
-
for (country_name in _ref) {
|
848
|
-
data = _ref[country_name];
|
849
|
-
_results.push(data.code);
|
850
|
-
}
|
851
|
-
return _results;
|
852
|
-
}).call(this));
|
853
|
-
};
|
854
|
-
|
855
|
-
Currencies.for_country = function(country_name) {
|
856
|
-
return this.currencies[country_name];
|
857
|
-
};
|
858
|
-
|
859
|
-
Currencies.for_code = function(currency_code) {
|
860
|
-
var country_name, data, final, _ref;
|
861
|
-
final = null;
|
862
|
-
_ref = this.currencies;
|
863
|
-
for (country_name in _ref) {
|
864
|
-
data = _ref[country_name];
|
865
|
-
if (data.code === currency_code) {
|
866
|
-
final = {
|
867
|
-
country: country_name,
|
868
|
-
code: data.code,
|
869
|
-
symbol: data.symbol,
|
870
|
-
currency: data.currency
|
871
|
-
};
|
872
|
-
break;
|
873
|
-
}
|
874
|
-
}
|
875
|
-
return final;
|
876
|
-
};
|
877
|
-
|
878
|
-
return Currencies;
|
879
|
-
|
880
|
-
})();
|
881
|
-
|
882
|
-
if (typeof exports !== "undefined" && exports !== null) {
|
883
|
-
for (key in TwitterCldr) {
|
884
|
-
obj = TwitterCldr[key];
|
885
|
-
exports[key] = obj;
|
886
|
-
}
|
887
|
-
}
|