ruby-cldr 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +8 -2
  3. data/Gemfile.lock +55 -5
  4. data/VERSION +1 -1
  5. data/lib/cldr/download.rb +15 -11
  6. data/lib/cldr/export.rb +64 -16
  7. data/lib/cldr/export/data.rb +18 -10
  8. data/lib/cldr/export/data/calendars/gregorian.rb +45 -22
  9. data/lib/cldr/export/data/currencies.rb +6 -1
  10. data/lib/cldr/export/data/currency_digits_and_rounding.rb +22 -0
  11. data/lib/cldr/export/data/layout.rb +22 -0
  12. data/lib/cldr/export/data/lists.rb +28 -0
  13. data/lib/cldr/export/data/metazones.rb +45 -0
  14. data/lib/cldr/export/data/numbering_systems.rb +41 -0
  15. data/lib/cldr/export/data/numbers.rb +9 -0
  16. data/lib/cldr/export/data/plurals.rb +8 -7
  17. data/lib/cldr/export/data/plurals/rules.rb +114 -31
  18. data/lib/cldr/export/data/rbnf.rb +64 -0
  19. data/lib/cldr/export/data/rbnf_root.rb +19 -0
  20. data/lib/cldr/export/data/timezones.rb +29 -6
  21. data/lib/cldr/export/data/units.rb +23 -6
  22. data/lib/cldr/export/data/windows_zones.rb +23 -0
  23. data/lib/cldr/export/yaml.rb +2 -1
  24. data/lib/cldr/format/datetime/base.rb +1 -1
  25. data/lib/cldr/format/time.rb +1 -1
  26. data/lib/cldr/thor.rb +1 -1
  27. data/lib/core_ext/string/camelize.rb +1 -1
  28. data/test/export/data/calendars_test.rb +23 -18
  29. data/test/export/data/currencies_test.rb +24 -24
  30. data/test/export/data/languages_test.rb +52 -48
  31. data/test/export/data/metazones_test.rb +17 -0
  32. data/test/export/data/numbers_test.rb +34 -3
  33. data/test/export/data/plurals_test.rb +133 -32
  34. data/test/export/data/territories_test.rb +22 -22
  35. data/test/export/data/timezones_test.rb +49 -26
  36. data/test/export/data/units_test.rb +16 -17
  37. data/test/export/data/windows_zones_test.rb +12 -0
  38. data/test/export_test.rb +4 -1
  39. data/test/format/date_test.rb +2 -2
  40. data/test/test_autotest.rb +1 -1
  41. metadata +94 -32
@@ -0,0 +1,19 @@
1
+ module Cldr
2
+ module Export
3
+ module Data
4
+ class RbnfRoot < Rbnf
5
+
6
+ def initialize
7
+ super(nil)
8
+ end
9
+
10
+ private
11
+
12
+ def path
13
+ @path ||= "#{Cldr::Export::Data.dir}/rbnf/root.xml"
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+ end
@@ -6,21 +6,44 @@ module Cldr
6
6
  class Timezones < Base
7
7
  def initialize(locale)
8
8
  super
9
- update(:timezones => timezones)
9
+ update(:timezones => timezones, :metazones => metazones)
10
10
  end
11
11
 
12
12
  def timezones
13
13
  @timezones ||= select('dates/timeZoneNames/zone').inject({}) do |result, zone|
14
- type = zone.attribute('type').value.to_sym
15
- city = select(zone, 'exemplarCity').first
14
+ type = zone.attr('type').to_sym
16
15
  result[type] = {}
17
- # see en.xml, Europe/London, does not have an exemplarCity element
18
- # instead it has long and short daylight names which otherwise only
19
- # have metazones. (??)
16
+ long = nodes_to_hash(zone.xpath('long/*'))
17
+ result[type][:long] = long unless long.empty?
18
+ short = nodes_to_hash(zone.xpath('short/*'))
19
+ result[type][:short] = short unless short.empty?
20
+ city = select(zone, 'exemplarCity').first
20
21
  result[type][:city] = city.content if city
21
22
  result
22
23
  end
23
24
  end
25
+
26
+ def metazones
27
+ @metazones ||= select('dates/timeZoneNames/metazone').inject({}) do |result, zone|
28
+ type = zone.attr('type').to_sym
29
+ result[type] = {}
30
+ long = nodes_to_hash(zone.xpath('long/*'))
31
+ result[type][:long] = long unless long.empty?
32
+ short = nodes_to_hash(zone.xpath('short/*'))
33
+ result[type][:short] = short unless short.empty?
34
+ result
35
+ end
36
+ end
37
+
38
+ protected
39
+
40
+ def nodes_to_hash(nodes)
41
+ nodes.inject({}) do |result, node|
42
+ result[node.name.to_sym] = node.content
43
+ result
44
+ end
45
+ end
46
+
24
47
  end
25
48
  end
26
49
  end
