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
@@ -34,15 +34,15 @@ module TwitterCldr
|
|
34
34
|
resource_loaded?(*locale_resource_path(locale, resource_name))
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
38
|
-
|
37
|
+
def resource_types_for(locale)
|
38
|
+
Dir.glob(File.join(RESOURCES_DIR, 'locales', locale.to_s, '*')).map do |file|
|
39
39
|
File.basename(file).chomp(File.extname(file)).to_sym
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
def preload_resources_for_locale(locale, *resources)
|
44
44
|
if resources.size > 0
|
45
|
-
resources =
|
45
|
+
resources = resource_types_for(locale) if resources.first == :all
|
46
46
|
resources.each { |res| get_locale_resource(locale, res) }
|
47
47
|
end
|
48
48
|
nil
|
@@ -7,17 +7,22 @@ require 'fileutils'
|
|
7
7
|
require 'cldr-plurals'
|
8
8
|
require 'cldr/export'
|
9
9
|
|
10
|
-
require 'twitter_cldr/resources/download'
|
11
|
-
|
12
10
|
module TwitterCldr
|
13
11
|
module Resources
|
14
12
|
|
15
|
-
class LocalesResourcesImporter
|
13
|
+
class LocalesResourcesImporter < Importer
|
14
|
+
|
15
|
+
requirement :cldr, Versions.cldr_version
|
16
|
+
output_path './'
|
17
|
+
locales TwitterCldr.supported_locales
|
18
|
+
ruby_engine :mri
|
16
19
|
|
17
20
|
LOCALE_COMPONENTS = %w[
|
21
|
+
layout
|
18
22
|
calendars
|
19
23
|
languages
|
20
24
|
numbers
|
25
|
+
currencies
|
21
26
|
plural_rules
|
22
27
|
lists
|
23
28
|
territories
|
@@ -38,58 +43,58 @@ module TwitterCldr
|
|
38
43
|
transforms
|
39
44
|
]
|
40
45
|
|
41
|
-
|
42
|
-
#
|
43
|
-
# input_path - path to a directory containing CLDR data
|
44
|
-
# output_path - output directory for imported YAML files
|
45
|
-
#
|
46
|
-
def initialize(input_path, output_path)
|
47
|
-
@input_path = input_path
|
48
|
-
@output_path = output_path
|
49
|
-
end
|
46
|
+
private
|
50
47
|
|
51
|
-
def
|
52
|
-
prepare_ruby_cldr
|
48
|
+
def execute
|
53
49
|
import_components
|
54
50
|
end
|
55
51
|
|
56
|
-
|
52
|
+
def after_prepare
|
53
|
+
Cldr::Export::Data.dir = requirements[:cldr].common_path
|
54
|
+
end
|
57
55
|
|
58
|
-
def
|
59
|
-
|
60
|
-
Cldr::Export::Data.dir = File.join(@input_path, 'common')
|
56
|
+
def output_path
|
57
|
+
params.fetch(:output_path)
|
61
58
|
end
|
62
59
|
|
63
60
|
def move_segments_root_file
|
64
|
-
file_path = File.join(
|
61
|
+
file_path = File.join(output_path, 'shared', 'segments_root.yml')
|
65
62
|
|
66
63
|
if File.file?(file_path)
|
67
|
-
FileUtils.move(
|
64
|
+
FileUtils.move(
|
65
|
+
file_path, File.join(
|
66
|
+
output_path, 'shared', 'segments', 'segments_root.yml'
|
67
|
+
)
|
68
|
+
)
|
68
69
|
end
|
69
70
|
end
|
70
71
|
|
71
72
|
def import_components
|
72
|
-
export_args = {
|
73
|
-
locales: TwitterCldr.supported_locales,
|
74
|
-
components: LOCALE_COMPONENTS,
|
75
|
-
target: File.join(@output_path, 'locales'),
|
76
|
-
merge: true # fill in the gaps, eg fill in sub-locales like en_GB with en
|
77
|
-
}
|
78
|
-
|
79
73
|
locales = Set.new
|
80
74
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
75
|
+
params[:locales].each do |locale|
|
76
|
+
export_args = {
|
77
|
+
locales: [locale],
|
78
|
+
components: components_for(locale),
|
79
|
+
target: File.join(output_path, 'locales'),
|
80
|
+
merge: true # fill in the gaps, eg fill in sub-locales like en_GB with en
|
81
|
+
}
|
82
|
+
|
83
|
+
Cldr::Export.export(export_args) do |component, locale, path|
|
84
|
+
add_buddhist_calendar(component, locale, path)
|
85
|
+
process_plurals(component, locale, path)
|
86
|
+
downcase_territory_codes(component, locale, path)
|
87
|
+
deep_symbolize(path)
|
88
|
+
locales.add(locale)
|
89
|
+
STDOUT.write "\rImporting #{locale}, #{locales.size} of #{params[:locales].size} total"
|
90
|
+
end
|
88
91
|
end
|
89
92
|
|
93
|
+
puts ''
|
94
|
+
|
90
95
|
export_args = {
|
91
96
|
components: SHARED_COMPONENTS,
|
92
|
-
target: File.join(
|
97
|
+
target: File.join(output_path, 'shared'),
|
93
98
|
merge: true
|
94
99
|
}
|
95
100
|
|
@@ -100,6 +105,14 @@ module TwitterCldr
|
|
100
105
|
move_segments_root_file
|
101
106
|
end
|
102
107
|
|
108
|
+
def components_for(locale)
|
109
|
+
if File.exist?(File.join(requirements[:cldr].source_path, 'common', 'rbnf', "#{locale}.xml"))
|
110
|
+
LOCALE_COMPONENTS
|
111
|
+
else
|
112
|
+
LOCALE_COMPONENTS - ['rbnf']
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
103
116
|
def deep_symbolize(path)
|
104
117
|
return unless File.extname(path) == '.yml'
|
105
118
|
data = YAML.load(File.read(path))
|
@@ -5,44 +5,45 @@
|
|
5
5
|
|
6
6
|
require 'nokogiri'
|
7
7
|
|
8
|
-
require 'twitter_cldr/resources/download'
|
9
|
-
|
10
8
|
module TwitterCldr
|
11
9
|
module Resources
|
12
10
|
|
13
|
-
class PhoneCodesImporter
|
14
|
-
|
15
|
-
PHONE_CODES_PATH = File.join('common', 'supplemental', 'telephoneCodeData.xml')
|
16
|
-
|
11
|
+
class PhoneCodesImporter < Importer
|
17
12
|
TERRITORY_REGEXP = /^[A-Z]{2}$/
|
18
13
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
# output_path - output directory for generated YAML file
|
23
|
-
#
|
24
|
-
def initialize(input_path, output_path)
|
25
|
-
@input_path = input_path
|
26
|
-
@output_path = output_path
|
27
|
-
end
|
14
|
+
requirement :cldr, Versions.cldr_version
|
15
|
+
output_path 'shared'
|
16
|
+
ruby_engine :mri
|
28
17
|
|
29
|
-
|
30
|
-
TwitterCldr::Resources.download_cldr_if_necessary(@input_path)
|
18
|
+
private
|
31
19
|
|
32
|
-
|
20
|
+
def execute
|
21
|
+
doc = File.open(File.join(source_path)) do |file|
|
22
|
+
Nokogiri::XML(file)
|
23
|
+
end
|
33
24
|
|
34
|
-
phone_codes = doc.xpath('//codesByTerritory').
|
25
|
+
phone_codes = doc.xpath('//codesByTerritory').each_with_object({}) do |node, memo|
|
35
26
|
territory = node.attr('territory')
|
36
|
-
|
37
|
-
|
27
|
+
|
28
|
+
if territory =~ TERRITORY_REGEXP
|
29
|
+
memo[territory.downcase.to_sym] = node.at_xpath('telephoneCountryCode').attr('code')
|
30
|
+
end
|
38
31
|
end
|
39
32
|
|
40
33
|
phone_codes = Hash[phone_codes.sort_by(&:first)]
|
34
|
+
File.write(output_path, YAML.dump(phone_codes))
|
35
|
+
end
|
41
36
|
|
42
|
-
|
37
|
+
def output_path
|
38
|
+
File.join(params.fetch(:output_path), 'phone_codes.yml')
|
43
39
|
end
|
44
40
|
|
41
|
+
def source_path
|
42
|
+
@source_path ||= File.join(
|
43
|
+
requirements[:cldr].common_path, 'supplemental', 'telephoneCodeData.xml'
|
44
|
+
)
|
45
|
+
end
|
45
46
|
end
|
46
47
|
|
47
48
|
end
|
48
|
-
end
|
49
|
+
end
|
@@ -10,25 +10,24 @@ require 'yaml'
|
|
10
10
|
module TwitterCldr
|
11
11
|
module Resources
|
12
12
|
|
13
|
-
class PostalCodesImporter
|
13
|
+
class PostalCodesImporter < Importer
|
14
14
|
|
15
15
|
BASE_URL = 'http://i18napis.appspot.com/address/data/'
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
def initialize(output_path)
|
22
|
-
@output_path = output_path
|
23
|
-
end
|
17
|
+
output_path 'shared'
|
18
|
+
ruby_engine :mri
|
19
|
+
|
20
|
+
private
|
24
21
|
|
25
|
-
def
|
26
|
-
File.open(File.join(
|
22
|
+
def execute
|
23
|
+
File.open(File.join(output_path, 'postal_codes.yml'), 'w') do |output|
|
27
24
|
output.write(YAML.dump(load))
|
28
25
|
end
|
29
26
|
end
|
30
27
|
|
31
|
-
|
28
|
+
def output_path
|
29
|
+
params.fetch(:output_path)
|
30
|
+
end
|
32
31
|
|
33
32
|
def load
|
34
33
|
each_territory.each_with_object({}) do |territory, ret|
|
@@ -3,18 +3,14 @@
|
|
3
3
|
# Copyright 2012 Twitter, Inc
|
4
4
|
# http://www.apache.org/licenses/LICENSE-2.0
|
5
5
|
|
6
|
-
require 'twitter_cldr/resources/download'
|
7
|
-
|
8
6
|
module TwitterCldr
|
9
7
|
module Resources
|
10
8
|
module Properties
|
11
9
|
|
12
|
-
autoload :PropertiesImporter, 'twitter_cldr/resources/properties/properties_importer'
|
13
10
|
autoload :PropertyImporter, 'twitter_cldr/resources/properties/property_importer'
|
14
11
|
autoload :AgePropertyImporter, 'twitter_cldr/resources/properties/age_property_importer'
|
15
12
|
autoload :ArabicShapingPropertyImporter, 'twitter_cldr/resources/properties/arabic_shaping_property_importer'
|
16
13
|
autoload :BidiBracketsPropertyImporter, 'twitter_cldr/resources/properties/bidi_brackets_property_importer'
|
17
|
-
autoload :BidiMirroringPropertyImporter, 'twitter_cldr/resources/properties/bidi_mirroring_property_importer'
|
18
14
|
autoload :BlocksPropertyImporter, 'twitter_cldr/resources/properties/blocks_property_importer'
|
19
15
|
autoload :DerivedCorePropertiesImporter, 'twitter_cldr/resources/properties/derived_core_properties_importer'
|
20
16
|
autoload :EastAsianWidthPropertyImporter, 'twitter_cldr/resources/properties/east_asian_width_property_importer'
|
@@ -8,17 +8,21 @@ module TwitterCldr
|
|
8
8
|
module Properties
|
9
9
|
|
10
10
|
class AgePropertyImporter < PropertyImporter
|
11
|
-
|
11
|
+
DATA_FILE = 'ucd/DerivedAge.txt'
|
12
12
|
PROPERTY_NAME = 'Age'
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
requirement :unicode, Versions.unicode_version, [DATA_FILE]
|
15
|
+
output_path 'unicode_data/properties'
|
16
|
+
ruby_engine :mri
|
17
|
+
|
18
|
+
def property_name
|
19
|
+
PROPERTY_NAME
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def source_path
|
25
|
+
requirements[:unicode].source_path_for(DATA_FILE)
|
22
26
|
end
|
23
27
|
end
|
24
28
|
|
@@ -8,20 +8,18 @@ module TwitterCldr
|
|
8
8
|
module Properties
|
9
9
|
|
10
10
|
class ArabicShapingPropertyImporter < PropertyImporter
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
property_name: nil,
|
17
|
-
data_url: DATA_URL,
|
18
|
-
data_path: File.basename(DATA_URL),
|
19
|
-
database: database
|
20
|
-
)
|
21
|
-
end
|
11
|
+
DATA_FILE = 'ucd/ArabicShaping.txt'
|
12
|
+
|
13
|
+
requirement :unicode, Versions.unicode_version, [DATA_FILE]
|
14
|
+
output_path 'unicode_data/properties'
|
15
|
+
ruby_engine :mri
|
22
16
|
|
23
17
|
private
|
24
18
|
|
19
|
+
def source_path
|
20
|
+
requirements[:unicode].source_path_for(DATA_FILE)
|
21
|
+
end
|
22
|
+
|
25
23
|
def load
|
26
24
|
super do |data, ret|
|
27
25
|
code_points = expand_range(data[0])
|
@@ -8,21 +8,23 @@ module TwitterCldr
|
|
8
8
|
module Properties
|
9
9
|
|
10
10
|
class BidiBracketsPropertyImporter < PropertyImporter
|
11
|
-
|
11
|
+
DATA_FILE = 'ucd/BidiBrackets.txt'
|
12
12
|
PROPERTY_NAME = 'Bidi_Paired_Bracket_Type'
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
database: database
|
21
|
-
)
|
14
|
+
requirement :unicode, Versions.unicode_version, [DATA_FILE]
|
15
|
+
output_path 'unicode_data/properties'
|
16
|
+
ruby_engine :mri
|
17
|
+
|
18
|
+
def property_name
|
19
|
+
PROPERTY_NAME
|
22
20
|
end
|
23
21
|
|
24
22
|
private
|
25
23
|
|
24
|
+
def source_path
|
25
|
+
requirements[:unicode].source_path_for(DATA_FILE)
|
26
|
+
end
|
27
|
+
|
26
28
|
def load
|
27
29
|
super do |data, ret|
|
28
30
|
code_points = expand_range(data[0])
|
@@ -8,17 +8,21 @@ module TwitterCldr
|
|
8
8
|
module Properties
|
9
9
|
|
10
10
|
class BlocksPropertyImporter < PropertyImporter
|
11
|
-
|
11
|
+
DATA_FILE = 'ucd/Blocks.txt'
|
12
12
|
PROPERTY_NAME = 'Block'
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
requirement :unicode, Versions.unicode_version, [DATA_FILE]
|
15
|
+
output_path 'unicode_data/properties'
|
16
|
+
ruby_engine :mri
|
17
|
+
|
18
|
+
def property_name
|
19
|
+
PROPERTY_NAME
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def source_path
|
25
|
+
requirements[:unicode].source_path_for(DATA_FILE)
|
22
26
|
end
|
23
27
|
end
|
24
28
|
|
@@ -8,20 +8,18 @@ module TwitterCldr
|
|
8
8
|
module Properties
|
9
9
|
|
10
10
|
class DerivedCorePropertiesImporter < PropertyImporter
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
property_name: nil,
|
17
|
-
data_url: DATA_URL,
|
18
|
-
data_path: File.basename(DATA_URL),
|
19
|
-
database: database
|
20
|
-
)
|
21
|
-
end
|
11
|
+
DATA_FILE = 'ucd/DerivedCoreProperties.txt'
|
12
|
+
|
13
|
+
requirement :unicode, Versions.unicode_version, [DATA_FILE]
|
14
|
+
output_path 'unicode_data/properties'
|
15
|
+
ruby_engine :mri
|
22
16
|
|
23
17
|
private
|
24
18
|
|
19
|
+
def source_path
|
20
|
+
requirements[:unicode].source_path_for(DATA_FILE)
|
21
|
+
end
|
22
|
+
|
25
23
|
def load
|
26
24
|
super do |data, ret|
|
27
25
|
code_points = expand_range(data[0])
|
@@ -8,17 +8,21 @@ module TwitterCldr
|
|
8
8
|
module Properties
|
9
9
|
|
10
10
|
class EastAsianWidthPropertyImporter < PropertyImporter
|
11
|
-
|
11
|
+
DATA_FILE = 'ucd/EastAsianWidth.txt'
|
12
12
|
PROPERTY_NAME = 'East_Asian_Width'
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
requirement :unicode, Versions.unicode_version, [DATA_FILE]
|
15
|
+
output_path 'unicode_data/properties'
|
16
|
+
ruby_engine :mri
|
17
|
+
|
18
|
+
def property_name
|
19
|
+
PROPERTY_NAME
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def source_path
|
25
|
+
requirements[:unicode].source_path_for(DATA_FILE)
|
22
26
|
end
|
23
27
|
end
|
24
28
|
|