Class: TwitterCldr::Resources::TailoringImporter

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_cldr/resources/tailoring_importer.rb

Overview

This class should be used with JRuby 1.7 in 1.9 mode and ICU4J version 49.1 (available at download.icu-project.org/files/icu4j/49.1/icu4j-49_1.jar).

Defined Under Namespace

Classes: ImportError

Constant Summary collapse

SUPPORTED_RULES =
%w[p s t i pc sc tc ic x]
SIMPLE_RULES =
%w[p s t i]
LEVEL_RULE_REGEXP =
/^(p|s|t|i)(c?)$/
IGNORED_TAGS =
%w[reset text #comment]
LAST_BYTE_MASK =
0xFF
LOCALES_MAP =
{
    :'zh-Hant' => :'zh_Hant',
    :id => :root,
    :it => :root,
    :ms => :root,
    :nl => :root,
    :pt => :root
}
EMPTY_TAILORING_DATA =
{ :collator_options => {}, :tailored_table => '', :suppressed_contractions => '' }

Instance Method Summary collapse

Constructor Details

#initialize(input_path, output_path, icu4j_path) ⇒ TailoringImporter

Arguments:

input_path  - path to a directory containing CLDR data
output_path - output directory for imported YAML files
icu4j_path  - path to ICU4J jar file


45
46
47
48
49
50
# File 'lib/twitter_cldr/resources/tailoring_importer.rb', line 45

def initialize(input_path, output_path, icu4j_path)
  require icu4j_path

  @input_path  = input_path
  @output_path = output_path
end

Instance Method Details

#import(locales) ⇒ Object



52
53
54
55
# File 'lib/twitter_cldr/resources/tailoring_importer.rb', line 52

def import(locales)
  TwitterCldr::Resources.download_cldr_if_necessary(@input_path)
  locales.each { |locale| import_locale(locale) }
end