@@ -4,11 +4,23 @@ module Cldr
4
4
  class Units < Base
5
5
  def initialize(locale)
6
6
  super
7
- update(:units => units)
7
+ update(
8
+ :units => {
9
+ :unitLength => unitLength,
10
+ :durationUnit => durationUnit,
11
+ }
12
+ )
8
13
  end
9
14
 
10
- def units
11
- select('units/unit').inject({}) do |result, node|
15
+ def unitLength
16
+ select('units/unitLength').inject({}) do |result, node|
17
+ result[node.attribute('type').value.to_sym] = units(node)
18
+ result
19
+ end
20
+ end
21
+
22
+ def units(node)
23
+ node.xpath('unit').inject({}) do |result, node|
12
24
  result[node.attribute('type').value.to_sym] = unit(node)
13
25
  result
14
26
  end
@@ -16,10 +28,15 @@ module Cldr
16
28
 
17
29
  def unit(node)
18
30
  node.xpath('unitPattern').inject({}) do |result, node|
19
- alt = node.attribute('alt') ? node.attribute('alt').value.to_sym : :default
20
31
  count = node.attribute('count') ? node.attribute('count').value.to_sym : :one
21
- result[alt] ||= {}
22
- result[alt][count] = node.content unless draft?(node)
32
+ result[count] = node.content unless draft?(node)
33
+ result
34
+ end
35
+ end
36
+
37
+ def durationUnit
38
+ select('units/durationUnit').inject({}) do |result, node|
39
+ result[node.attribute('type').value.to_sym] = node.xpath('durationUnitPattern').first.content
23
40
  result
24
41
  end
25
42
  end
@@ -0,0 +1,23 @@
1
+ require 'nokogiri'
2
+ require 'time'
3
+
4
+ module Cldr
5
+ module Export
6
+ module Data
7
+ class WindowsZones < Hash
8
+ def initialize
9
+ path = "#{Cldr::Export::Data.dir}/supplemental/windowsZones.xml"
10
+ doc = File.open(path) { |file| Nokogiri::XML(file) }
11
+ doc.xpath('//windowsZones/mapTimezones/mapZone').inject(self) do |result, node|
12
+ zone = node.attr('other').to_s
13
+ territory = node.attr('territory')
14
+ timezones = node.attr('type').split(' ')
15
+ result[zone] ||= {}
16
+ result[zone][territory] = timezones
17
+ result
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -10,7 +10,8 @@ module Cldr
10
10
  def export(locale, component, options = {})
11
11
  data = Export.data(component, locale, options)
12
12
  unless data.empty?
13
- data = { locale.to_s.gsub('_', '-') => data }.deep_stringify_keys
13
+ data = data.deep_stringify_keys if data.respond_to?(:deep_stringify_keys)
14
+ data = { locale.to_s.gsub('_', '-') => data } if locale != ""
14
15
  path = Export.path(locale, component, 'yml')
15
16
  Export.write(path, yaml(data))
16
17
  yield(component, locale, path) if block_given?
@@ -23,7 +23,7 @@ module Cldr
23
23
  def compile_format(format)
24
24
  "'" + format.gsub(self.class.const_get(:PATTERN)) do |token|
25
25
  method = self.class.const_get(:METHODS)[token[0, 1]]
26
- "' + #{method}(date, #{token.inspect}, #{token.length}) + '"
26
+ "' + #{method}(date, #{token.inspect}, #{token.length}).to_s + '"
27
27
  end + "'"
28
28
  end
29
29
  end
@@ -18,7 +18,7 @@ module Cldr
18
18
  }
19
19
 
20
20
  def period(time, pattern, length)
21
- calendar[:periods][time.strftime('%p').downcase.to_sym]
21
+ calendar[:periods][:format][:wide][time.strftime('%p').downcase.to_sym]
22
22
  end
23
23
 
24
24
  def hour(time, pattern, length)
data/lib/cldr/thor.rb CHANGED
@@ -5,7 +5,7 @@ module Cldr
5
5
  class Thor < ::Thor
6
6
  namespace 'cldr'
7
7
 
8
- desc "download [--source=http://unicode.org/Public/cldr/2.0.1/core.zip] [--target=./vendor]",
8
+ desc "download [--source=http://unicode.org/Public/cldr/24/core.zip] [--target=./vendor]",
9
9
  "Download and extract CLDR data from source to target dir"
10
10
  method_options %w(source -s) => :string,
11
11
  %w(target -t) => :string
@@ -1,5 +1,5 @@
1
1
  class String
2
2
  def camelize
3
- self.gsub(/(^.{1}|[^a-z0-9])/) { $1.capitalize }
3
+ self.gsub(/(^.|_[a-zA-Z])/) { |m| m.sub("_",'').capitalize }
4
4
  end
5
5
  end unless String.new.respond_to?(:camelize)
