twitter_cldr 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -2
- data/README.md +18 -2
- data/Rakefile +39 -122
- data/lib/twitter_cldr.rb +3 -0
- data/lib/twitter_cldr/formatters/numbers/rbnf.rb +5 -1
- data/lib/twitter_cldr/resources.rb +86 -5
- data/lib/twitter_cldr/resources/bidi_test_importer.rb +50 -44
- data/lib/twitter_cldr/resources/casefolder_class_generator.rb +22 -13
- data/lib/twitter_cldr/resources/collation_tries_importer.rb +44 -0
- data/lib/twitter_cldr/resources/hyphenation_importer.rb +16 -42
- data/lib/twitter_cldr/resources/import_resolver.rb +71 -0
- data/lib/twitter_cldr/resources/importer.rb +107 -0
- data/lib/twitter_cldr/resources/language_codes_importer.rb +35 -38
- data/lib/twitter_cldr/resources/loader.rb +3 -3
- data/lib/twitter_cldr/resources/locales_resources_importer.rb +48 -35
- data/lib/twitter_cldr/resources/phone_codes_importer.rb +24 -23
- data/lib/twitter_cldr/resources/postal_codes_importer.rb +10 -11
- data/lib/twitter_cldr/resources/properties.rb +0 -4
- data/lib/twitter_cldr/resources/properties/age_property_importer.rb +13 -9
- data/lib/twitter_cldr/resources/properties/arabic_shaping_property_importer.rb +9 -11
- data/lib/twitter_cldr/resources/properties/bidi_brackets_property_importer.rb +11 -9
- data/lib/twitter_cldr/resources/properties/blocks_property_importer.rb +13 -9
- data/lib/twitter_cldr/resources/properties/derived_core_properties_importer.rb +9 -11
- data/lib/twitter_cldr/resources/properties/east_asian_width_property_importer.rb +13 -9
- data/lib/twitter_cldr/resources/properties/grapheme_break_property_importer.rb +13 -9
- data/lib/twitter_cldr/resources/properties/hangul_syllable_type_property_importer.rb +13 -9
- data/lib/twitter_cldr/resources/properties/indic_positional_category_property_importer.rb +13 -9
- data/lib/twitter_cldr/resources/properties/indic_syllabic_category_property_importer.rb +13 -9
- data/lib/twitter_cldr/resources/properties/jamo_property_importer.rb +13 -9
- data/lib/twitter_cldr/resources/properties/line_break_property_importer.rb +13 -9
- data/lib/twitter_cldr/resources/properties/prop_list_importer.rb +9 -11
- data/lib/twitter_cldr/resources/properties/property_importer.rb +13 -22
- data/lib/twitter_cldr/resources/properties/script_extensions_property_importer.rb +12 -10
- data/lib/twitter_cldr/resources/properties/script_property_importer.rb +13 -9
- data/lib/twitter_cldr/resources/properties/sentence_break_property_importer.rb +13 -9
- data/lib/twitter_cldr/resources/properties/unicode_data_properties_importer.rb +11 -9
- data/lib/twitter_cldr/resources/properties/word_break_property_importer.rb +13 -9
- data/lib/twitter_cldr/resources/rbnf_test_importer.rb +41 -38
- data/lib/twitter_cldr/resources/readme_renderer.rb +1 -2
- data/lib/twitter_cldr/resources/requirements.rb +18 -0
- data/lib/twitter_cldr/resources/requirements/cldr_requirement.rb +66 -0
- data/lib/twitter_cldr/resources/requirements/dependency_requirement.rb +23 -0
- data/lib/twitter_cldr/resources/requirements/git_requirement.rb +66 -0
- data/lib/twitter_cldr/resources/requirements/icu_requirement.rb +111 -0
- data/lib/twitter_cldr/resources/requirements/unicode_requirement.rb +51 -0
- data/lib/twitter_cldr/resources/segment_tests_importer.rb +15 -30
- data/lib/twitter_cldr/resources/tailoring_importer.rb +33 -26
- data/lib/twitter_cldr/resources/transform_test_importer.rb +15 -17
- data/lib/twitter_cldr/resources/uli/segment_exceptions_importer.rb +29 -17
- data/lib/twitter_cldr/resources/unicode_data_importer.rb +38 -31
- data/lib/twitter_cldr/resources/unicode_file_parser.rb +37 -0
- data/lib/twitter_cldr/resources/unicode_property_aliases_importer.rb +23 -27
- data/lib/twitter_cldr/shared/casefolder.rb +139 -115
- data/lib/twitter_cldr/version.rb +1 -1
- data/lib/twitter_cldr/versions.rb +0 -4
- data/resources/collation/tailoring/bo.yml +4 -0
- data/resources/collation/tries/bo.dump +0 -0
- data/resources/locales/bo/calendars.yml +247 -0
- data/resources/locales/bo/currencies.yml +208 -0
- data/resources/locales/bo/fields.yml +31 -0
- data/resources/locales/bo/languages.yml +24 -0
- data/resources/locales/bo/layout.yml +5 -0
- data/resources/locales/bo/lists.yml +12 -0
- data/resources/locales/bo/numbers.yml +111 -0
- data/resources/locales/bo/plural_rules.yml +6 -0
- data/resources/locales/bo/plurals.yml +12 -0
- data/resources/locales/bo/territories.yml +14 -0
- data/resources/locales/bo/units.yml +283 -0
- data/resources/shared/transforms/Arab-Latn.yml +109 -0
- data/resources/shared/transforms/Beng-Deva.yml +13 -0
- data/resources/shared/transforms/Beng-Gujr.yml +13 -0
- data/resources/shared/transforms/Beng-Guru.yml +13 -0
- data/resources/shared/transforms/Beng-Knda.yml +13 -0
- data/resources/shared/transforms/Beng-Latn.yml +13 -0
- data/resources/shared/transforms/Beng-Mlym.yml +13 -0
- data/resources/shared/transforms/Beng-Orya.yml +13 -0
- data/resources/shared/transforms/Beng-Taml.yml +13 -0
- data/resources/shared/transforms/Beng-Telu.yml +13 -0
- data/resources/shared/transforms/Cyrl-Latn.yml +128 -0
- data/resources/shared/transforms/Deva-Beng.yml +13 -0
- data/resources/shared/transforms/Deva-Gujr.yml +13 -0
- data/resources/shared/transforms/Deva-Guru.yml +13 -0
- data/resources/shared/transforms/Deva-Knda.yml +13 -0
- data/resources/shared/transforms/Deva-Latn.yml +13 -0
- data/resources/shared/transforms/Deva-Mlym.yml +13 -0
- data/resources/shared/transforms/Deva-Orya.yml +13 -0
- data/resources/shared/transforms/Deva-Taml.yml +13 -0
- data/resources/shared/transforms/Deva-Telu.yml +13 -0
- data/resources/shared/transforms/Geor-Latn.yml +43 -0
- data/resources/shared/transforms/Grek-Latn-UNGEGN.yml +160 -0
- data/resources/shared/transforms/Grek-Latn.yml +206 -0
- data/resources/shared/transforms/Gujr-Beng.yml +13 -0
- data/resources/shared/transforms/Gujr-Deva.yml +13 -0
- data/resources/shared/transforms/Gujr-Guru.yml +13 -0
- data/resources/shared/transforms/Gujr-Knda.yml +13 -0
- data/resources/shared/transforms/Gujr-Latn.yml +13 -0
- data/resources/shared/transforms/Gujr-Mlym.yml +13 -0
- data/resources/shared/transforms/Gujr-Orya.yml +13 -0
- data/resources/shared/transforms/Gujr-Taml.yml +13 -0
- data/resources/shared/transforms/Gujr-Telu.yml +13 -0
- data/resources/shared/transforms/Guru-Beng.yml +13 -0
- data/resources/shared/transforms/Guru-Deva.yml +13 -0
- data/resources/shared/transforms/Guru-Gujr.yml +13 -0
- data/resources/shared/transforms/Guru-Knda.yml +13 -0
- data/resources/shared/transforms/Guru-Latn.yml +13 -0
- data/resources/shared/transforms/Guru-Mlym.yml +13 -0
- data/resources/shared/transforms/Guru-Orya.yml +13 -0
- data/resources/shared/transforms/Guru-Taml.yml +13 -0
- data/resources/shared/transforms/Guru-Telu.yml +13 -0
- data/resources/shared/transforms/Han-Spacedhan.yml +1 -1
- data/resources/shared/transforms/Hang-Latn.yml +12 -0
- data/resources/shared/transforms/Hani-Latn.yml +1605 -0
- data/resources/shared/transforms/Hans-Hant.yml +3982 -0
- data/resources/shared/transforms/Hebr-Latn.yml +72 -0
- data/resources/shared/transforms/Hira-Kana.yml +114 -0
- data/resources/shared/transforms/Hira-Latn.yml +15 -0
- data/resources/shared/transforms/InterIndic-Latin.yml +2 -2
- data/resources/shared/transforms/Jamo-Latn.yml +12 -0
- data/resources/shared/transforms/Knda-Beng.yml +13 -0
- data/resources/shared/transforms/Knda-Deva.yml +13 -0
- data/resources/shared/transforms/Knda-Gujr.yml +13 -0
- data/resources/shared/transforms/Knda-Guru.yml +13 -0
- data/resources/shared/transforms/Knda-Latn.yml +13 -0
- data/resources/shared/transforms/Knda-Mlym.yml +13 -0
- data/resources/shared/transforms/Knda-Orya.yml +13 -0
- data/resources/shared/transforms/Knda-Taml.yml +13 -0
- data/resources/shared/transforms/Knda-Telu.yml +13 -0
- data/resources/shared/transforms/Latin-ASCII.yml +16 -1
- data/resources/shared/transforms/Latin-InterIndic.yml +2 -2
- data/resources/shared/transforms/Latn-Armn.yml +90 -0
- data/resources/shared/transforms/Latn-Beng.yml +14 -0
- data/resources/shared/transforms/Latn-Bopo.yml +1336 -0
- data/resources/shared/transforms/Latn-Cans.yml +190 -0
- data/resources/shared/transforms/Latn-Deva.yml +14 -0
- data/resources/shared/transforms/Latn-Ethi.yml +278 -0
- data/resources/shared/transforms/Latn-Gujr.yml +14 -0
- data/resources/shared/transforms/Latn-Guru.yml +14 -0
- data/resources/shared/transforms/Latn-Hang.yml +13 -0
- data/resources/shared/transforms/Latn-Jamo.yml +13 -0
- data/resources/shared/transforms/Latn-Kana.yml +274 -0
- data/resources/shared/transforms/Latn-Knda.yml +14 -0
- data/resources/shared/transforms/Latn-Mlym.yml +14 -0
- data/resources/shared/transforms/Latn-Orya.yml +14 -0
- data/resources/shared/transforms/Latn-Taml.yml +14 -0
- data/resources/shared/transforms/Latn-Telu.yml +14 -0
- data/resources/shared/transforms/Latn-Thaa.yml +439 -0
- data/resources/shared/transforms/Latn-Thai.yml +13 -0
- data/resources/shared/transforms/Mlym-Beng.yml +13 -0
- data/resources/shared/transforms/Mlym-Deva.yml +13 -0
- data/resources/shared/transforms/Mlym-Gujr.yml +13 -0
- data/resources/shared/transforms/Mlym-Guru.yml +13 -0
- data/resources/shared/transforms/Mlym-Knda.yml +13 -0
- data/resources/shared/transforms/Mlym-Latn.yml +13 -0
- data/resources/shared/transforms/Mlym-Orya.yml +13 -0
- data/resources/shared/transforms/Mlym-Taml.yml +13 -0
- data/resources/shared/transforms/Mlym-Telu.yml +13 -0
- data/resources/shared/transforms/Orya-Beng.yml +13 -0
- data/resources/shared/transforms/Orya-Deva.yml +13 -0
- data/resources/shared/transforms/Orya-Gujr.yml +13 -0
- data/resources/shared/transforms/Orya-Guru.yml +13 -0
- data/resources/shared/transforms/Orya-Knda.yml +13 -0
- data/resources/shared/transforms/Orya-Latn.yml +13 -0
- data/resources/shared/transforms/Orya-Mlym.yml +13 -0
- data/resources/shared/transforms/Orya-Taml.yml +13 -0
- data/resources/shared/transforms/Orya-Telu.yml +13 -0
- data/resources/shared/transforms/Syrc-Latn.yml +55 -0
- data/resources/shared/transforms/Taml-Beng.yml +13 -0
- data/resources/shared/transforms/Taml-Deva.yml +13 -0
- data/resources/shared/transforms/Taml-Gujr.yml +13 -0
- data/resources/shared/transforms/Taml-Guru.yml +13 -0
- data/resources/shared/transforms/Taml-Knda.yml +13 -0
- data/resources/shared/transforms/Taml-Latn.yml +13 -0
- data/resources/shared/transforms/Taml-Mlym.yml +13 -0
- data/resources/shared/transforms/Taml-Orya.yml +13 -0
- data/resources/shared/transforms/Taml-Telu.yml +13 -0
- data/resources/shared/transforms/Telu-Beng.yml +13 -0
- data/resources/shared/transforms/Telu-Deva.yml +13 -0
- data/resources/shared/transforms/Telu-Gujr.yml +13 -0
- data/resources/shared/transforms/Telu-Guru.yml +13 -0
- data/resources/shared/transforms/Telu-Knda.yml +13 -0
- data/resources/shared/transforms/Telu-Latn.yml +13 -0
- data/resources/shared/transforms/Telu-Mlym.yml +13 -0
- data/resources/shared/transforms/Telu-Orya.yml +13 -0
- data/resources/shared/transforms/Telu-Taml.yml +13 -0
- data/resources/shared/transforms/Thai-Latn.yml +15 -0
- data/resources/shared/transforms/am-am_FONIPA.yml +609 -0
- data/resources/shared/transforms/am-am_Latn-BGN.yml +336 -0
- data/resources/shared/transforms/am-ar.yml +11 -0
- data/resources/shared/transforms/am-fa.yml +10 -0
- data/resources/shared/transforms/ar-ar_Latn-BGN.yml +122 -0
- data/resources/shared/transforms/az_Cyrl-az-BGN.yml +93 -0
- data/resources/shared/transforms/be-be_Latn-BGN.yml +108 -0
- data/resources/shared/transforms/bg-bg_Latn-BGN.yml +99 -0
- data/resources/shared/transforms/ch-am.yml +10 -0
- data/resources/shared/transforms/ch-ar.yml +10 -0
- data/resources/shared/transforms/ch-ch_FONIPA.yml +0 -8
- data/resources/shared/transforms/ch-fa.yml +10 -0
- data/resources/shared/transforms/cs-am.yml +10 -0
- data/resources/shared/transforms/cs-ar.yml +10 -0
- data/resources/shared/transforms/cs-fa.yml +10 -0
- data/resources/shared/transforms/dsb-dsb_FONIPA.yml +0 -5
- data/resources/shared/transforms/dv-dv_Latn-BGN.yml +112 -0
- data/resources/shared/transforms/el-el_Latn-BGN.yml +208 -0
- data/resources/shared/transforms/eo-am.yml +10 -0
- data/resources/shared/transforms/eo-ar.yml +10 -0
- data/resources/shared/transforms/eo-eo_FONIPA.yml +52 -0
- data/resources/shared/transforms/eo-fa.yml +10 -0
- data/resources/shared/transforms/es-ar.yml +13 -0
- data/resources/shared/transforms/es-fa.yml +13 -0
- data/resources/shared/transforms/es_419-am.yml +11 -0
- data/resources/shared/transforms/es_419-ar.yml +14 -0
- data/resources/shared/transforms/es_419-fa.yml +14 -0
- data/resources/shared/transforms/fa-fa_Latn-BGN.yml +123 -0
- data/resources/shared/transforms/he-he_Latn-BGN.yml +62 -0
- data/resources/shared/transforms/hy-am.yml +10 -0
- data/resources/shared/transforms/hy-ar.yml +10 -0
- data/resources/shared/transforms/hy-fa.yml +10 -0
- data/resources/shared/transforms/hy-hy_FONIPA.yml +56 -0
- data/resources/shared/transforms/hy-hy_Latn-BGN.yml +133 -0
- data/resources/shared/transforms/hy_AREVMDA-am.yml +10 -0
- data/resources/shared/transforms/hy_AREVMDA-ar.yml +10 -0
- data/resources/shared/transforms/hy_AREVMDA-fa.yml +10 -0
- data/resources/shared/transforms/hy_AREVMDA-hy_AREVMDA_FONIPA.yml +82 -0
- data/resources/shared/transforms/ia-am.yml +10 -0
- data/resources/shared/transforms/ia-ar.yml +10 -0
- data/resources/shared/transforms/ia-fa.yml +10 -0
- data/resources/shared/transforms/ia-ia_FONIPA.yml +69 -0
- data/resources/shared/transforms/ja_Hrkt-ja_Latn-BGN.yml +310 -0
- data/resources/shared/transforms/ka-ka_Latn-BGN.yml +44 -0
- data/resources/shared/transforms/kk-am.yml +10 -0
- data/resources/shared/transforms/kk-ar.yml +10 -0
- data/resources/shared/transforms/kk-fa.yml +10 -0
- data/resources/shared/transforms/kk-kk_FONIPA.yml +53 -0
- data/resources/shared/transforms/kk-kk_Latn-BGN.yml +136 -0
- data/resources/shared/transforms/ko-ko_Latn-BGN.yml +282 -0
- data/resources/shared/transforms/ky-am.yml +10 -0
- data/resources/shared/transforms/ky-ar.yml +10 -0
- data/resources/shared/transforms/ky-fa.yml +10 -0
- data/resources/shared/transforms/ky-ky_FONIPA.yml +73 -0
- data/resources/shared/transforms/ky-ky_Latn-BGN.yml +107 -0
- data/resources/shared/transforms/la-la_FONIPA.yml +0 -8
- data/resources/shared/transforms/mk-mk_Latn-BGN.yml +89 -0
- data/resources/shared/transforms/mn-mn_Latn-BGN.yml +101 -0
- data/resources/shared/transforms/mn-mn_Latn-MNS.yml +89 -0
- data/resources/shared/transforms/my-am.yml +10 -0
- data/resources/shared/transforms/my-ar.yml +10 -0
- data/resources/shared/transforms/my-fa.yml +10 -0
- data/resources/shared/transforms/my-my_FONIPA.yml +260 -0
- data/resources/shared/transforms/pl-am.yml +10 -0
- data/resources/shared/transforms/pl-ar.yml +10 -0
- data/resources/shared/transforms/pl-fa.yml +10 -0
- data/resources/shared/transforms/ps-ps_Latn-BGN.yml +151 -0
- data/resources/shared/transforms/rm_SURSILV-am.yml +10 -0
- data/resources/shared/transforms/rm_SURSILV-ar.yml +10 -0
- data/resources/shared/transforms/rm_SURSILV-fa.yml +10 -0
- data/resources/shared/transforms/rm_SURSILV-rm_FONIPA_SURSILV.yml +84 -0
- data/resources/shared/transforms/ro-am.yml +10 -0
- data/resources/shared/transforms/ro-ar.yml +10 -0
- data/resources/shared/transforms/ro-fa.yml +10 -0
- data/resources/shared/transforms/ro-ro_FONIPA.yml +38 -6
- data/resources/shared/transforms/ro_FONIPA-ja.yml +1 -0
- data/resources/shared/transforms/ru-ru_Latn-BGN.yml +121 -0
- data/resources/shared/transforms/ru_Latn-ru-BGN.yml +101 -0
- data/resources/shared/transforms/sat-am.yml +10 -0
- data/resources/shared/transforms/sat-ar.yml +10 -0
- data/resources/shared/transforms/sat-fa.yml +10 -0
- data/resources/shared/transforms/sat_Olck-sat_FONIPA.yml +132 -0
- data/resources/shared/transforms/si-am.yml +10 -0
- data/resources/shared/transforms/si-ar.yml +10 -0
- data/resources/shared/transforms/si-fa.yml +10 -0
- data/resources/shared/transforms/si-si_FONIPA.yml +128 -0
- data/resources/shared/transforms/si-si_Latn.yml +96 -0
- data/resources/shared/transforms/sk-am.yml +10 -0
- data/resources/shared/transforms/sk-ar.yml +10 -0
- data/resources/shared/transforms/sk-fa.yml +10 -0
- data/resources/shared/transforms/sk-sk_FONIPA.yml +18 -2
- data/resources/shared/transforms/sk_FONIPA-ja.yml +2 -0
- data/resources/shared/transforms/sr-sr_Latn-BGN.yml +81 -0
- data/resources/shared/transforms/tk_Cyrl-tk-BGN.yml +122 -0
- data/resources/shared/transforms/tlh-am.yml +10 -0
- data/resources/shared/transforms/tlh-ar.yml +10 -0
- data/resources/shared/transforms/tlh-fa.yml +10 -0
- data/resources/shared/transforms/tlh-tlh_FONIPA.yml +0 -8
- data/resources/shared/transforms/uk-uk_Latn-BGN.yml +115 -0
- data/resources/shared/transforms/und_FONIPA-ar.yml +96 -0
- data/resources/shared/transforms/und_FONIPA-fa.yml +88 -0
- data/resources/shared/transforms/und_FONIPA-und_FONXSAMP.yml +198 -0
- data/resources/shared/transforms/uz_Cyrl-uz-BGN.yml +117 -0
- data/resources/shared/transforms/xh-am.yml +10 -0
- data/resources/shared/transforms/xh-ar.yml +10 -0
- data/resources/shared/transforms/xh-fa.yml +10 -0
- data/resources/shared/transforms/xh-xh_FONIPA.yml +71 -0
- data/resources/shared/transforms/zu-am.yml +10 -0
- data/resources/shared/transforms/zu-ar.yml +10 -0
- data/resources/shared/transforms/zu-fa.yml +10 -0
- data/resources/shared/transforms/zu-zu_FONIPA.yml +58 -0
- data/spec/formatters/numbers/rbnf/rbnf_spec.rb +3 -1
- data/spec/resources/loader_spec.rb +12 -5
- data/spec/spec_helper.rb +1 -1
- metadata +242 -10
- data/History.txt +0 -282
- data/lib/twitter_cldr/resources/collation_tries_dumper.rb +0 -43
- data/lib/twitter_cldr/resources/custom_locales_resources_importer.rb +0 -80
- data/lib/twitter_cldr/resources/download.rb +0 -64
- data/lib/twitter_cldr/resources/icu_based_importer.rb +0 -18
- data/lib/twitter_cldr/resources/properties/properties_importer.rb +0 -59
- data/lib/twitter_cldr/resources/unicode_importer.rb +0 -37
@@ -3,18 +3,13 @@
|
|
3
3
|
# Copyright 2012 Twitter, Inc
|
4
4
|
# http://www.apache.org/licenses/LICENSE-2.0
|
5
5
|
|
6
|
-
require 'java'
|
7
6
|
require 'fileutils'
|
8
|
-
require 'twitter_cldr/resources/download'
|
9
7
|
|
10
8
|
module TwitterCldr
|
11
9
|
module Resources
|
12
10
|
|
13
11
|
# This class should be used with JRuby in 1.9 mode
|
14
|
-
class RbnfTestImporter <
|
15
|
-
|
16
|
-
attr_reader :output_path, :icu4j_path
|
17
|
-
|
12
|
+
class RbnfTestImporter < Importer
|
18
13
|
# These don't have much of a pattern, just trying to get
|
19
14
|
# a wide range of different possibilities.
|
20
15
|
TEST_NUMBERS = [
|
@@ -25,42 +20,42 @@ module TwitterCldr
|
|
25
20
|
# [41.0, 5.22, 8.90, 555.1212, -14.90, -999.701] # decimals really aren't supported yet
|
26
21
|
].flatten
|
27
22
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
def import(locales)
|
34
|
-
require_icu4j(icu4j_path)
|
35
|
-
java_import 'com.ibm.icu.text.RuleBasedNumberFormat'
|
36
|
-
java_import 'com.ibm.icu.util.ULocale'
|
37
|
-
|
38
|
-
groupings = [
|
39
|
-
RuleBasedNumberFormat::SPELLOUT,
|
40
|
-
RuleBasedNumberFormat::ORDINAL,
|
41
|
-
RuleBasedNumberFormat::DURATION
|
42
|
-
]
|
43
|
-
|
44
|
-
import_locales(locales, groupings)
|
45
|
-
end
|
23
|
+
requirement :icu, Versions.icu_version
|
24
|
+
output_path File.join(TwitterCldr::SPEC_DIR, 'formatters', 'numbers', 'rbnf', 'locales')
|
25
|
+
locales TwitterCldr.supported_locales
|
26
|
+
ruby_engine :jruby
|
46
27
|
|
47
|
-
|
48
|
-
|
49
|
-
def import_locales(locales, groupings)
|
28
|
+
def execute
|
50
29
|
locales.each do |locale|
|
51
30
|
locale = locale.to_s
|
52
|
-
ulocale =
|
31
|
+
ulocale = ulocale_class.new(locale)
|
53
32
|
file = output_file_for(locale)
|
54
33
|
FileUtils.mkdir_p(File.dirname(file))
|
55
34
|
File.open(file, "w+") do |w|
|
56
|
-
w.write(YAML.dump(import_locale(ulocale
|
35
|
+
w.write(YAML.dump(import_locale(ulocale)))
|
57
36
|
end
|
58
37
|
end
|
59
38
|
end
|
60
39
|
|
61
|
-
|
40
|
+
private
|
41
|
+
|
42
|
+
def locales
|
43
|
+
@locales ||= params.fetch(:locales).select do |locale|
|
44
|
+
TwitterCldr::Formatters::Rbnf::RbnfFormatter.supported_locale?(locale)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def formatter_class
|
49
|
+
@formatter_class ||= requirements[:icu].get_class('com.ibm.icu.text.RuleBasedNumberFormat')
|
50
|
+
end
|
51
|
+
|
52
|
+
def ulocale_class
|
53
|
+
@ulocale_class ||= requirements[:icu].get_class('com.ibm.icu.util.ULocale')
|
54
|
+
end
|
55
|
+
|
56
|
+
def import_locale(ulocale)
|
62
57
|
groupings.inject({}) do |grouping_ret, grouping|
|
63
|
-
formatter =
|
58
|
+
formatter = formatter_class.new(ulocale, grouping)
|
64
59
|
grouping_name = get_grouping_display_name(grouping)
|
65
60
|
grouping_ret[grouping_name] = formatter.getRuleSetNames.inject({}) do |ruleset_ret, ruleset_name|
|
66
61
|
ruleset_display_name = formatter.getRuleSetDisplayName(ruleset_name, ulocale)
|
@@ -72,6 +67,14 @@ module TwitterCldr
|
|
72
67
|
end
|
73
68
|
end
|
74
69
|
|
70
|
+
def groupings
|
71
|
+
@groupings ||= [
|
72
|
+
formatter_class::SPELLOUT,
|
73
|
+
formatter_class::ORDINAL,
|
74
|
+
formatter_class::DURATION
|
75
|
+
]
|
76
|
+
end
|
77
|
+
|
75
78
|
def clean_up_name(name)
|
76
79
|
name
|
77
80
|
.gsub(/[^\w-]/, '-')
|
@@ -94,17 +97,17 @@ module TwitterCldr
|
|
94
97
|
end
|
95
98
|
|
96
99
|
def output_file_for(locale)
|
97
|
-
File.join(output_path, locale,
|
100
|
+
File.join(params.fetch(:output_path), locale, 'rbnf_test.yml')
|
98
101
|
end
|
99
102
|
|
100
103
|
def get_grouping_display_name(grouping)
|
101
104
|
case grouping
|
102
|
-
when
|
103
|
-
|
104
|
-
when
|
105
|
-
|
106
|
-
when
|
107
|
-
|
105
|
+
when formatter_class::SPELLOUT
|
106
|
+
'SpelloutRules'
|
107
|
+
when formatter_class::ORDINAL
|
108
|
+
'OrdinalRules'
|
109
|
+
when formatter_class::DURATION
|
110
|
+
'DurationRules'
|
108
111
|
end
|
109
112
|
end
|
110
113
|
|
@@ -11,7 +11,6 @@ module TwitterCldr
|
|
11
11
|
ReadmeAssertionFailure = Struct.new(:message, :line_number)
|
12
12
|
|
13
13
|
class ReadmeRenderer
|
14
|
-
|
15
14
|
attr_reader :text, :assertion_failures
|
16
15
|
|
17
16
|
def initialize(text)
|
@@ -102,7 +101,7 @@ module TwitterCldr
|
|
102
101
|
ret
|
103
102
|
end
|
104
103
|
end
|
105
|
-
|
106
104
|
end
|
105
|
+
|
107
106
|
end
|
108
107
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2012 Twitter, Inc
|
4
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
|
6
|
+
module TwitterCldr
|
7
|
+
module Resources
|
8
|
+
|
9
|
+
module Requirements
|
10
|
+
autoload :CldrRequirement, 'twitter_cldr/resources/requirements/cldr_requirement'
|
11
|
+
autoload :IcuRequirement, 'twitter_cldr/resources/requirements/icu_requirement'
|
12
|
+
autoload :DependencyRequirement, 'twitter_cldr/resources/requirements/dependency_requirement'
|
13
|
+
autoload :GitRequirement, 'twitter_cldr/resources/requirements/git_requirement'
|
14
|
+
autoload :UnicodeRequirement, 'twitter_cldr/resources/requirements/unicode_requirement'
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2012 Twitter, Inc
|
4
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
|
6
|
+
require 'uri'
|
7
|
+
require 'open-uri'
|
8
|
+
require 'zip'
|
9
|
+
|
10
|
+
module TwitterCldr
|
11
|
+
module Resources
|
12
|
+
module Requirements
|
13
|
+
|
14
|
+
class CldrRequirement
|
15
|
+
CLDR_URL = "http://unicode.org/Public/cldr/%{version}/core.zip"
|
16
|
+
|
17
|
+
attr_reader :version
|
18
|
+
|
19
|
+
def initialize(version)
|
20
|
+
@version = version
|
21
|
+
end
|
22
|
+
|
23
|
+
def prepare
|
24
|
+
# download and unzip if source directory doesn't exist
|
25
|
+
unless File.directory?(source_path)
|
26
|
+
STDOUT.write("Downloading cldr v#{version}... ")
|
27
|
+
download
|
28
|
+
puts 'done'
|
29
|
+
end
|
30
|
+
|
31
|
+
puts "Using cldr v#{version} from #{source_path}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def source_path
|
35
|
+
@source_path ||= File.join(TwitterCldr::VENDOR_DIR, "cldr_v#{version}")
|
36
|
+
end
|
37
|
+
|
38
|
+
def common_path
|
39
|
+
File.join(source_path, 'common')
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def cldr_url
|
45
|
+
CLDR_URL % { version: version }
|
46
|
+
end
|
47
|
+
|
48
|
+
def download
|
49
|
+
URI.parse(cldr_url).open do |tempfile|
|
50
|
+
FileUtils.mkdir_p(source_path)
|
51
|
+
Zip.on_exists_proc = true
|
52
|
+
|
53
|
+
Zip::File.open(tempfile.path) do |file|
|
54
|
+
file.each do |entry|
|
55
|
+
path = File.join(source_path, entry.name)
|
56
|
+
FileUtils.mkdir_p(File.dirname(path))
|
57
|
+
file.extract(entry, path)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2012 Twitter, Inc
|
4
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
|
6
|
+
module TwitterCldr
|
7
|
+
module Resources
|
8
|
+
module Requirements
|
9
|
+
|
10
|
+
class DependencyRequirement
|
11
|
+
attr_reader :importer_classes
|
12
|
+
|
13
|
+
def initialize(importer_classes)
|
14
|
+
@importer_classes = importer_classes
|
15
|
+
end
|
16
|
+
|
17
|
+
def prepare
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2012 Twitter, Inc
|
4
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
|
6
|
+
module TwitterCldr
|
7
|
+
module Resources
|
8
|
+
module Requirements
|
9
|
+
|
10
|
+
class GitRequirement
|
11
|
+
attr_reader :repo_url, :ref
|
12
|
+
|
13
|
+
def initialize(repo_url, ref)
|
14
|
+
@repo_url = repo_url
|
15
|
+
@ref = ref
|
16
|
+
end
|
17
|
+
|
18
|
+
def prepare
|
19
|
+
check_git_available
|
20
|
+
clone_or_fetch_if_necessary
|
21
|
+
puts "Using repo in #{source_path}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def source_path
|
25
|
+
@source_path ||= File.join(TwitterCldr::VENDOR_DIR, 'git', repo_name)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def check_git_available
|
31
|
+
`git --version`
|
32
|
+
|
33
|
+
if $?.exitstatus != 0
|
34
|
+
raise "Couldn't find git executable. Is it installed?"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def repo_name
|
39
|
+
@repo_name ||= File.basename(repo_url).chomp('.git')
|
40
|
+
end
|
41
|
+
|
42
|
+
def clone_or_fetch_if_necessary
|
43
|
+
if File.exist?(source_path)
|
44
|
+
unless ref_exists?
|
45
|
+
in_repo { `git fetch` }
|
46
|
+
end
|
47
|
+
else
|
48
|
+
`git clone #{repo_url} #{source_path}`
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def ref_exists?
|
53
|
+
in_repo do
|
54
|
+
`git rev-parse --verify --quiet #{ref}`
|
55
|
+
$?.exitstatus == 0
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def in_repo(&block)
|
60
|
+
Dir.chdir(source_path, &block)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2012 Twitter, Inc
|
4
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
|
6
|
+
require 'open-uri'
|
7
|
+
|
8
|
+
module TwitterCldr
|
9
|
+
module Resources
|
10
|
+
module Requirements
|
11
|
+
|
12
|
+
# This requirement makes use of the JarClassLoader package (https://github.com/kamranzafar/JCL)
|
13
|
+
# to load ICU in an isolated environment to keep different versions of the
|
14
|
+
# library separate. If ICU versions are not kept separate, the one that's
|
15
|
+
# first on the classpath wins, which can be surprising if you're not
|
16
|
+
# expecting it. Oh, and it can break all the tests.
|
17
|
+
class IcuRequirement
|
18
|
+
ICU_URL = "http://download.icu-project.org/files/icu4j/%{version}/icu4j-%{underscored_version}.jar"
|
19
|
+
|
20
|
+
# first entry is JCL itself, other two are JCL dependencies
|
21
|
+
JCL_JARS = [
|
22
|
+
'https://repo.maven.apache.org/maven2/org/xeustechnologies/jcl-core/2.7/jcl-core-2.7.jar',
|
23
|
+
'https://repo.maven.apache.org/maven2/org/objenesis/objenesis/2.1/objenesis-2.1.jar',
|
24
|
+
'https://repo.maven.apache.org/maven2/cglib/cglib-nodep/2.2/cglib-nodep-2.2.jar'
|
25
|
+
]
|
26
|
+
|
27
|
+
attr_reader :version
|
28
|
+
|
29
|
+
def initialize(version)
|
30
|
+
@version = version
|
31
|
+
end
|
32
|
+
|
33
|
+
def prepare
|
34
|
+
download_icu
|
35
|
+
download_jcl
|
36
|
+
|
37
|
+
JCL_JARS.each do |jcl_jar_url|
|
38
|
+
require jcl_source_path_for(jcl_jar_url)
|
39
|
+
end
|
40
|
+
|
41
|
+
java_import 'org.xeustechnologies.jcl.JarClassLoader'
|
42
|
+
|
43
|
+
class_loader.add(icu_source_path)
|
44
|
+
end
|
45
|
+
|
46
|
+
def icu_source_path
|
47
|
+
@source_path ||= File.join(
|
48
|
+
TwitterCldr::VENDOR_DIR, "icu_v#{version}.jar"
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
def jcl_source_path_for(url)
|
53
|
+
File.join(TwitterCldr::VENDOR_DIR, File.basename(url))
|
54
|
+
end
|
55
|
+
|
56
|
+
def get_class(name)
|
57
|
+
class_loader.load_class(name).ruby_class
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def class_loader
|
63
|
+
@class_loader ||= JarClassLoader.new
|
64
|
+
end
|
65
|
+
|
66
|
+
def download_icu
|
67
|
+
unless File.file?(icu_source_path)
|
68
|
+
STDOUT.write("Downloading icu v#{version}... ")
|
69
|
+
download(icu_url, icu_source_path)
|
70
|
+
puts 'done'
|
71
|
+
end
|
72
|
+
|
73
|
+
puts "Using icu #{version} from #{icu_source_path}"
|
74
|
+
end
|
75
|
+
|
76
|
+
def download_jcl
|
77
|
+
JCL_JARS.each do |jcl_jar_url|
|
78
|
+
source_path = jcl_source_path_for(jcl_jar_url)
|
79
|
+
jar_name = File.basename(source_path).chomp(File.extname(source_path))
|
80
|
+
|
81
|
+
unless File.file?(source_path)
|
82
|
+
STDOUT.write("Downloading #{jar_name}... ")
|
83
|
+
download(jcl_jar_url, source_path)
|
84
|
+
puts 'done'
|
85
|
+
end
|
86
|
+
|
87
|
+
puts "Using #{jar_name} from #{source_path}"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def download(url, path)
|
92
|
+
open(path, 'wb') do |file|
|
93
|
+
file << open(url).read
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def icu_url
|
98
|
+
ICU_URL % {
|
99
|
+
version: version,
|
100
|
+
underscored_version: underscored_version
|
101
|
+
}
|
102
|
+
end
|
103
|
+
|
104
|
+
def underscored_version
|
105
|
+
@underscored_version ||= version.gsub('.', '_')
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2012 Twitter, Inc
|
4
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
|
6
|
+
require 'open-uri'
|
7
|
+
require 'fileutils'
|
8
|
+
|
9
|
+
module TwitterCldr
|
10
|
+
module Resources
|
11
|
+
module Requirements
|
12
|
+
|
13
|
+
class UnicodeRequirement
|
14
|
+
UNICODE_URL = "ftp://ftp.unicode.org/Public/%{version}"
|
15
|
+
|
16
|
+
attr_reader :version, :files
|
17
|
+
|
18
|
+
def initialize(version, files)
|
19
|
+
@version = version
|
20
|
+
@files = files
|
21
|
+
end
|
22
|
+
|
23
|
+
def prepare
|
24
|
+
files.each do |file|
|
25
|
+
unless File.file?(source_path_for(file))
|
26
|
+
STDOUT.write("Downloading #{file} from unicode v#{version}... ")
|
27
|
+
download(file)
|
28
|
+
puts 'done'
|
29
|
+
end
|
30
|
+
|
31
|
+
puts "Using #{file} from unicode v#{version}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def source_path_for(file)
|
36
|
+
File.join(TwitterCldr::VENDOR_DIR, "unicode_v#{version}", file)
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def download(file)
|
42
|
+
source_path = source_path_for(file)
|
43
|
+
FileUtils.mkdir_p(File.dirname(source_path))
|
44
|
+
remote_url = File.join(UNICODE_URL % { version: version}, file)
|
45
|
+
open(source_path, 'wb') { |file| file << open(remote_url).read }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|