twitter_cldr 3.0.0.beta1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +16 -2
- data/History.txt +9 -1
- data/README.md +297 -113
- data/Rakefile +97 -17
- data/lib/twitter_cldr/collation/collator.rb +12 -3
- data/lib/twitter_cldr/collation/trie_builder.rb +1 -1
- data/lib/twitter_cldr/{tokenizers/calendars → data_readers}/additional_date_format_selector.rb +6 -4
- data/lib/twitter_cldr/data_readers/calendar_data_reader.rb +91 -0
- data/lib/twitter_cldr/data_readers/data_reader.rb +32 -0
- data/lib/twitter_cldr/data_readers/date_data_reader.rb +26 -0
- data/lib/twitter_cldr/data_readers/date_time_data_reader.rb +41 -0
- data/lib/twitter_cldr/data_readers/number_data_reader.rb +142 -0
- data/lib/twitter_cldr/data_readers/time_data_reader.rb +26 -0
- data/lib/twitter_cldr/data_readers/timespan_data_reader.rb +122 -0
- data/lib/twitter_cldr/data_readers.rb +17 -0
- data/lib/twitter_cldr/formatters/calendars/{datetime_formatter.rb → date_time_formatter.rb} +27 -42
- data/lib/twitter_cldr/formatters/calendars/timespan_formatter.rb +3 -64
- data/lib/twitter_cldr/formatters/formatter.rb +39 -0
- data/lib/twitter_cldr/formatters/list_formatter.rb +22 -12
- data/lib/twitter_cldr/formatters/numbers/abbreviated/abbreviated_number_formatter.rb +5 -26
- data/lib/twitter_cldr/formatters/numbers/currency_formatter.rb +2 -11
- data/lib/twitter_cldr/formatters/numbers/decimal_formatter.rb +4 -2
- data/lib/twitter_cldr/formatters/numbers/number_formatter.rb +45 -27
- data/lib/twitter_cldr/formatters/numbers/percent_formatter.rb +3 -13
- data/lib/twitter_cldr/formatters/numbers/rbnf/formatters.rb +224 -0
- data/lib/twitter_cldr/formatters/numbers/rbnf/post_processors/chinese.rb +122 -0
- data/lib/twitter_cldr/formatters/numbers/rbnf/rule.rb +93 -0
- data/lib/twitter_cldr/formatters/numbers/rbnf/rule_group.rb +20 -0
- data/lib/twitter_cldr/formatters/numbers/rbnf/rule_parser.rb +86 -0
- data/lib/twitter_cldr/formatters/numbers/rbnf/rule_set.rb +259 -0
- data/lib/twitter_cldr/formatters/numbers/rbnf/substitution.rb +30 -0
- data/lib/twitter_cldr/formatters/numbers/rbnf.rb +127 -0
- data/lib/twitter_cldr/formatters/plurals/plural_formatter.rb +18 -6
- data/lib/twitter_cldr/formatters.rb +4 -5
- data/lib/twitter_cldr/localized/localized_array.rb +1 -1
- data/lib/twitter_cldr/localized/localized_date.rb +6 -3
- data/lib/twitter_cldr/localized/localized_datetime.rb +38 -15
- data/lib/twitter_cldr/localized/localized_number.rb +40 -24
- data/lib/twitter_cldr/localized/localized_object.rb +4 -4
- data/lib/twitter_cldr/localized/localized_string.rb +40 -7
- data/lib/twitter_cldr/localized/localized_time.rb +9 -2
- data/lib/twitter_cldr/localized/localized_timespan.rb +50 -5
- data/lib/twitter_cldr/normalization.rb +8 -19
- data/lib/twitter_cldr/parsers/parser.rb +50 -0
- data/lib/twitter_cldr/parsers/segmentation_parser.rb +137 -0
- data/lib/twitter_cldr/parsers/symbol_table.rb +30 -0
- data/lib/twitter_cldr/parsers/unicode_regex/character_class.rb +91 -0
- data/lib/twitter_cldr/parsers/unicode_regex/character_range.rb +39 -0
- data/lib/twitter_cldr/parsers/unicode_regex/character_set.rb +65 -0
- data/lib/twitter_cldr/parsers/unicode_regex/component.rb +50 -0
- data/lib/twitter_cldr/parsers/unicode_regex/literal.rb +83 -0
- data/lib/twitter_cldr/parsers/unicode_regex/unicode_string.rb +41 -0
- data/lib/twitter_cldr/parsers/unicode_regex_parser.rb +262 -0
- data/lib/twitter_cldr/parsers.rb +5 -1
- data/lib/twitter_cldr/resources/casefolder.rb.erb +64 -0
- data/lib/twitter_cldr/resources/casefolder_class_generator.rb +75 -0
- data/lib/twitter_cldr/resources/download.rb +10 -4
- data/lib/twitter_cldr/resources/icu_based_importer.rb +18 -0
- data/lib/twitter_cldr/resources/locales_resources_importer.rb +24 -13
- data/lib/twitter_cldr/resources/normalization_quick_check_importer.rb +1 -14
- data/lib/twitter_cldr/resources/rbnf_test_importer.rb +107 -0
- data/lib/twitter_cldr/resources/readme_renderer.rb +115 -0
- data/lib/twitter_cldr/resources/tailoring_importer.rb +2 -8
- data/lib/twitter_cldr/resources/uli/segment_exceptions_importer.rb +62 -0
- data/lib/twitter_cldr/resources/uli.rb +12 -0
- data/lib/twitter_cldr/resources/unicode_data_importer.rb +84 -14
- data/lib/twitter_cldr/resources/unicode_importer.rb +37 -0
- data/lib/twitter_cldr/resources/unicode_properties_importer.rb +79 -0
- data/lib/twitter_cldr/resources.rb +8 -1
- data/lib/twitter_cldr/shared/break_iterator.rb +213 -0
- data/lib/twitter_cldr/shared/calendar.rb +38 -14
- data/lib/twitter_cldr/shared/casefolder.rb +210 -0
- data/lib/twitter_cldr/shared/code_point.rb +103 -16
- data/lib/twitter_cldr/shared/numbering_system.rb +58 -0
- data/lib/twitter_cldr/shared/territories.rb +43 -1
- data/lib/twitter_cldr/shared/unicode_regex.rb +81 -0
- data/lib/twitter_cldr/shared.rb +13 -9
- data/lib/twitter_cldr/tokenizers/calendars/date_time_tokenizer.rb +77 -0
- data/lib/twitter_cldr/tokenizers/calendars/date_tokenizer.rb +14 -29
- data/lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb +13 -28
- data/lib/twitter_cldr/tokenizers/calendars/timespan_tokenizer.rb +11 -87
- data/lib/twitter_cldr/tokenizers/numbers/number_tokenizer.rb +16 -71
- data/lib/twitter_cldr/tokenizers/numbers/rbnf_tokenizer.rb +53 -0
- data/lib/twitter_cldr/tokenizers/pattern_tokenizer.rb +42 -0
- data/lib/twitter_cldr/tokenizers/segmentation/segmentation_tokenizer.rb +39 -0
- data/lib/twitter_cldr/tokenizers/tokenizer.rb +116 -0
- data/lib/twitter_cldr/tokenizers/unicode_regex/unicode_regex_tokenizer.rb +52 -0
- data/lib/twitter_cldr/tokenizers.rb +8 -4
- data/lib/twitter_cldr/utils/code_points.rb +1 -1
- data/lib/twitter_cldr/utils/range_set.rb +242 -0
- data/lib/twitter_cldr/utils/yaml.rb +17 -12
- data/lib/twitter_cldr/utils.rb +1 -1
- data/lib/twitter_cldr/version.rb +1 -1
- data/lib/twitter_cldr.rb +2 -1
- data/resources/custom/locales/sv/units.yml +8 -0
- data/resources/locales/af/calendars.yml +278 -224
- data/resources/locales/af/currencies.yml +954 -916
- data/resources/locales/af/languages.yml +583 -580
- data/resources/locales/af/layout.yml +5 -5
- data/resources/locales/af/lists.yml +23 -7
- data/resources/locales/af/numbers.yml +59 -54
- data/resources/locales/af/plurals.yml +2 -2
- data/resources/locales/af/rbnf.yml +261 -0
- data/resources/locales/af/territories.yml +264 -263
- data/resources/locales/ar/calendars.yml +287 -259
- data/resources/locales/ar/currencies.yml +1730 -1692
- data/resources/locales/ar/languages.yml +583 -580
- data/resources/locales/ar/layout.yml +5 -5
- data/resources/locales/ar/lists.yml +23 -7
- data/resources/locales/ar/numbers.yml +66 -61
- data/resources/locales/ar/plurals.yml +5 -8
- data/resources/locales/ar/rbnf.yml +519 -0
- data/resources/locales/ar/territories.yml +264 -263
- data/resources/locales/be/calendars.yml +238 -237
- data/resources/locales/be/currencies.yml +954 -917
- data/resources/locales/be/languages.yml +583 -580
- data/resources/locales/be/layout.yml +5 -5
- data/resources/locales/be/lists.yml +23 -7
- data/resources/locales/be/numbers.yml +62 -57
- data/resources/locales/be/plurals.yml +7 -4
- data/resources/locales/be/rbnf.yml +1288 -0
- data/resources/locales/be/territories.yml +264 -263
- data/resources/locales/bg/calendars.yml +278 -218
- data/resources/locales/bg/currencies.yml +955 -917
- data/resources/locales/bg/languages.yml +583 -580
- data/resources/locales/bg/layout.yml +5 -5
- data/resources/locales/bg/lists.yml +23 -7
- data/resources/locales/bg/numbers.yml +62 -57
- data/resources/locales/bg/plurals.yml +2 -2
- data/resources/locales/bg/rbnf.yml +280 -0
- data/resources/locales/bg/territories.yml +264 -263
- data/resources/locales/bn/calendars.yml +287 -225
- data/resources/locales/bn/currencies.yml +953 -916
- data/resources/locales/bn/languages.yml +583 -580
- data/resources/locales/bn/layout.yml +5 -5
- data/resources/locales/bn/lists.yml +23 -7
- data/resources/locales/bn/numbers.yml +62 -57
- data/resources/locales/bn/plurals.yml +2 -2
- data/resources/locales/bn/rbnf.yml +4 -0
- data/resources/locales/bn/territories.yml +264 -263
- data/resources/locales/ca/calendars.yml +278 -278
- data/resources/locales/ca/currencies.yml +953 -916
- data/resources/locales/ca/languages.yml +583 -580
- data/resources/locales/ca/layout.yml +5 -5
- data/resources/locales/ca/lists.yml +23 -7
- data/resources/locales/ca/numbers.yml +62 -57
- data/resources/locales/ca/plurals.yml +3 -2
- data/resources/locales/ca/rbnf.yml +756 -0
- data/resources/locales/ca/territories.yml +264 -263
- data/resources/locales/cs/calendars.yml +269 -262
- data/resources/locales/cs/currencies.yml +1483 -1172
- data/resources/locales/cs/languages.yml +583 -580
- data/resources/locales/cs/layout.yml +5 -5
- data/resources/locales/cs/lists.yml +23 -7
- data/resources/locales/cs/numbers.yml +64 -58
- data/resources/locales/cs/plurals.yml +6 -2
- data/resources/locales/cs/rbnf.yml +367 -0
- data/resources/locales/cs/territories.yml +264 -263
- data/resources/locales/cy/calendars.yml +275 -274
- data/resources/locales/cy/currencies.yml +1585 -1548
- data/resources/locales/cy/languages.yml +583 -580
- data/resources/locales/cy/layout.yml +5 -5
- data/resources/locales/cy/lists.yml +23 -7
- data/resources/locales/cy/numbers.yml +66 -61
- data/resources/locales/cy/plurals.yml +4 -3
- data/resources/locales/cy/rbnf.yml +298 -0
- data/resources/locales/cy/territories.yml +264 -263
- data/resources/locales/da/calendars.yml +281 -280
- data/resources/locales/da/currencies.yml +954 -916
- data/resources/locales/da/languages.yml +583 -580
- data/resources/locales/da/layout.yml +5 -5
- data/resources/locales/da/lists.yml +23 -7
- data/resources/locales/da/numbers.yml +62 -57
- data/resources/locales/da/plurals.yml +3 -2
- data/resources/locales/da/rbnf.yml +194 -0
- data/resources/locales/da/territories.yml +264 -263
- data/resources/locales/de/calendars.yml +294 -293
- data/resources/locales/de/currencies.yml +954 -916
- data/resources/locales/de/languages.yml +583 -580
- data/resources/locales/de/layout.yml +5 -5
- data/resources/locales/de/lists.yml +23 -7
- data/resources/locales/de/numbers.yml +62 -57
- data/resources/locales/de/plurals.yml +3 -2
- data/resources/locales/de/rbnf.yml +346 -0
- data/resources/locales/de/territories.yml +264 -263
- data/resources/locales/el/calendars.yml +279 -282
- data/resources/locales/el/currencies.yml +954 -916
- data/resources/locales/el/languages.yml +583 -580
- data/resources/locales/el/layout.yml +5 -5
- data/resources/locales/el/lists.yml +23 -7
- data/resources/locales/el/numbers.yml +62 -57
- data/resources/locales/el/plurals.yml +2 -2
- data/resources/locales/el/rbnf.yml +880 -0
- data/resources/locales/el/territories.yml +264 -263
- data/resources/locales/en/calendars.yml +192 -191
- data/resources/locales/en/currencies.yml +953 -915
- data/resources/locales/en/languages.yml +583 -580
- data/resources/locales/en/layout.yml +5 -5
- data/resources/locales/en/lists.yml +23 -7
- data/resources/locales/en/numbers.yml +62 -57
- data/resources/locales/en/plurals.yml +3 -2
- data/resources/locales/en/rbnf.yml +542 -0
- data/resources/locales/en/territories.yml +264 -263
- data/resources/locales/en-GB/calendars.yml +195 -194
- data/resources/locales/en-GB/currencies.yml +953 -915
- data/resources/locales/en-GB/languages.yml +583 -580
- data/resources/locales/en-GB/layout.yml +5 -5
- data/resources/locales/en-GB/lists.yml +23 -7
- data/resources/locales/en-GB/numbers.yml +62 -57
- data/resources/locales/en-GB/plurals.yml +2 -1
- data/resources/locales/en-GB/rbnf.yml +4 -0
- data/resources/locales/en-GB/territories.yml +264 -263
- data/resources/locales/es/calendars.yml +288 -238
- data/resources/locales/es/currencies.yml +953 -922
- data/resources/locales/es/languages.yml +583 -580
- data/resources/locales/es/layout.yml +5 -5
- data/resources/locales/es/lists.yml +23 -7
- data/resources/locales/es/numbers.yml +62 -57
- data/resources/locales/es/plurals.yml +2 -2
- data/resources/locales/es/rbnf.yml +913 -0
- data/resources/locales/es/territories.yml +264 -263
- data/resources/locales/eu/calendars.yml +277 -218
- data/resources/locales/eu/currencies.yml +953 -916
- data/resources/locales/eu/languages.yml +583 -580
- data/resources/locales/eu/layout.yml +5 -5
- data/resources/locales/eu/lists.yml +23 -7
- data/resources/locales/eu/numbers.yml +56 -51
- data/resources/locales/eu/plurals.yml +2 -2
- data/resources/locales/eu/rbnf.yml +4 -0
- data/resources/locales/eu/territories.yml +264 -263
- data/resources/locales/fa/calendars.yml +294 -293
- data/resources/locales/fa/currencies.yml +955 -916
- data/resources/locales/fa/languages.yml +583 -580
- data/resources/locales/fa/layout.yml +5 -5
- data/resources/locales/fa/lists.yml +23 -7
- data/resources/locales/fa/numbers.yml +62 -57
- data/resources/locales/fa/plurals.yml +2 -2
- data/resources/locales/fa/rbnf.yml +157 -0
- data/resources/locales/fa/territories.yml +264 -263
- data/resources/locales/fi/calendars.yml +284 -283
- data/resources/locales/fi/currencies.yml +953 -915
- data/resources/locales/fi/languages.yml +583 -580
- data/resources/locales/fi/layout.yml +5 -5
- data/resources/locales/fi/lists.yml +23 -7
- data/resources/locales/fi/numbers.yml +62 -57
- data/resources/locales/fi/plurals.yml +3 -2
- data/resources/locales/fi/rbnf.yml +206 -0
- data/resources/locales/fi/territories.yml +264 -263
- data/resources/locales/fil/calendars.yml +281 -230
- data/resources/locales/fil/currencies.yml +953 -916
- data/resources/locales/fil/languages.yml +583 -580
- data/resources/locales/fil/layout.yml +5 -5
- data/resources/locales/fil/lists.yml +23 -7
- data/resources/locales/fil/numbers.yml +62 -57
- data/resources/locales/fil/plurals.yml +3 -2
- data/resources/locales/fil/rbnf.yml +158 -0
- data/resources/locales/fil/territories.yml +264 -263
- data/resources/locales/fr/calendars.yml +297 -296
- data/resources/locales/fr/currencies.yml +968 -949
- data/resources/locales/fr/languages.yml +583 -580
- data/resources/locales/fr/layout.yml +5 -5
- data/resources/locales/fr/lists.yml +23 -7
- data/resources/locales/fr/numbers.yml +62 -57
- data/resources/locales/fr/plurals.yml +2 -2
- data/resources/locales/fr/rbnf.yml +621 -0
- data/resources/locales/fr/territories.yml +264 -263
- data/resources/locales/ga/calendars.yml +192 -191
- data/resources/locales/ga/currencies.yml +954 -916
- data/resources/locales/ga/languages.yml +583 -580
- data/resources/locales/ga/layout.yml +5 -5
- data/resources/locales/ga/lists.yml +23 -7
- data/resources/locales/ga/numbers.yml +62 -57
- data/resources/locales/ga/plurals.yml +4 -3
- data/resources/locales/ga/rbnf.yml +615 -0
- data/resources/locales/ga/territories.yml +264 -263
- data/resources/locales/gl/calendars.yml +283 -217
- data/resources/locales/gl/currencies.yml +953 -916
- data/resources/locales/gl/languages.yml +583 -580
- data/resources/locales/gl/layout.yml +5 -5
- data/resources/locales/gl/lists.yml +23 -7
- data/resources/locales/gl/numbers.yml +62 -57
- data/resources/locales/gl/plurals.yml +3 -2
- data/resources/locales/gl/rbnf.yml +4 -0
- data/resources/locales/gl/territories.yml +264 -263
- data/resources/locales/he/calendars.yml +248 -220
- data/resources/locales/he/currencies.yml +992 -932
- data/resources/locales/he/languages.yml +583 -580
- data/resources/locales/he/layout.yml +5 -5
- data/resources/locales/he/lists.yml +23 -7
- data/resources/locales/he/numbers.yml +64 -59
- data/resources/locales/he/plurals.yml +6 -3
- data/resources/locales/he/rbnf.yml +1029 -0
- data/resources/locales/he/territories.yml +264 -263
- data/resources/locales/hi/calendars.yml +284 -216
- data/resources/locales/hi/currencies.yml +953 -915
- data/resources/locales/hi/languages.yml +583 -580
- data/resources/locales/hi/layout.yml +5 -5
- data/resources/locales/hi/lists.yml +23 -7
- data/resources/locales/hi/numbers.yml +60 -55
- data/resources/locales/hi/plurals.yml +2 -2
- data/resources/locales/hi/rbnf.yml +430 -0
- data/resources/locales/hi/territories.yml +264 -263
- data/resources/locales/hr/calendars.yml +308 -307
- data/resources/locales/hr/currencies.yml +1248 -1504
- data/resources/locales/hr/languages.yml +583 -580
- data/resources/locales/hr/layout.yml +5 -5
- data/resources/locales/hr/lists.yml +23 -7
- data/resources/locales/hr/numbers.yml +63 -59
- data/resources/locales/hr/plurals.yml +12 -4
- data/resources/locales/hr/rbnf.yml +599 -0
- data/resources/locales/hr/territories.yml +264 -263
- data/resources/locales/hu/calendars.yml +285 -284
- data/resources/locales/hu/currencies.yml +954 -916
- data/resources/locales/hu/languages.yml +583 -580
- data/resources/locales/hu/layout.yml +5 -5
- data/resources/locales/hu/lists.yml +23 -7
- data/resources/locales/hu/numbers.yml +62 -57
- data/resources/locales/hu/plurals.yml +2 -2
- data/resources/locales/hu/rbnf.yml +363 -0
- data/resources/locales/hu/territories.yml +264 -263
- data/resources/locales/id/calendars.yml +276 -275
- data/resources/locales/id/currencies.yml +954 -916
- data/resources/locales/id/languages.yml +583 -580
- data/resources/locales/id/layout.yml +5 -5
- data/resources/locales/id/lists.yml +23 -7
- data/resources/locales/id/numbers.yml +61 -56
- data/resources/locales/id/plurals.yml +2 -2
- data/resources/locales/id/rbnf.yml +121 -0
- data/resources/locales/id/territories.yml +264 -263
- data/resources/locales/is/calendars.yml +281 -242
- data/resources/locales/is/currencies.yml +954 -916
- data/resources/locales/is/languages.yml +583 -580
- data/resources/locales/is/layout.yml +5 -5
- data/resources/locales/is/lists.yml +23 -7
- data/resources/locales/is/numbers.yml +62 -57
- data/resources/locales/is/plurals.yml +5 -2
- data/resources/locales/is/rbnf.yml +326 -0
- data/resources/locales/is/territories.yml +264 -263
- data/resources/locales/it/calendars.yml +275 -260
- data/resources/locales/it/currencies.yml +953 -920
- data/resources/locales/it/languages.yml +583 -580
- data/resources/locales/it/layout.yml +5 -5
- data/resources/locales/it/lists.yml +23 -7
- data/resources/locales/it/numbers.yml +59 -54
- data/resources/locales/it/plurals.yml +3 -2
- data/resources/locales/it/rbnf.yml +1189 -0
- data/resources/locales/it/territories.yml +264 -263
- data/resources/locales/ja/calendars.yml +269 -207
- data/resources/locales/ja/currencies.yml +953 -915
- data/resources/locales/ja/languages.yml +583 -580
- data/resources/locales/ja/layout.yml +5 -5
- data/resources/locales/ja/lists.yml +23 -7
- data/resources/locales/ja/numbers.yml +62 -57
- data/resources/locales/ja/plurals.yml +2 -2
- data/resources/locales/ja/rbnf.yml +209 -0
- data/resources/locales/ja/territories.yml +264 -263
- data/resources/locales/ko/calendars.yml +246 -213
- data/resources/locales/ko/currencies.yml +953 -915
- data/resources/locales/ko/languages.yml +583 -580
- data/resources/locales/ko/layout.yml +5 -5
- data/resources/locales/ko/lists.yml +23 -7
- data/resources/locales/ko/numbers.yml +60 -55
- data/resources/locales/ko/plurals.yml +2 -2
- data/resources/locales/ko/rbnf.yml +722 -0
- data/resources/locales/ko/territories.yml +264 -263
- data/resources/locales/lv/calendars.yml +286 -285
- data/resources/locales/lv/currencies.yml +1122 -1084
- data/resources/locales/lv/languages.yml +583 -580
- data/resources/locales/lv/layout.yml +5 -5
- data/resources/locales/lv/lists.yml +23 -7
- data/resources/locales/lv/numbers.yml +63 -58
- data/resources/locales/lv/plurals.yml +11 -3
- data/resources/locales/lv/rbnf.yml +238 -0
- data/resources/locales/lv/territories.yml +264 -263
- data/resources/locales/ms/calendars.yml +280 -279
- data/resources/locales/ms/currencies.yml +954 -916
- data/resources/locales/ms/languages.yml +583 -580
- data/resources/locales/ms/layout.yml +5 -5
- data/resources/locales/ms/lists.yml +23 -7
- data/resources/locales/ms/numbers.yml +62 -57
- data/resources/locales/ms/plurals.yml +2 -2
- data/resources/locales/ms/rbnf.yml +130 -0
- data/resources/locales/ms/territories.yml +264 -263
- data/resources/locales/nb/calendars.yml +284 -283
- data/resources/locales/nb/currencies.yml +958 -916
- data/resources/locales/nb/languages.yml +583 -580
- data/resources/locales/nb/layout.yml +5 -5
- data/resources/locales/nb/lists.yml +23 -7
- data/resources/locales/nb/numbers.yml +62 -57
- data/resources/locales/nb/plurals.yml +2 -2
- data/resources/locales/nb/rbnf.yml +191 -0
- data/resources/locales/nb/territories.yml +264 -263
- data/resources/locales/nl/calendars.yml +285 -284
- data/resources/locales/nl/currencies.yml +953 -917
- data/resources/locales/nl/languages.yml +583 -580
- data/resources/locales/nl/layout.yml +5 -5
- data/resources/locales/nl/lists.yml +23 -7
- data/resources/locales/nl/numbers.yml +62 -57
- data/resources/locales/nl/plurals.yml +3 -2
- data/resources/locales/nl/rbnf.yml +320 -0
- data/resources/locales/nl/territories.yml +264 -263
- data/resources/locales/pl/calendars.yml +288 -287
- data/resources/locales/pl/currencies.yml +1326 -1284
- data/resources/locales/pl/languages.yml +583 -580
- data/resources/locales/pl/layout.yml +5 -5
- data/resources/locales/pl/lists.yml +23 -7
- data/resources/locales/pl/numbers.yml +64 -59
- data/resources/locales/pl/plurals.yml +11 -4
- data/resources/locales/pl/rbnf.yml +410 -0
- data/resources/locales/pl/territories.yml +264 -263
- data/resources/locales/pt/calendars.yml +290 -289
- data/resources/locales/pt/currencies.yml +954 -916
- data/resources/locales/pt/languages.yml +583 -580
- data/resources/locales/pt/layout.yml +5 -5
- data/resources/locales/pt/lists.yml +23 -7
- data/resources/locales/pt/numbers.yml +62 -57
- data/resources/locales/pt/plurals.yml +4 -2
- data/resources/locales/pt/rbnf.yml +586 -0
- data/resources/locales/pt/territories.yml +264 -263
- data/resources/locales/ro/calendars.yml +284 -283
- data/resources/locales/ro/currencies.yml +1170 -1132
- data/resources/locales/ro/languages.yml +583 -580
- data/resources/locales/ro/layout.yml +5 -5
- data/resources/locales/ro/lists.yml +23 -7
- data/resources/locales/ro/numbers.yml +63 -58
- data/resources/locales/ro/plurals.yml +5 -2
- data/resources/locales/ro/rbnf.yml +250 -0
- data/resources/locales/ro/territories.yml +264 -263
- data/resources/locales/ru/calendars.yml +282 -281
- data/resources/locales/ru/currencies.yml +1118 -1247
- data/resources/locales/ru/languages.yml +583 -580
- data/resources/locales/ru/layout.yml +5 -5
- data/resources/locales/ru/lists.yml +23 -7
- data/resources/locales/ru/numbers.yml +63 -59
- data/resources/locales/ru/plurals.yml +8 -4
- data/resources/locales/ru/rbnf.yml +385 -0
- data/resources/locales/ru/territories.yml +264 -263
- data/resources/locales/sk/calendars.yml +254 -251
- data/resources/locales/sk/currencies.yml +1174 -1008
- data/resources/locales/sk/languages.yml +583 -580
- data/resources/locales/sk/layout.yml +5 -5
- data/resources/locales/sk/lists.yml +23 -7
- data/resources/locales/sk/numbers.yml +64 -58
- data/resources/locales/sk/plurals.yml +6 -2
- data/resources/locales/sk/rbnf.yml +304 -0
- data/resources/locales/sk/territories.yml +264 -263
- data/resources/locales/sq/calendars.yml +283 -206
- data/resources/locales/sq/currencies.yml +954 -916
- data/resources/locales/sq/languages.yml +583 -580
- data/resources/locales/sq/layout.yml +5 -5
- data/resources/locales/sq/lists.yml +23 -7
- data/resources/locales/sq/numbers.yml +62 -57
- data/resources/locales/sq/plurals.yml +2 -2
- data/resources/locales/sq/rbnf.yml +181 -0
- data/resources/locales/sq/territories.yml +264 -263
- data/resources/locales/sr/calendars.yml +290 -289
- data/resources/locales/sr/currencies.yml +1251 -1508
- data/resources/locales/sr/languages.yml +583 -580
- data/resources/locales/sr/layout.yml +5 -5
- data/resources/locales/sr/lists.yml +23 -7
- data/resources/locales/sr/numbers.yml +62 -58
- data/resources/locales/sr/plurals.yml +12 -4
- data/resources/locales/sr/rbnf.yml +429 -0
- data/resources/locales/sr/territories.yml +264 -263
- data/resources/locales/sv/calendars.yml +290 -289
- data/resources/locales/sv/currencies.yml +960 -930
- data/resources/locales/sv/languages.yml +583 -580
- data/resources/locales/sv/layout.yml +5 -5
- data/resources/locales/sv/lists.yml +23 -7
- data/resources/locales/sv/numbers.yml +63 -58
- data/resources/locales/sv/plurals.yml +3 -2
- data/resources/locales/sv/rbnf.yml +692 -0
- data/resources/locales/sv/territories.yml +264 -263
- data/resources/locales/ta/calendars.yml +281 -266
- data/resources/locales/ta/currencies.yml +953 -915
- data/resources/locales/ta/languages.yml +583 -580
- data/resources/locales/ta/layout.yml +5 -5
- data/resources/locales/ta/lists.yml +23 -7
- data/resources/locales/ta/numbers.yml +62 -57
- data/resources/locales/ta/plurals.yml +2 -2
- data/resources/locales/ta/rbnf.yml +241 -0
- data/resources/locales/ta/territories.yml +264 -263
- data/resources/locales/th/calendars.yml +278 -289
- data/resources/locales/th/currencies.yml +953 -915
- data/resources/locales/th/languages.yml +583 -580
- data/resources/locales/th/layout.yml +5 -5
- data/resources/locales/th/lists.yml +23 -7
- data/resources/locales/th/numbers.yml +62 -57
- data/resources/locales/th/plurals.yml +2 -2
- data/resources/locales/th/rbnf.yml +119 -0
- data/resources/locales/th/territories.yml +264 -263
- data/resources/locales/tr/calendars.yml +287 -286
- data/resources/locales/tr/currencies.yml +953 -916
- data/resources/locales/tr/languages.yml +583 -580
- data/resources/locales/tr/layout.yml +5 -5
- data/resources/locales/tr/lists.yml +23 -7
- data/resources/locales/tr/numbers.yml +61 -56
- data/resources/locales/tr/plurals.yml +2 -2
- data/resources/locales/tr/rbnf.yml +277 -0
- data/resources/locales/tr/territories.yml +264 -263
- data/resources/locales/uk/calendars.yml +286 -252
- data/resources/locales/uk/currencies.yml +1311 -1070
- data/resources/locales/uk/languages.yml +583 -580
- data/resources/locales/uk/layout.yml +5 -5
- data/resources/locales/uk/lists.yml +23 -7
- data/resources/locales/uk/numbers.yml +64 -59
- data/resources/locales/uk/plurals.yml +10 -4
- data/resources/locales/uk/rbnf.yml +430 -0
- data/resources/locales/uk/territories.yml +264 -263
- data/resources/locales/ur/calendars.yml +267 -228
- data/resources/locales/ur/currencies.yml +954 -916
- data/resources/locales/ur/languages.yml +583 -580
- data/resources/locales/ur/layout.yml +5 -5
- data/resources/locales/ur/lists.yml +23 -7
- data/resources/locales/ur/numbers.yml +62 -57
- data/resources/locales/ur/plurals.yml +3 -2
- data/resources/locales/ur/rbnf.yml +4 -0
- data/resources/locales/ur/territories.yml +264 -263
- data/resources/locales/vi/calendars.yml +256 -236
- data/resources/locales/vi/currencies.yml +953 -915
- data/resources/locales/vi/languages.yml +583 -580
- data/resources/locales/vi/layout.yml +5 -5
- data/resources/locales/vi/lists.yml +23 -7
- data/resources/locales/vi/numbers.yml +62 -57
- data/resources/locales/vi/plurals.yml +2 -2
- data/resources/locales/vi/rbnf.yml +164 -0
- data/resources/locales/vi/territories.yml +264 -263
- data/resources/locales/zh/calendars.yml +266 -265
- data/resources/locales/zh/currencies.yml +953 -915
- data/resources/locales/zh/languages.yml +583 -580
- data/resources/locales/zh/layout.yml +5 -5
- data/resources/locales/zh/lists.yml +23 -7
- data/resources/locales/zh/numbers.yml +62 -57
- data/resources/locales/zh/plurals.yml +2 -2
- data/resources/locales/zh/rbnf.yml +689 -0
- data/resources/locales/zh/territories.yml +264 -263
- data/resources/locales/zh-Hant/calendars.yml +266 -265
- data/resources/locales/zh-Hant/currencies.yml +955 -915
- data/resources/locales/zh-Hant/languages.yml +583 -580
- data/resources/locales/zh-Hant/layout.yml +5 -5
- data/resources/locales/zh-Hant/lists.yml +23 -7
- data/resources/locales/zh-Hant/numbers.yml +62 -57
- data/resources/locales/zh-Hant/plurals.yml +2 -2
- data/resources/locales/zh-Hant/rbnf.yml +647 -0
- data/resources/locales/zh-Hant/territories.yml +264 -263
- data/resources/shared/currency_digits_and_rounding.yml +67 -64
- data/resources/shared/numbering_systems.yml +176 -0
- data/resources/shared/rbnf_root.yml +1573 -0
- data/resources/shared/segments/segments_root.yml +728 -0
- data/resources/shared/segments/tailorings/en.yml +8 -0
- data/resources/uli/segments/de.yml +128 -0
- data/resources/uli/segments/en.yml +154 -0
- data/resources/uli/segments/es.yml +112 -0
- data/resources/uli/segments/fr.yml +47 -0
- data/resources/uli/segments/it.yml +37 -0
- data/resources/uli/segments/pt.yml +173 -0
- data/resources/uli/segments/ru.yml +10 -0
- data/resources/unicode_data/casefolding.yml +4765 -0
- data/resources/unicode_data/indices/bidi_class.yml +4572 -0
- data/resources/unicode_data/indices/bidi_mirrored.yml +3087 -0
- data/resources/unicode_data/indices/category.yml +10918 -0
- data/resources/unicode_data/indices/keys.yml +101 -0
- data/resources/unicode_data/properties/line_break.yml +9269 -0
- data/resources/unicode_data/properties/sentence_break.yml +8067 -0
- data/resources/unicode_data/properties/word_break.yml +3001 -0
- data/spec/collation/collation_spec.rb +2 -1
- data/spec/collation/collator_spec.rb +4 -3
- data/spec/collation/tailoring_spec.rb +2 -2
- data/spec/collation/tailoring_tests/he.txt +5 -2
- data/spec/{tokenizers/calendars → data_readers}/additional_date_format_selector_spec.rb +13 -13
- data/spec/data_readers/date_time_data_reader_spec.rb +26 -0
- data/spec/data_readers/number_data_reader_spec.rb +18 -0
- data/spec/data_readers/timespan_data_reader.rb +22 -0
- data/spec/formatters/calendars/datetime_formatter_spec.rb +18 -22
- data/spec/formatters/list_formatter_spec.rb +16 -87
- data/spec/formatters/numbers/abbreviated/abbreviated_number_formatter_spec.rb +15 -59
- data/spec/formatters/numbers/abbreviated/long_decimal_formatter_spec.rb +32 -17
- data/spec/formatters/numbers/abbreviated/short_decimal_formatter_spec.rb +33 -17
- data/spec/formatters/numbers/currency_formatter_spec.rb +18 -13
- data/spec/formatters/numbers/decimal_formatter_spec.rb +16 -18
- data/spec/formatters/numbers/number_formatter_spec.rb +40 -31
- data/spec/formatters/numbers/percent_formatter_spec.rb +14 -6
- data/spec/formatters/numbers/rbnf/allowed_failures.yml +74 -0
- data/spec/formatters/numbers/rbnf/locales/af/rbnf_test.yml +706 -0
- data/spec/formatters/numbers/rbnf/locales/ar/rbnf_test.yml +706 -0
- data/spec/formatters/numbers/rbnf/locales/be/rbnf_test.yml +1174 -0
- data/spec/formatters/numbers/rbnf/locales/bg/rbnf_test.yml +706 -0
- data/spec/formatters/numbers/rbnf/locales/bn/rbnf_test.yml +1291 -0
- data/spec/formatters/numbers/rbnf/locales/ca/rbnf_test.yml +1174 -0
- data/spec/formatters/numbers/rbnf/locales/cs/rbnf_test.yml +823 -0
- data/spec/formatters/numbers/rbnf/locales/cy/rbnf_test.yml +940 -0
- data/spec/formatters/numbers/rbnf/locales/da/rbnf_test.yml +940 -0
- data/spec/formatters/numbers/rbnf/locales/de/rbnf_test.yml +940 -0
- data/spec/formatters/numbers/rbnf/locales/el/rbnf_test.yml +1174 -0
- data/spec/formatters/numbers/rbnf/locales/en/rbnf_test.yml +1291 -0
- data/spec/formatters/numbers/rbnf/locales/en-GB/rbnf_test.yml +1291 -0
- data/spec/formatters/numbers/rbnf/locales/es/rbnf_test.yml +1642 -0
- data/spec/formatters/numbers/rbnf/locales/eu/rbnf_test.yml +1291 -0
- data/spec/formatters/numbers/rbnf/locales/fa/rbnf_test.yml +589 -0
- data/spec/formatters/numbers/rbnf/locales/fi/rbnf_test.yml +706 -0
- data/spec/formatters/numbers/rbnf/locales/fil/rbnf_test.yml +706 -0
- data/spec/formatters/numbers/rbnf/locales/fr/rbnf_test.yml +1408 -0
- data/spec/formatters/numbers/rbnf/locales/ga/rbnf_test.yml +940 -0
- data/spec/formatters/numbers/rbnf/locales/gl/rbnf_test.yml +1291 -0
- data/spec/formatters/numbers/rbnf/locales/he/rbnf_test.yml +1057 -0
- data/spec/formatters/numbers/rbnf/locales/hi/rbnf_test.yml +823 -0
- data/spec/formatters/numbers/rbnf/locales/hr/rbnf_test.yml +1174 -0
- data/spec/formatters/numbers/rbnf/locales/hu/rbnf_test.yml +940 -0
- data/spec/formatters/numbers/rbnf/locales/id/rbnf_test.yml +706 -0
- data/spec/formatters/numbers/rbnf/locales/is/rbnf_test.yml +823 -0
- data/spec/formatters/numbers/rbnf/locales/it/rbnf_test.yml +1174 -0
- data/spec/formatters/numbers/rbnf/locales/ja/rbnf_test.yml +823 -0
- data/spec/formatters/numbers/rbnf/locales/ko/rbnf_test.yml +1408 -0
- data/spec/formatters/numbers/rbnf/locales/lv/rbnf_test.yml +706 -0
- data/spec/formatters/numbers/rbnf/locales/ms/rbnf_test.yml +706 -0
- data/spec/formatters/numbers/rbnf/locales/nb/rbnf_test.yml +940 -0
- data/spec/formatters/numbers/rbnf/locales/nl/rbnf_test.yml +706 -0
- data/spec/formatters/numbers/rbnf/locales/pl/rbnf_test.yml +823 -0
- data/spec/formatters/numbers/rbnf/locales/pt/rbnf_test.yml +1174 -0
- data/spec/formatters/numbers/rbnf/locales/ro/rbnf_test.yml +823 -0
- data/spec/formatters/numbers/rbnf/locales/ru/rbnf_test.yml +823 -0
- data/spec/formatters/numbers/rbnf/locales/sk/rbnf_test.yml +823 -0
- data/spec/formatters/numbers/rbnf/locales/sq/rbnf_test.yml +706 -0
- data/spec/formatters/numbers/rbnf/locales/sr/rbnf_test.yml +940 -0
- data/spec/formatters/numbers/rbnf/locales/sv/rbnf_test.yml +1876 -0
- data/spec/formatters/numbers/rbnf/locales/ta/rbnf_test.yml +706 -0
- data/spec/formatters/numbers/rbnf/locales/th/rbnf_test.yml +706 -0
- data/spec/formatters/numbers/rbnf/locales/tr/rbnf_test.yml +706 -0
- data/spec/formatters/numbers/rbnf/locales/uk/rbnf_test.yml +823 -0
- data/spec/formatters/numbers/rbnf/locales/ur/rbnf_test.yml +1291 -0
- data/spec/formatters/numbers/rbnf/locales/vi/rbnf_test.yml +706 -0
- data/spec/formatters/numbers/rbnf/locales/zh/rbnf_test.yml +940 -0
- data/spec/formatters/numbers/rbnf/locales/zh-Hant/rbnf_test.yml +940 -0
- data/spec/formatters/numbers/rbnf/rbnf_spec.rb +98 -0
- data/spec/formatters/plurals/plural_formatter_spec.rb +4 -4
- data/spec/formatters/plurals/rules_spec.rb +5 -5
- data/spec/localized/localized_date_spec.rb +1 -1
- data/spec/localized/localized_datetime_spec.rb +8 -13
- data/spec/localized/localized_number_spec.rb +17 -32
- data/spec/localized/localized_object_spec.rb +0 -5
- data/spec/localized/localized_string_spec.rb +40 -2
- data/spec/localized/localized_time_spec.rb +3 -6
- data/spec/localized/localized_timespan_spec.rb +144 -0
- data/spec/normalization_spec.rb +12 -12
- data/spec/parsers/number_parser_spec.rb +5 -5
- data/spec/parsers/parser_spec.rb +60 -0
- data/spec/parsers/segmentation_parser_spec.rb +96 -0
- data/spec/parsers/symbol_table_spec.rb +32 -0
- data/spec/parsers/unicode_regex/character_class_spec.rb +117 -0
- data/spec/parsers/unicode_regex/character_range_spec.rb +21 -0
- data/spec/parsers/unicode_regex/character_set_spec.rb +36 -0
- data/spec/parsers/unicode_regex/literal_spec.rb +34 -0
- data/spec/parsers/unicode_regex/unicode_string_spec.rb +22 -0
- data/spec/parsers/unicode_regex_parser_spec.rb +86 -0
- data/spec/readme_spec.rb +8 -269
- data/spec/shared/break_iterator_spec.rb +72 -0
- data/spec/shared/calendar_spec.rb +5 -4
- data/spec/shared/casefolder_spec.rb +30 -0
- data/spec/shared/casefolding.txt +251 -0
- data/spec/shared/casefolding_expected.txt +251 -0
- data/spec/shared/code_point_spec.rb +44 -14
- data/spec/shared/numbering_system_spec.rb +41 -0
- data/spec/shared/territories_spec.rb +14 -6
- data/spec/shared/unicode_regex_spec.rb +203 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/tokenizers/calendars/date_tokenizer_spec.rb +26 -30
- data/spec/tokenizers/calendars/datetime_tokenizer_spec.rb +11 -90
- data/spec/tokenizers/calendars/time_tokenizer_spec.rb +5 -5
- data/spec/tokenizers/calendars/timespan_tokenizer_spec.rb +17 -7
- data/spec/tokenizers/numbers/number_tokenizer_spec.rb +28 -27
- data/spec/tokenizers/segmentation/segmentation_tokenizer_spec.rb +40 -0
- data/spec/tokenizers/unicode_regex/unicode_regex_tokenizer_spec.rb +190 -0
- data/spec/utils/range_set_spec.rb +171 -0
- data/spec/utils/yaml/yaml_spec.rb +62 -51
- data/twitter_cldr.gemspec +1 -1
- metadata +199 -30
- data/lib/twitter_cldr/formatters/base.rb +0 -47
- data/lib/twitter_cldr/formatters/calendars/date_formatter.rb +0 -19
- data/lib/twitter_cldr/formatters/calendars/time_formatter.rb +0 -19
- data/lib/twitter_cldr/normalization/base.rb +0 -37
- data/lib/twitter_cldr/normalization/hangul.rb +0 -79
- data/lib/twitter_cldr/normalization/nfc.rb +0 -24
- data/lib/twitter_cldr/normalization/nfd.rb +0 -26
- data/lib/twitter_cldr/normalization/nfkc.rb +0 -114
- data/lib/twitter_cldr/normalization/nfkd.rb +0 -120
- data/lib/twitter_cldr/normalization/quick_check.rb +0 -41
- data/lib/twitter_cldr/tokenizers/base.rb +0 -169
- data/lib/twitter_cldr/tokenizers/calendars/datetime_tokenizer.rb +0 -131
- data/lib/twitter_cldr/utils/territories.rb +0 -56
- data/spec/formatters/base_spec.rb +0 -18
- data/spec/formatters/calendars/timespan_formatter_spec.rb +0 -112
- data/spec/normalization/NormalizationTestShort.txt +0 -602
- data/spec/normalization/base_spec.rb +0 -16
- data/spec/normalization/hangul_spec.rb +0 -42
- data/spec/normalization/normalization_spec.rb +0 -113
- data/spec/tokenizers/base_spec.rb +0 -259
- data/spec/utils/territories_spec.rb +0 -16
@@ -0,0 +1,122 @@
|
|
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 DataReaders
|
8
|
+
class TimespanDataReader < DataReader
|
9
|
+
|
10
|
+
DEFAULT_DIRECTION = :none
|
11
|
+
DEFAULT_TYPE = :default
|
12
|
+
VALID_UNITS = [:second, :minute, :hour, :day, :week, :month, :year]
|
13
|
+
BASE_PATH = [:units]
|
14
|
+
|
15
|
+
PATHS = {
|
16
|
+
:ago => {
|
17
|
+
:default => :'hour-past',
|
18
|
+
:second => :'second-past',
|
19
|
+
:minute => :'minute-past',
|
20
|
+
:hour => :'hour-past',
|
21
|
+
:day => :'day-past',
|
22
|
+
:week => :'week-past',
|
23
|
+
:month => :'month-past',
|
24
|
+
:year => :'year-past'
|
25
|
+
},
|
26
|
+
:until => {
|
27
|
+
:default => :'hour-future',
|
28
|
+
:second => :'second-future',
|
29
|
+
:minute => :'minute-future',
|
30
|
+
:hour => :'hour-future',
|
31
|
+
:day => :'day-future',
|
32
|
+
:week => :'week-future',
|
33
|
+
:month => :'month-future',
|
34
|
+
:year => :'year-future'
|
35
|
+
},
|
36
|
+
:none => {
|
37
|
+
:default => :second,
|
38
|
+
:second => :second,
|
39
|
+
:minute => :minute,
|
40
|
+
:hour => :hour,
|
41
|
+
:day => :day,
|
42
|
+
:week => :week,
|
43
|
+
:month => :month,
|
44
|
+
:year => :year
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
attr_reader :direction, :unit, :type, :rule
|
49
|
+
|
50
|
+
def initialize(locale, seconds, options = {})
|
51
|
+
super(locale)
|
52
|
+
|
53
|
+
@type = options[:type] || DEFAULT_TYPE
|
54
|
+
@direction = options[:direction] || DEFAULT_DIRECTION
|
55
|
+
@unit = options[:unit]
|
56
|
+
|
57
|
+
@rule = options[:rule] ||
|
58
|
+
TwitterCldr::Formatters::Plurals::Rules.rule_for(seconds, locale)
|
59
|
+
end
|
60
|
+
|
61
|
+
# type is stuff like :abbreviated, etc
|
62
|
+
def pattern
|
63
|
+
path = full_path_for(direction, unit, type)
|
64
|
+
available = traverse(path)
|
65
|
+
pluralization = pluralization_for(rule, available)
|
66
|
+
|
67
|
+
if available.include?(pluralization)
|
68
|
+
path << pluralization
|
69
|
+
else
|
70
|
+
return [] unless available.keys.first
|
71
|
+
path << available.keys.first
|
72
|
+
end
|
73
|
+
|
74
|
+
traverse(path)
|
75
|
+
end
|
76
|
+
|
77
|
+
def tokenizer
|
78
|
+
TwitterCldr::Tokenizers::TimespanTokenizer.new(self)
|
79
|
+
end
|
80
|
+
|
81
|
+
def formatter
|
82
|
+
TwitterCldr::Formatters::TimespanFormatter.new(self)
|
83
|
+
end
|
84
|
+
|
85
|
+
def all_types
|
86
|
+
traverse(BASE_PATH + [PATHS[direction][unit]]).keys
|
87
|
+
end
|
88
|
+
|
89
|
+
protected
|
90
|
+
|
91
|
+
def default_type
|
92
|
+
all_types.first
|
93
|
+
end
|
94
|
+
|
95
|
+
def pluralization_for(rule, available)
|
96
|
+
# sometimes the plural rule will return ":one" when the resource only contains a path with "1"
|
97
|
+
case rule
|
98
|
+
when :zero
|
99
|
+
available.include?(0) ? 0 : rule
|
100
|
+
when :one
|
101
|
+
available.include?(1) ? 1 : rule
|
102
|
+
when :two
|
103
|
+
available.include?(2) ? 2 : rule
|
104
|
+
else
|
105
|
+
rule
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def full_path_for(direction, unit, type)
|
110
|
+
BASE_PATH + [PATHS[direction][unit], type]
|
111
|
+
end
|
112
|
+
|
113
|
+
def resource
|
114
|
+
@resource = begin
|
115
|
+
raw = TwitterCldr.get_locale_resource(locale, :units)
|
116
|
+
raw[TwitterCldr.convert_locale(locale)]
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,17 @@
|
|
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 DataReaders
|
8
|
+
autoload :DataReader, "twitter_cldr/data_readers/data_reader"
|
9
|
+
autoload :NumberDataReader, "twitter_cldr/data_readers/number_data_reader"
|
10
|
+
autoload :CalendarDataReader, "twitter_cldr/data_readers/calendar_data_reader"
|
11
|
+
autoload :DateTimeDataReader, "twitter_cldr/data_readers/date_time_data_reader"
|
12
|
+
autoload :DateDataReader, "twitter_cldr/data_readers/date_data_reader"
|
13
|
+
autoload :TimeDataReader, "twitter_cldr/data_readers/time_data_reader"
|
14
|
+
autoload :TimespanDataReader, "twitter_cldr/data_readers/timespan_data_reader"
|
15
|
+
autoload :AdditionalDateFormatSelector, 'twitter_cldr/data_readers/additional_date_format_selector'
|
16
|
+
end
|
17
|
+
end
|
@@ -10,7 +10,8 @@ require 'tzinfo'
|
|
10
10
|
|
11
11
|
module TwitterCldr
|
12
12
|
module Formatters
|
13
|
-
class DateTimeFormatter <
|
13
|
+
class DateTimeFormatter < Formatter
|
14
|
+
|
14
15
|
WEEKDAY_KEYS = [:sun, :mon, :tue, :wed, :thu, :fri, :sat]
|
15
16
|
METHODS = { # ignoring u, l, g, j, A
|
16
17
|
'G' => :era,
|
@@ -42,43 +43,26 @@ module TwitterCldr
|
|
42
43
|
'V' => :timezone_metazone
|
43
44
|
}
|
44
45
|
|
45
|
-
|
46
|
-
locale = extract_locale(options)
|
47
|
-
cache_key = TwitterCldr::Utils.compute_cache_key("datetime", locale, options[:calendar_type])
|
48
|
-
@tokenizer = tokenizer_cache[cache_key] ||= TwitterCldr::Tokenizers::DateTimeTokenizer.new(
|
49
|
-
:locale => locale,
|
50
|
-
:calendar_type => options[:calendar_type]
|
51
|
-
)
|
52
|
-
end
|
53
|
-
|
54
|
-
def result_for_token(token, index, date, options = {})
|
55
|
-
self.send(METHODS[token.value[0].chr], date, token.value, token.value.size, options)
|
56
|
-
end
|
57
|
-
|
58
|
-
def additional_format_selector
|
59
|
-
@tokenizer.additional_format_selector
|
60
|
-
end
|
46
|
+
protected
|
61
47
|
|
62
|
-
def
|
63
|
-
|
48
|
+
def format_pattern(token, index, obj, options)
|
49
|
+
send(METHODS[token.value[0].chr], obj, token.value, token.value.size, options)
|
64
50
|
end
|
65
51
|
|
66
|
-
|
67
|
-
|
68
|
-
def tokenizer_cache
|
69
|
-
@@tokenizer_cache ||= {}
|
52
|
+
def calendar
|
53
|
+
data_reader.calendar
|
70
54
|
end
|
71
55
|
|
72
|
-
#
|
73
|
-
#
|
56
|
+
# There is incomplete era data in CLDR for certain locales like Hindi.
|
57
|
+
# Fall back if that happens.
|
74
58
|
def era(date, pattern, length, options = {})
|
75
59
|
choices = case length
|
76
60
|
when 0
|
77
61
|
["", ""]
|
78
62
|
when 1..3
|
79
|
-
|
63
|
+
calendar.eras(:abbr)
|
80
64
|
else
|
81
|
-
|
65
|
+
calendar.eras(:name)
|
82
66
|
end
|
83
67
|
|
84
68
|
if result = choices[date.year < 0 ? 0 : 1]
|
@@ -111,9 +95,9 @@ module TwitterCldr
|
|
111
95
|
when 2
|
112
96
|
quarter.to_s.rjust(length, '0')
|
113
97
|
when 3
|
114
|
-
|
98
|
+
calendar.quarters(:abbreviated, :format)[quarter]
|
115
99
|
when 4
|
116
|
-
|
100
|
+
calendar.quarters(:wide, :format)[quarter]
|
117
101
|
end
|
118
102
|
end
|
119
103
|
|
@@ -126,12 +110,12 @@ module TwitterCldr
|
|
126
110
|
quarter.to_s.rjust(length, '0')
|
127
111
|
when 3
|
128
112
|
raise NotImplementedError, 'requires cldr\'s "multiple inheritance"'
|
129
|
-
#
|
113
|
+
# calendar[:quarters][:'stand-alone'][:abbreviated][key]
|
130
114
|
when 4
|
131
115
|
raise NotImplementedError, 'requires cldr\'s "multiple inheritance"'
|
132
|
-
#
|
116
|
+
# calendar[:quarters][:'stand-alone'][:wide][key]
|
133
117
|
when 5
|
134
|
-
|
118
|
+
calendar.quarters(:narrow)[quarter]
|
135
119
|
end
|
136
120
|
end
|
137
121
|
|
@@ -142,12 +126,12 @@ module TwitterCldr
|
|
142
126
|
when 2
|
143
127
|
date.month.to_s.rjust(length, '0')
|
144
128
|
when 3
|
145
|
-
|
129
|
+
calendar.months(:abbreviated, :format)[date.month - 1]
|
146
130
|
when 4
|
147
|
-
|
131
|
+
calendar.months(:wide, :format)[date.month - 1]
|
148
132
|
when 5
|
149
133
|
raise NotImplementedError, 'requires cldr\'s "multiple inheritance"'
|
150
|
-
#
|
134
|
+
# calendar[:months][:format][:narrow][date.month]
|
151
135
|
else
|
152
136
|
# raise unknown date format
|
153
137
|
end
|
@@ -160,11 +144,11 @@ module TwitterCldr
|
|
160
144
|
when 2
|
161
145
|
date.month.to_s.rjust(length, '0')
|
162
146
|
when 3
|
163
|
-
|
147
|
+
calendar.months(:abbreviated)[date.month - 1]
|
164
148
|
when 4
|
165
|
-
|
149
|
+
calendar.months(:wide)[date.month - 1]
|
166
150
|
when 5
|
167
|
-
|
151
|
+
calendar.months(:narrow)[date.month - 1]
|
168
152
|
else
|
169
153
|
# raise unknown date format
|
170
154
|
end
|
@@ -183,11 +167,11 @@ module TwitterCldr
|
|
183
167
|
key = WEEKDAY_KEYS[date.wday]
|
184
168
|
case length
|
185
169
|
when 1..3
|
186
|
-
|
170
|
+
calendar.weekdays(:abbreviated, :format)[key]
|
187
171
|
when 4
|
188
|
-
|
172
|
+
calendar.weekdays(:wide, :format)[key]
|
189
173
|
when 5
|
190
|
-
|
174
|
+
calendar.weekdays(:narrow)[key]
|
191
175
|
end
|
192
176
|
end
|
193
177
|
|
@@ -215,7 +199,7 @@ module TwitterCldr
|
|
215
199
|
# Always use :wide form. Day-period design was changed in CLDR -
|
216
200
|
# http://cldr.unicode.org/development/development-process/design-proposals/day-period-design that means some
|
217
201
|
# major changes are required for a full support of day periods.
|
218
|
-
|
202
|
+
calendar.periods(:wide)[time.strftime('%p').downcase.to_sym]
|
219
203
|
end
|
220
204
|
|
221
205
|
def hour(time, pattern, length, options = {})
|
@@ -265,6 +249,7 @@ module TwitterCldr
|
|
265
249
|
def timezone_generic_non_location(time, pattern, length, options = {})
|
266
250
|
raise NotImplementedError, 'requires timezone translation data'
|
267
251
|
end
|
252
|
+
|
268
253
|
end
|
269
254
|
end
|
270
255
|
end
|
@@ -5,71 +5,10 @@
|
|
5
5
|
|
6
6
|
module TwitterCldr
|
7
7
|
module Formatters
|
8
|
-
class TimespanFormatter <
|
8
|
+
class TimespanFormatter < Formatter
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
TIME_IN_SECONDS = {
|
14
|
-
:second => 1,
|
15
|
-
:minute => 60,
|
16
|
-
:hour => 3600,
|
17
|
-
:day => 86400,
|
18
|
-
:week => 604800,
|
19
|
-
:month => 2629743.83,
|
20
|
-
:year => 31556926
|
21
|
-
}
|
22
|
-
|
23
|
-
def initialize(options = {})
|
24
|
-
locale = extract_locale(options)
|
25
|
-
@direction = options[:direction]
|
26
|
-
cache_key = TwitterCldr::Utils.compute_cache_key(locale)
|
27
|
-
@tokenizer = tokenizer_cache[cache_key] ||= TwitterCldr::Tokenizers::TimespanTokenizer.new(
|
28
|
-
:locale => locale
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
def format(seconds, fmt_options = {})
|
33
|
-
options = fmt_options.dup
|
34
|
-
options[:type] ||= DEFAULT_TYPE
|
35
|
-
options[:direction] ||= (seconds < 0 ? :ago : :until)
|
36
|
-
options[:unit] ||= calculate_unit(seconds.abs, options)
|
37
|
-
|
38
|
-
options[:number] = calculate_time(seconds.abs, options[:unit])
|
39
|
-
|
40
|
-
tokens = @tokenizer.tokens(options)
|
41
|
-
strings = tokens.map { |token| token[:value] }
|
42
|
-
strings.join.gsub(/\{[0-9]\}/, options[:number].to_s)
|
43
|
-
end
|
44
|
-
|
45
|
-
protected
|
46
|
-
|
47
|
-
def tokenizer_cache
|
48
|
-
@@tokenizer_cache ||= {}
|
49
|
-
end
|
50
|
-
|
51
|
-
def calculate_unit(seconds, unit_options = {})
|
52
|
-
options = unit_options.dup
|
53
|
-
options[:approximate] = false if options[:approximate].nil?
|
54
|
-
multiplier = options[:approximate] ? APPROXIMATE_MULTIPLIER : 1
|
55
|
-
|
56
|
-
if seconds < (TIME_IN_SECONDS[:minute] * multiplier) then :second
|
57
|
-
elsif seconds < (TIME_IN_SECONDS[:hour] * multiplier) then :minute
|
58
|
-
elsif seconds < (TIME_IN_SECONDS[:day] * multiplier) then :hour
|
59
|
-
elsif seconds < (TIME_IN_SECONDS[:week] * multiplier) then :day
|
60
|
-
elsif seconds < (TIME_IN_SECONDS[:month] * multiplier) then :week
|
61
|
-
elsif seconds < (TIME_IN_SECONDS[:year] * multiplier) then :month
|
62
|
-
else :year end
|
63
|
-
end
|
64
|
-
|
65
|
-
# 0 <-> 29 secs # => seconds
|
66
|
-
# 30 secs <-> 44 mins, 29 secs # => minutes
|
67
|
-
# 44 mins, 30 secs <-> 23 hrs, 59 mins, 29 secs # => hours
|
68
|
-
# 23 hrs, 59 mins, 29 secs <-> 29 days, 23 hrs, 59 mins, 29 secs # => days
|
69
|
-
# 29 days, 23 hrs, 59 mins, 29 secs <-> 1 yr minus 1 sec # => months
|
70
|
-
# 1 yr <-> max time or date # => years
|
71
|
-
def calculate_time(seconds, unit)
|
72
|
-
(seconds.to_f / TIME_IN_SECONDS[unit].to_f).round.to_i
|
10
|
+
def format(tokens, number, options = {})
|
11
|
+
tokens.map(&:value).join.gsub(/\{[0-9]\}/, number.abs.to_s)
|
73
12
|
end
|
74
13
|
|
75
14
|
end
|
@@ -0,0 +1,39 @@
|
|
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 Formatters
|
8
|
+
class Formatter
|
9
|
+
|
10
|
+
attr_reader :data_reader
|
11
|
+
|
12
|
+
def initialize(data_reader)
|
13
|
+
@data_reader = data_reader
|
14
|
+
end
|
15
|
+
|
16
|
+
def format(tokens, obj, options = {})
|
17
|
+
tokens.each_with_index.inject("") do |ret, (token, index)|
|
18
|
+
method_sym = :"format_#{token.type}"
|
19
|
+
ret << send(method_sym, token, index, obj, options)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
protected
|
24
|
+
|
25
|
+
def format_plaintext(token, index, obj, options)
|
26
|
+
if match = token.value.match(/([\s]*)'(.*)'([\s]*)/)
|
27
|
+
match.captures.join
|
28
|
+
else
|
29
|
+
token.value
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def format_composite(token, index, obj, options)
|
34
|
+
eval(format(token.tokens, obj)).to_s
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -5,33 +5,39 @@
|
|
5
5
|
|
6
6
|
module TwitterCldr
|
7
7
|
module Formatters
|
8
|
-
class ListFormatter <
|
8
|
+
class ListFormatter < Formatter
|
9
9
|
|
10
10
|
attr_accessor :locale
|
11
11
|
|
12
|
-
def initialize(
|
13
|
-
@locale = TwitterCldr.convert_locale(
|
12
|
+
def initialize(locale = TwitterCldr.locale)
|
13
|
+
@locale = TwitterCldr.convert_locale(locale)
|
14
14
|
end
|
15
15
|
|
16
|
-
def format(list)
|
17
|
-
if
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
def format(list, type = :default)
|
17
|
+
if res = resource_for_type(type)
|
18
|
+
if res.include?(list.size)
|
19
|
+
compose(res[list.size], list)
|
20
|
+
else
|
21
|
+
compose_list(list, res)
|
22
|
+
end
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
26
|
+
def types
|
27
|
+
resource.keys
|
28
|
+
end
|
29
|
+
|
24
30
|
protected
|
25
31
|
|
26
|
-
def compose_list(list)
|
27
|
-
result = compose(
|
32
|
+
def compose_list(list, res)
|
33
|
+
result = compose(res[:end] || res[:middle] || "", [list[-2], list[-1]])
|
28
34
|
|
29
35
|
# Ruby ranges don't support subtraction for some reason (eg. -3..-5).
|
30
36
|
# Instead, we use a positive counter and negate it on array access.
|
31
37
|
(3..list.size).each do |i|
|
32
38
|
format_sym = i == list.size ? :start : :middle
|
33
|
-
format_sym = :middle unless
|
34
|
-
result = compose(
|
39
|
+
format_sym = :middle unless res.include?(format_sym)
|
40
|
+
result = compose(res[format_sym] || "", [list[-i], result])
|
35
41
|
end
|
36
42
|
|
37
43
|
result
|
@@ -55,6 +61,10 @@ module TwitterCldr
|
|
55
61
|
end
|
56
62
|
end
|
57
63
|
|
64
|
+
def resource_for_type(type)
|
65
|
+
resource[type]
|
66
|
+
end
|
67
|
+
|
58
68
|
def resource
|
59
69
|
@resource ||= TwitterCldr.get_locale_resource(@locale, :lists)[@locale][:lists]
|
60
70
|
end
|
@@ -6,36 +6,14 @@
|
|
6
6
|
module TwitterCldr
|
7
7
|
module Formatters
|
8
8
|
class AbbreviatedNumberFormatter < NumberFormatter
|
9
|
-
NUMBER_MAX = 10 ** (TwitterCldr::Tokenizers::NumberTokenizer::ABBREVIATED_MAX_POWER + 1)
|
10
|
-
NUMBER_MIN = 10 ** TwitterCldr::Tokenizers::NumberTokenizer::ABBREVIATED_MIN_POWER
|
11
|
-
|
12
|
-
def default_format_options_for(number)
|
13
|
-
{ :precision => 0 }
|
14
|
-
end
|
15
|
-
|
16
|
-
def get_tokens(obj, options = {})
|
17
|
-
type = (obj < NUMBER_MAX) && (obj >= NUMBER_MIN) ? get_type : :decimal
|
18
|
-
format = type == get_type ? get_key(obj) : nil
|
19
|
-
opts = options.merge(
|
20
|
-
:sign => obj.abs == obj ? :positive : :negative,
|
21
|
-
:type => type,
|
22
|
-
:format => format
|
23
|
-
)
|
24
|
-
@tokenizer.tokens(opts)
|
25
|
-
end
|
26
9
|
|
27
10
|
protected
|
28
11
|
|
29
|
-
def get_type
|
30
|
-
:decimal
|
31
|
-
end
|
32
|
-
|
33
|
-
def get_key(number)
|
34
|
-
"1#{"0" * (number.to_i.to_s.size - 1)}".to_i
|
35
|
-
end
|
36
|
-
|
37
12
|
def transform_number(number)
|
38
|
-
|
13
|
+
within = number < TwitterCldr::DataReaders::NumberDataReader::NUMBER_MAX &&
|
14
|
+
number >= TwitterCldr::DataReaders::NumberDataReader::NUMBER_MIN
|
15
|
+
|
16
|
+
if within
|
39
17
|
power = (((number.to_s.length - 1) / 3) * 3).floor
|
40
18
|
factor = (10 ** power).to_f
|
41
19
|
number / factor
|
@@ -43,6 +21,7 @@ module TwitterCldr
|
|
43
21
|
number
|
44
22
|
end
|
45
23
|
end
|
24
|
+
|
46
25
|
end
|
47
26
|
end
|
48
27
|
end
|
@@ -6,10 +6,8 @@
|
|
6
6
|
module TwitterCldr
|
7
7
|
module Formatters
|
8
8
|
class CurrencyFormatter < NumberFormatter
|
9
|
-
DEFAULT_CURRENCY_SYMBOL = "$"
|
10
|
-
DEFAULT_PRECISION = 2
|
11
9
|
|
12
|
-
def format(number, options = {})
|
10
|
+
def format(tokens, number, options = {})
|
13
11
|
options[:currency] ||= "USD"
|
14
12
|
currency = TwitterCldr::Shared::Currencies.for_code(options[:currency])
|
15
13
|
currency ||= {
|
@@ -27,7 +25,7 @@ module TwitterCldr
|
|
27
25
|
|
28
26
|
symbol = options[:use_cldr_symbol] ? currency[:cldr_symbol] : currency[:symbol]
|
29
27
|
symbol ||= currency[:currency].to_s
|
30
|
-
super
|
28
|
+
super.gsub('¤', symbol)
|
31
29
|
end
|
32
30
|
|
33
31
|
private
|
@@ -37,13 +35,6 @@ module TwitterCldr
|
|
37
35
|
@resource[code.to_sym] || @resource[:DEFAULT]
|
38
36
|
end
|
39
37
|
|
40
|
-
def get_tokens(obj, options = {})
|
41
|
-
opts = options.dup.merge(
|
42
|
-
:sign => obj.abs == obj ? :positive : :negative,
|
43
|
-
:type => :currency
|
44
|
-
)
|
45
|
-
@tokenizer.tokens(opts)
|
46
|
-
end
|
47
38
|
end
|
48
39
|
end
|
49
40
|
end
|
@@ -6,11 +6,13 @@
|
|
6
6
|
module TwitterCldr
|
7
7
|
module Formatters
|
8
8
|
class DecimalFormatter < NumberFormatter
|
9
|
-
|
10
|
-
|
9
|
+
|
10
|
+
def format(tokens, number, options = {})
|
11
|
+
super
|
11
12
|
rescue TypeError, ArgumentError
|
12
13
|
number
|
13
14
|
end
|
15
|
+
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
@@ -5,35 +5,45 @@
|
|
5
5
|
|
6
6
|
module TwitterCldr
|
7
7
|
module Formatters
|
8
|
-
class NumberFormatter <
|
9
|
-
attr_reader :symbols
|
8
|
+
class NumberFormatter < Formatter
|
10
9
|
|
11
|
-
DEFAULT_SYMBOLS = {
|
10
|
+
DEFAULT_SYMBOLS = {
|
11
|
+
:group => ',',
|
12
|
+
:decimal => '.',
|
13
|
+
:plus_sign => '+',
|
14
|
+
:minus_sign => '-'
|
15
|
+
}
|
12
16
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
@
|
17
|
-
:locale => locale
|
18
|
-
)
|
19
|
-
@symbols = DEFAULT_SYMBOLS.merge(tokenizer.symbols)
|
17
|
+
attr_reader :data_reader
|
18
|
+
|
19
|
+
def initialize(data_reader)
|
20
|
+
@data_reader = data_reader
|
20
21
|
end
|
21
22
|
|
22
|
-
def format(number,
|
23
|
-
|
24
|
-
|
23
|
+
def format(tokens, number, options = {})
|
24
|
+
options[:precision] ||= precision_from(number)
|
25
|
+
options[:type] ||= :decimal
|
26
|
+
|
27
|
+
prefix, suffix, integer_format, fraction_format = *partition_tokens(tokens)
|
25
28
|
number = transform_number(number)
|
26
29
|
|
27
|
-
int, fraction = parse_number(number,
|
28
|
-
result = integer_format.apply(int,
|
29
|
-
result << fraction_format.apply(fraction,
|
30
|
-
|
30
|
+
int, fraction = parse_number(number, options)
|
31
|
+
result = integer_format.apply(int, options)
|
32
|
+
result << fraction_format.apply(fraction, options) if fraction
|
33
|
+
|
34
|
+
numbering_system(options[:type]).transliterate(
|
35
|
+
"#{prefix.to_s}#{result}#{suffix.to_s}"
|
36
|
+
)
|
31
37
|
end
|
32
38
|
|
33
39
|
protected
|
34
40
|
|
35
|
-
|
36
|
-
|
41
|
+
# data readers should encapsulate formatting options, and when they do, this "type"
|
42
|
+
# argument will no longer be necessary (accessible via `data_reader.type` instead)
|
43
|
+
def numbering_system(type)
|
44
|
+
@numbering_system ||= TwitterCldr::Shared::NumberingSystem.for_name(
|
45
|
+
data_reader.number_system_for(type)
|
46
|
+
)
|
37
47
|
end
|
38
48
|
|
39
49
|
def transform_number(number)
|
@@ -41,10 +51,22 @@ module TwitterCldr
|
|
41
51
|
end
|
42
52
|
|
43
53
|
def partition_tokens(tokens)
|
44
|
-
[
|
45
|
-
|
46
|
-
|
47
|
-
|
54
|
+
[
|
55
|
+
token_val_from(tokens[0]),
|
56
|
+
token_val_from(tokens[2]),
|
57
|
+
Numbers::Integer.new(
|
58
|
+
tokens[1],
|
59
|
+
data_reader.symbols
|
60
|
+
),
|
61
|
+
Numbers::Fraction.new(
|
62
|
+
tokens[1],
|
63
|
+
data_reader.symbols
|
64
|
+
)
|
65
|
+
]
|
66
|
+
end
|
67
|
+
|
68
|
+
def token_val_from(token)
|
69
|
+
token ? token.value : ""
|
48
70
|
end
|
49
71
|
|
50
72
|
def parse_number(number, options = {})
|
@@ -71,10 +93,6 @@ module TwitterCldr
|
|
71
93
|
parts.size == 2 ? parts[1].size : 0
|
72
94
|
end
|
73
95
|
|
74
|
-
def get_tokens(obj, options = {})
|
75
|
-
opts = options.dup.merge(:sign => obj.abs == obj ? :positive : :negative)
|
76
|
-
@tokenizer.tokens(opts)
|
77
|
-
end
|
78
96
|
end
|
79
97
|
end
|
80
98
|
end
|