@@ -13,13 +13,13 @@ class TestCldrDataCalendars < Test::Unit::TestCase
13
13
  months = {
14
14
  :format => {
15
15
  :wide => { 1 => 'Januar', 2 => 'Februar', 3 => 'März', 4 => 'April', 5 => 'Mai', 6 => 'Juni', 7 => 'Juli', 8 => 'August', 9 => 'September', 10 => 'Oktober', 11 => 'November', 12 => 'Dezember' },
16
- :abbreviated => { 1 => 'Jan', 2 => 'Feb', 3 => 'Mär', 4 => 'Apr', 5 => 'Mai', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug', 9 => 'Sep', 10 => 'Okt', 11 => 'Nov', 12 => 'Dez' },
17
- :narrow => :"calendars.gregorian.months.stand-alone.narrow"
16
+ :abbreviated => { 1 => 'Jan.', 2 => 'Feb.', 3 => 'März', 4 => 'Apr.', 5 => 'Mai', 6 => 'Juni', 7 => 'Juli', 8 => 'Aug.', 9 => 'Sep.', 10 => 'Okt.', 11 => 'Nov.', 12 => 'Dez.' },
17
+ :narrow => { 1 => 'J', 2 => 'F', 3 => 'M', 4 => 'A', 5 => 'M', 6 => 'J', 7 => 'J', 8 => 'A', 9 => 'S', 10 => 'O', 11 => 'N', 12 => 'D' },
18
18
  },
19
19
  :'stand-alone' => {
20
- :abbreviated => { 3 => 'Mär', 7 => 'Jul', 8 => 'Aug', 9 => 'Sep', 10 => 'Okt', 11 => 'Nov', 12 => 'Dez' },
20
+ :abbreviated => { 1 => 'Jan', 2 => 'Feb', 3 => 'Mär', 4 => 'Apr', 5 => 'Mai', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug', 9 => 'Sep', 10 => 'Okt', 11 => 'Nov', 12 => 'Dez'},
21
21
  :narrow => { 1 => 'J', 2 => 'F', 3 => 'M', 4 => 'A', 5 => 'M', 6 => 'J', 7 => 'J', 8 => 'A', 9 => 'S', 10 => 'O', 11 => 'N', 12 => 'D' },
22
- :wide => :"calendars.gregorian.months.format.wide"
22
+ :wide => { 1 => 'Januar', 2 => 'Februar', 3 => 'März', 4 => 'April', 5 => 'Mai', 6 => 'Juni', 7 => 'Juli', 8 => 'August', 9 => 'September', 10 => 'Oktober', 11 => 'November', 12 => 'Dezember' },
23
23
  }
24
24
  }
25
25
  assert_equal months, gregorian[:months]
@@ -30,12 +30,14 @@ class TestCldrDataCalendars < Test::Unit::TestCase
30
30
  :format => {
31
31
  :wide => { :sun => 'Sonntag', :mon => 'Montag', :tue => 'Dienstag', :wed => 'Mittwoch', :thu => 'Donnerstag', :fri => 'Freitag', :sat => 'Samstag' },
32
32
  :abbreviated => { :sun => 'So.', :mon => 'Mo.', :tue => 'Di.', :wed => 'Mi.', :thu => 'Do.', :fri => 'Fr.', :sat => 'Sa.' },
33
- :narrow => :"calendars.gregorian.days.stand-alone.narrow"
33
+ :narrow => { :sun => 'S', :mon => 'M', :tue => 'D', :wed => 'M', :thu => 'D', :fri => 'F', :sat => 'S' },
34
+ :short => { :sun => 'So.', :mon => 'Mo.', :tue => 'Di.', :wed => 'Mi.', :thu => 'Do.', :fri => 'Fr.', :sat => 'Sa.' }
34
35
  },
35
36
  :'stand-alone' => {
36
- :abbreviated => :"calendars.gregorian.days.format.abbreviated",
37
+ :abbreviated => { :sun => 'So', :mon => 'Mo', :tue => 'Di', :wed => 'Mi', :thu => 'Do', :fri => 'Fr', :sat => 'Sa' },
37
38
  :narrow => { :sun => 'S', :mon => 'M', :tue => 'D', :wed => 'M', :thu => 'D', :fri => 'F', :sat => 'S' },
38
- :wide => :"calendars.gregorian.days.format.wide"
39
+ :short => { :sun => 'So.', :mon => 'Mo.', :tue => 'Di.', :wed => 'Mi.', :thu => 'Do.', :fri => 'Fr.', :sat => 'Sa.' },
40
+ :wide => { :sun => 'Sonntag', :mon => 'Montag', :tue => 'Dienstag', :wed => 'Mittwoch', :thu => 'Donnerstag', :fri => 'Freitag', :sat => 'Samstag' },
39
41
  }
40
42
  }
41
43
  assert_equal days, gregorian[:days]
@@ -45,13 +47,13 @@ class TestCldrDataCalendars < Test::Unit::TestCase
45
47
  quarters = {
46
48
  :format => {
47
49
  :wide => { 1 => "1. Quartal", 2 => "2. Quartal", 3 => "3. Quartal", 4 => "4. Quartal" },
48
- :narrow => :"calendars.gregorian.quarters.stand-alone.narrow",
50
+ :narrow => { 1 => "1", 2 => "2", 3 => "3", 4 => "4" },
49
51
  :abbreviated => { 1 => "Q1", 2 => "Q2", 3 => "Q3", 4 => "Q4" }
50
52
  },
51
53
  :"stand-alone" => {
52
- :abbreviated => :"calendars.gregorian.quarters.format.abbreviated",
54
+ :abbreviated => { 1 => "Q1", 2 => "Q2", 3 => "Q3", 4 => "Q4" },
53
55
  :narrow => { 1 => "1", 2 => "2", 3 => "3", 4 => "4" },
54
- :wide =>:"calendars.gregorian.quarters.format.wide"
56
+ :wide => { 1 => "1. Quartal", 2 => "2. Quartal", 3 => "3. Quartal", 4 => "4. Quartal" }
55
57
  }
56
58
  }
57
59
  assert_equal quarters, gregorian[:quarters]
@@ -59,10 +61,16 @@ class TestCldrDataCalendars < Test::Unit::TestCase
59
61
 
60
62
  test 'calendars periods :de' do
61
63
  periods = {
62
- :am => 'vorm.',
63
- :pm => 'nachm.',
64
+ :afternoon => "nachmittags",
65
+ :am => "vorm.",
66
+ :earlyMorning => "morgens",
67
+ :evening => "abends",
68
+ :morning => "vormittags",
69
+ :night => "nachts",
70
+ :noon => "Mittag",
71
+ :pm => "nachm."
64
72
  }
65
- assert_equal periods, gregorian[:periods]
73
+ assert_equal periods, gregorian[:periods][:format][:wide]
66
74
  end
67
75
 
68
76
  # root.xml
@@ -88,10 +96,9 @@ class TestCldrDataCalendars < Test::Unit::TestCase
88
96
 
89
97
  test 'calendars date formats :de' do
90
98
  formats = {
91
- :default => :"calendars.gregorian.formats.date.medium",
92
99
  :full => { :pattern => "EEEE, d. MMMM y" },
93
100
  :long => { :pattern => "d. MMMM y" },
94
- :medium => { :pattern => "dd.MM.yyyy" },
101
+ :medium => { :pattern => "dd.MM.y" },
95
102
  :short => { :pattern => "dd.MM.yy" }
96
103
  }
97
104
  assert_equal formats, gregorian[:formats][:date]
@@ -99,7 +106,6 @@ class TestCldrDataCalendars < Test::Unit::TestCase
99
106
 
100
107
  test 'calendars time formats :de' do
101
108
  formats = {
102
- :default => :"calendars.gregorian.formats.time.medium",
103
109
  :full => { :pattern => "HH:mm:ss zzzz" },
104
110
  :long => { :pattern => "HH:mm:ss z" },
105
111
  :medium => { :pattern => "HH:mm:ss" },
@@ -110,7 +116,6 @@ class TestCldrDataCalendars < Test::Unit::TestCase
110
116
 
111
117
  test 'calendars datetime formats :de' do
112
118
  formats = {
113
- :default => :"calendars.gregorian.formats.datetime.medium",
114
119
  :full => { :pattern => "{{date}} {{time}}"},
115
120
  :long => { :pattern => "{{date}} {{time}}"},
116
121
  :medium => { :pattern => "{{date}} {{time}}"},
@@ -131,7 +136,7 @@ class TestCldrDataCalendars < Test::Unit::TestCase
131
136
  :weekday => "Wochentag",
132
137
  :dayperiod => "Tageshälfte",
133
138
  :era => "Epoche",
134
- :zone => "Zone"
139
+ :zone => "Zeitzone"
135
140
  }
136
141
  assert_equal fields, gregorian[:fields]
137
142
  end
@@ -7,32 +7,32 @@ class TestCldrCurrencies < Test::Unit::TestCase
7
7
  codes = [:ADP, :AED, :AFA, :AFN, :ALL, :AMD, :ANG, :AOA, :AOK, :AON, :AOR,
8
8
  :ARA, :ARP, :ARS, :ATS, :AUD, :AWG, :AZM, :AZN, :BAD, :BAM, :BBD,
9
9
  :BDT, :BEC, :BEF, :BEL, :BGL, :BGN, :BHD, :BIF, :BMD, :BND, :BOB,
10
- :BOP, :BOV, :BRB, :BRC, :BRE, :BRL, :BRN, :BRR, :BSD, :BTN, :BUK,
11
- :BWP, :BYB, :BYR, :BZD, :CAD, :CDF, :CHE, :CHF, :CHW, :CLF, :CLP,
12
- :CNY, :COP, :COU, :CRC, :CSD, :CSK, :CUP, :CVE, :CYP, :CZK, :DDM,
13
- :DEM, :DJF, :DKK, :DOP, :DZD, :ECS, :ECV, :EEK, :EGP, :ERN, :ESA,
14
- :ESB, :ESP, :ETB, :EUR, :FIM, :FJD, :FKP, :FRF, :GBP, :GEK, :GEL,
15
- :GHC, :GHS, :GIP, :GMD, :GNF, :GNS, :GQE, :GRD, :GTQ, :GWE, :GWP,
16
- :GYD, :HKD, :HNL, :HRD, :HRK, :HTG, :HUF, :IDR, :IEP, :ILP, :ILS,
17
- :INR, :IQD, :IRR, :ISK, :ITL, :JMD, :JOD, :JPY, :KES, :KGS, :KHR,
18
- :KMF, :KPW, :KRW, :KWD, :KYD, :KZT, :LAK, :LBP, :LKR, :LRD, :LSL,
19
- :LTL, :LTT, :LUC, :LUF, :LUL, :LVL, :LVR, :LYD, :MAD, :MAF, :MDL,
20
- :MGA, :MGF, :MKD, :MLF, :MMK, :MNT, :MOP, :MRO, :MTL, :MTP, :MUR,
21
- :MVR, :MWK, :MXN, :MXP, :MXV, :MYR, :MZE, :MZM, :MZN, :NAD, :NGN,
22
- :NIC, :NIO, :NLG, :NOK, :NPR, :NZD, :OMR, :PAB, :PEI, :PEN, :PES,
23
- :PGK, :PHP, :PKR, :PLN, :PLZ, :PTE, :PYG, :QAR, :RHD, :ROL, :RON,
24
- :RSD, :RUB, :RUR, :RWF, :SAR, :SBD, :SCR, :SDD, :SDG, :SDP, :SEK,
25
- :SGD, :SHP, :SIT, :SKK, :SLL, :SOS, :SRD, :SRG, :STD, :SUR, :SVC,
26
- :SYP, :SZL, :THB, :TJR, :TJS, :TMM, :TND, :TOP, :TPE, :TRL, :TRY,
27
- :TTD, :TWD, :TZS, :UAH, :UAK, :UGS, :UGX, :USD, :USN, :USS, :UYI,
28
- :UYP, :UYU, :UZS, :VEB, :VEF, :VND, :VUV, :WST, :XAF, :XAG, :XAU,
29
- :XBA, :XBB, :XBC, :XBD, :XCD, :XDR, :XEU, :XFO, :XFU, :XOF, :XPD,
30
- :XPF, :XPT, :XRE, :XTS, :XXX, :YDD, :YER, :YUD, :YUM, :YUN, :ZAL,
31
- :ZAR, :ZMK, :ZRN, :ZRZ, :ZWD]
32
-
10
+ :BOP, :BOV, :BRB, :BRC, :BRE, :BRL, :BRN, :BRR, :BRZ, :BSD, :BTN,
11
+ :BUK, :BWP, :BYB, :BYR, :BZD, :CAD, :CDF, :CHE, :CHF, :CHW, :CLF,
12
+ :CLP, :CNY, :COP, :CRC, :CSD, :CSK, :CUC, :CUP, :CVE, :CYP, :CZK,
13
+ :DDM, :DEM, :DJF, :DKK, :DOP, :DZD, :ECS, :ECV, :EEK, :EGP, :ERN,
14
+ :ESA, :ESB, :ESP, :ETB, :EUR, :FIM, :FJD, :FKP, :FRF, :GBP, :GEK,
15
+ :GEL, :GHC, :GHS, :GIP, :GMD, :GNF, :GNS, :GQE, :GRD, :GTQ, :GWE,
16
+ :GWP, :GYD, :HKD, :HNL, :HRD, :HRK, :HTG, :HUF, :IDR, :IEP, :ILP,
17
+ :ILS, :INR, :IQD, :IRR, :ISK, :ITL, :JMD, :JOD, :JPY, :KES, :KGS,
18
+ :KHR, :KMF, :KPW, :KRW, :KWD, :KYD, :KZT, :LAK, :LBP, :LKR, :LRD,
19
+ :LSL, :LTL, :LTT, :LUC, :LUF, :LUL, :LVL, :LVR, :LYD, :MAD, :MAF,
20
+ :MDL, :MGA, :MGF, :MKD, :MLF, :MMK, :MNT, :MOP, :MRO, :MTL, :MTP,
21
+ :MUR, :MVR, :MWK, :MXN, :MXP, :MXV, :MYR, :MZE, :MZM, :MZN, :NAD,
22
+ :NGN, :NIC, :NIO, :NLG, :NOK, :NPR, :NZD, :OMR, :PAB, :PEI, :PEN,
23
+ :PES, :PGK, :PHP, :PKR, :PLN, :PLZ, :PTE, :PYG, :QAR, :RHD, :ROL,
24
+ :RON, :RSD, :RUB, :RUR, :RWF, :SAR, :SBD, :SCR, :SDD, :SDG, :SDP,
25
+ :SEK, :SGD, :SHP, :SIT, :SKK, :SLL, :SOS, :SRD, :SRG, :SSP, :STD,
26
+ :SUR, :SVC, :SYP, :SZL, :THB, :TJR, :TJS, :TMM, :TMT, :TND, :TOP,
27
+ :TPE, :TRL, :TRY, :TTD, :TWD, :TZS, :UAH, :UAK, :UGS, :UGX, :USD,
28
+ :USN, :USS, :UYP, :UYU, :UZS, :VEB, :VEF, :VND, :VUV, :WST, :XAF,
29
+ :XAG, :XAU, :XBA, :XBB, :XBC, :XBD, :XCD, :XDR, :XEU, :XFO, :XFU,
30
+ :XOF, :XPD, :XPF, :XPT, :XRE, :XTS, :XXX, :YDD, :YER, :YUD, :YUM,
31
+ :YUN, :ZAL, :ZAR, :ZMK, :ZMW, :ZRN, :ZRZ, :ZWD, :ZWL, :ZWR]
32
+
33
33
  currencies = Cldr::Export::Data::Currencies.new('de')[:currencies]
34
34
  assert (currencies.keys - codes).empty? && (codes - currencies.keys).empty?
35
- assert_equal({ :one => 'Euro', :other => 'Euro' }, currencies[:EUR])
35
+ assert_equal({ :one => 'Euro', :other => 'Euro', :symbol => '€' }, currencies[:EUR])
36
36
  end
37
37
 
38
38
  # Cldr::Export::Data.locales.each do |locale|
@@ -4,58 +4,62 @@ require File.expand_path(File.join(File.dirname(__FILE__) + '/../../test_helper'
4
4
 
5
5
  class TestCldrDataLanguages < Test::Unit::TestCase
6
6
  test 'languages :de' do
7
- codes = [:aa, :ab, :ace, :ach, :ada, :ady, :ae, :af, :afa, :afh, :ain,
8
- :ak, :akk, :ale, :alg, :alt, :am, :an, :ang, :anp, :apa, :ar,
9
- :arc, :arn, :arp, :art, :arw, :as, :ast, :ath, :aus, :av, :awa,
10
- :ay, :az, :ba, :bad, :bai, :bal, :ban, :bas, :bat, :be, :bej,
11
- :bem, :ber, :bg, :bh, :bho, :bi, :bik, :bin, :bla, :bm, :bn, :bnt,
12
- :bo, :br, :bra, :bs, :btk, :bua, :bug, :byn, :ca, :cad, :cai,
13
- :car, :cau, :cch, :ce, :ceb, :cel, :ch, :chb, :chg, :chk, :chm,
14
- :chn, :cho, :chp, :chr, :chy, :cmc, :co, :cop, :cpe, :cpf, :cpp,
15
- :cr, :crh, :crp, :cs, :csb, :cu, :cus, :cv, :cy, :da, :dak, :dar,
16
- :day, :de, :"de-AT", :"de-CH", :del, :den, :dgr, :din, :doi, :dra,
17
- :dsb, :dua, :dum, :dv, :dyu, :dz, :ee, :efi, :egy, :eka, :el,
18
- :elx, :en, :"en-AU", :"en-CA", :"en-GB", :"en-US", :enm, :eo, :es,
19
- :"es-419", :"es-ES", :et, :eu, :ewo, :fa, :fan, :fat, :ff, :fi,
20
- :fil, :fiu, :fj, :fo, :fon, :fr, :"fr-CA", :"fr-CH", :frm, :fro,
21
- :frr, :frs, :fur, :fy, :ga, :gaa, :gay, :gba, :gd, :gem, :gez,
22
- :gil, :gl, :gmh, :gn, :goh, :gon, :gor, :got, :grb, :grc, :gsw,
23
- :gu, :gv, :gwi, :ha, :hai, :haw, :he, :hi, :hil, :him, :hit, :hmn,
24
- :ho, :hr, :hsb, :ht, :hu, :hup, :hy, :hz, :ia, :iba, :id, :ie,
25
- :ig, :ii, :ijo, :ik, :ilo, :inc, :ine, :inh, :io, :ira, :iro, :is,
26
- :it, :iu, :ja, :jbo, :jpr, :jrb, :jv, :ka, :kaa, :kab, :kac, :kaj,
27
- :kam, :kar, :kaw, :kbd, :kcg, :kfo, :kg, :kha, :khi, :kho, :ki,
28
- :kj, :kk, :kl, :km, :kmb, :kn, :ko, :kok, :kos, :kpe, :kr, :krc,
29
- :krl, :kro, :kru, :ks, :ku, :kum, :kut, :kv, :kw, :ky, :la, :lad,
30
- :lah, :lam, :lb, :lez, :lg, :li, :ln, :lo, :lol, :loz, :lt, :lu,
31
- :lua, :lui, :lun, :luo, :lus, :lv, :mad, :mag, :mai, :mak, :man,
32
- :map, :mas, :mdf, :mdr, :men, :mg, :mga, :mh, :mi, :mic, :min,
33
- :mis, :mk, :mkh, :ml, :mn, :mnc, :mni, :mno, :mo, :moh, :mos, :mr,
34
- :ms, :mt, :mul, :mun, :mus, :mwl, :mwr, :my, :myn, :myv, :na,
35
- :nah, :nai, :nap, :nb, :nd, :nds, :ne, :new, :ng, :nia, :nic,
36
- :niu, :nl, :"nl-BE", :nn, :no, :nog, :non, :nqo, :nr, :nso, :nub,
37
- :nv, :nwc, :ny, :nym, :nyn, :nyo, :nzi, :oc, :oj, :om, :or, :os,
38
- :osa, :ota, :oto, :pa, :paa, :pag, :pal, :pam, :pap, :pau, :peo,
39
- :phi, :phn, :pi, :pl, :pon, :pra, :pro, :ps, :pt, :"pt-BR",
40
- :"pt-PT", :qu, :raj, :rap, :rar, :rm, :rn, :ro, :roa, :rom, :root,
41
- :ru, :rup, :rw, :sa, :sad, :sah, :sai, :sal, :sam, :sas, :sat,
42
- :sc, :scn, :sco, :sd, :se, :sel, :sem, :sg, :sga, :sgn, :sh, :shn,
43
- :si, :sid, :sio, :sit, :sk, :sl, :sla, :sm, :sma, :smi, :smj,
44
- :smn, :sms, :sn, :snk, :so, :sog, :son, :sq, :sr, :srn, :srr, :ss,
45
- :ssa, :st, :su, :suk, :sus, :sux, :sv, :sw, :syc, :syr, :ta, :tai,
46
- :te, :tem, :ter, :tet, :tg, :th, :ti, :tig, :tiv, :tk, :tkl, :tl,
47
- :tlh, :tli, :tmh, :tn, :to, :tog, :tpi, :tr, :ts, :tsi, :tt, :tum,
48
- :tup, :tut, :tvl, :tw, :ty, :tyv, :udm, :ug, :uga, :uk, :umb,
49
- :und, :ur, :uz, :vai, :ve, :vi, :vo, :vot, :wa, :wak, :wal, :war,
50
- :was, :wen, :wo, :xal, :xh, :yao, :yap, :yi, :yo, :ypk, :za, :zap,
51
- :zbl, :zen, :zh, :"zh-Hans", :"zh-Hant", :znd, :zu, :zun, :zxx, :zza]
52
-
7
+ codes = [:aa, :ab, :ace, :ach, :ada, :ady, :ae, :af, :afa, :afh, :agq,
8
+ :ain, :ak, :akk, :ale, :alg, :alt, :am, :an, :ang, :anp, :apa,
9
+ :ar, :"ar-001", :arc, :arn, :arp, :art, :arw, :as, :asa, :ast,
10
+ :ath, :aus, :av, :awa, :ay, :az, :ba, :bad, :bai, :bal, :ban,
11
+ :bas, :bat, :bax, :bbj, :be, :bej, :bem, :ber, :bez, :bfd, :bg,
12
+ :bh, :bho, :bi, :bik, :bin, :bkm, :bla, :bm, :bn, :bnt, :bo, :br,
13
+ :bra, :brx, :bs, :bss, :btk, :bua, :bug, :bum, :byn, :byv, :ca,
14
+ :cad, :cai, :car, :cau, :cay, :cch, :ce, :ceb, :cel, :cgg, :ch,
15
+ :chb, :chg, :chk, :chm, :chn, :cho, :chp, :chr, :chy, :ckb, :cmc,
16
+ :co, :cop, :cpe, :cpf, :cpp, :cr, :crh, :crp, :cs, :csb, :cu,
17
+ :cus, :cv, :cy, :da, :dak, :dar, :dav, :day, :de, :"de-AT",
18
+ :"de-CH", :del, :den, :dgr, :din, :dje, :doi, :dra, :dsb, :dua,
19
+ :dum, :dv, :dyo, :dyu, :dz, :dzg, :ebu, :ee, :efi, :egy, :eka,
20
+ :el, :elx, :en, :"en-AU", :"en-CA", :"en-GB", :"en-US", :enm, :eo,
21
+ :es, :"es-419", :"es-ES", :"es-MX", :et, :eu, :ewo, :fa, :fan,
22
+ :fat, :ff, :fi, :fil, :fiu, :fj, :fo, :fon, :fr, :"fr-CA", :"fr-CH",
23
+ :frm, :fro, :frr, :frs, :fur, :fy, :ga, :gaa, :gay, :gba, :gd, :gem,
24
+ :gez, :gil, :gl, :gmh, :gn, :goh, :gon, :gor, :got, :grb, :grc,
25
+ :gsw, :gu, :guz, :gv, :gwi, :ha, :hai, :haw, :he, :hi, :hil, :him,
26
+ :hit, :hmn, :ho, :hr, :hsb, :ht, :hu, :hup, :hy, :hz, :ia, :iba,
27
+ :ibb, :id, :ie, :ig, :ii, :ijo, :ik, :ilo, :inc, :ine, :inh, :io,
28
+ :ira, :iro, :is, :it, :iu, :ja, :jbo, :jmc, :jpr, :jrb, :jv, :ka,
29
+ :kaa, :kab, :kac, :kaj, :kam, :kar, :kaw, :kbd, :kbl, :kcg, :kde,
30
+ :kea, :kfo, :kg, :kha, :khi, :kho, :khq, :ki, :kj, :kk, :kkj, :kl,
31
+ :kln, :km, :kmb, :kn, :ko, :kok, :kos, :kpe, :kr, :krc, :krl, :kro,
32
+ :kru, :ks, :ksb, :ksf, :ksh, :ku, :kum, :kut, :kv, :kw, :ky, :la,
33
+ :lad, :lag, :lah, :lam, :lb, :lez, :lg, :li, :ln, :lo, :lol, :loz,
34
+ :lt, :lu, :lua, :lui, :lun, :luo, :lus, :luy, :lv, :mad, :maf, :mag,
35
+ :mai, :mak, :man, :map, :mas, :mde, :mdf, :mdr, :men, :mer, :mfe,
36
+ :mg, :mga, :mgh, :mh, :mi, :mic, :min, :mis, :mk, :mkh, :ml, :mn,
37
+ :mnc, :mni, :mno, :mo, :moh, :mos, :mr, :ms, :mt, :mua, :mul, :mun,
38
+ :mus, :mwl, :mwr, :my, :mye, :myn, :myv, :na, :nah, :nai, :nap, :naq,
39
+ :nb, :nd, :nds, :ne, :new, :ng, :nia, :nic, :niu, :nl, :"nl-BE", :nmg,
40
+ :nn, :nnh, :no, :nog, :non, :nqo, :nr, :nso, :nub, :nus, :nv, :nwc,
41
+ :ny, :nym, :nyn, :nyo, :nzi, :oc, :oj, :om, :or, :os, :osa, :ota,
42
+ :oto, :pa, :paa, :pag, :pal, :pam, :pap, :pau, :peo, :phi, :phn, :pi,
43
+ :pl, :pon, :pra, :pro, :ps, :pt, :"pt-BR", :"pt-PT", :qu, :raj, :rap,
44
+ :rar, :rm, :rn, :ro, :roa, :rof, :rom, :root, :ru, :rup, :rw, :rwk,
45
+ :sa, :sad, :sah, :sai, :sal, :sam, :saq, :sas, :sat, :sba, :sbp, :sc,
46
+ :scn, :sco, :sd, :se, :see, :seh, :sel, :sem, :ses, :sg, :sga, :sgn,
47
+ :sh, :shi, :shn, :shu, :si, :sid, :sio, :sit, :sk, :sl, :sla, :sm,
48
+ :sma, :smi, :smj, :smn, :sms, :sn, :snk, :so, :sog, :son, :sq, :sr,
49
+ :srn, :srr, :ss, :ssa, :ssy, :st, :su, :suk, :sus, :sux, :sv, :sw,
50
+ :swb, :swc, :syc, :syr, :ta, :tai, :te, :tem, :teo, :ter, :tet, :tg,
51
+ :th, :ti, :tig, :tiv, :tk, :tkl, :tl, :tlh, :tli, :tmh, :tn, :to, :tog,
52
+ :tpi, :tr, :trv, :ts, :tsi, :tt, :tum, :tup, :tut, :tvl, :tw, :twq,
53
+ :ty, :tyv, :tzm, :udm, :ug, :uga, :uk, :umb, :und, :ur, :uz, :vai, :ve,
54
+ :vi, :vo, :vot, :vun, :wa, :wae, :wak, :wal, :war, :was, :wen, :wo, :xal,
55
+ :xh, :xog, :yao, :yap, :yav, :ybb, :yi, :yo, :ypk, :yue, :za, :zap, :zbl,
56
+ :zen, :zgh, :zh, :"zh-Hans", :"zh-Hant", :znd, :zu, :zun, :zxx, :zza]
57
+
53
58
  languages = Cldr::Export::Data::Languages.new('de')[:languages]
54
-
55
59
  assert (languages.keys - codes).empty? && (codes - languages.keys).empty?
56
60
  assert_equal('Deutsch', languages[:de])
57
61
  end
58
-
62
+
59
63
  # Cldr::Export::Data.locales.each do |locale|
60
64
  # test "extract languages for #{locale}" do
61
65
  # assert_nothing_raised do