Class: TwitterCldr::Resources::TailoringImporter

Inherits:
IcuBasedImporter 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.

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


48
49
50
51
52
53
# File 'lib/twitter_cldr/resources/tailoring_importer.rb', line 48

def initialize(input_path, output_path, icu4j_path)
  require_icu4j(icu4j_path)

  @input_path  = input_path
  @output_path = output_path
end

Instance Method Details

#import(locales) ⇒ Object



55
56
57
58
# File 'lib/twitter_cldr/resources/tailoring_importer.rb', line 55

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