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
@@ -5,25 +5,24 @@ require File.expand_path(File.join(File.dirname(__FILE__) + '/../../test_helper'
5
5
  class TestCldrDataUnits < Test::Unit::TestCase
6
6
  test 'units' do
7
7
  units = {
8
- :day => { :one => "{0} Tag", :other => "{0} Tage" },
9
- :week => { :one => "{0} Woche", :other => "{0} Wochen" },
10
- :month => { :one => "{0} Monat", :other => "{0} Monate" },
11
- :year => { :one => "{0} Jahr", :other => "{0} Jahre" },
12
- :hour => { :one => "{0} Std.", :other => "{0} Std." },
13
- :minute => { :one => "{0} Min.", :other => "{0} Min." },
14
- :second => { :one => "{0} Sek.", :other => "{0} Sek." }
8
+ :day => { :one => "{0} Tag", :other => "{0} Tage" },
9
+ :week => { :one => "{0} Woche", :other => "{0} Wochen" },
10
+ :month => { :one => "{0} Monat", :other => "{0} Monate" },
11
+ :year => { :one => "{0} Jahr", :other => "{0} Jahre" },
12
+ :hour => { :one => "{0} Stunde", :other => "{0} Stunden" },
13
+ :minute => { :one => "{0} Minute", :other => "{0} Minuten" },
14
+ :second => { :one => "{0} Sekunde", :other => "{0} Sekunden" }
15
15
  }
16
- keys = %w(day week month year hour minute second).sort
17
- data = Cldr::Export::Data::Units.new('de')[:units]
16
+ data = Cldr::Export::Data::Units.new('de')[:units][:unitLength][:long]
18
17
 
19
- assert_equal keys, data.keys.map { |key| key.to_s }.sort
20
- assert_equal units[:day], data[:day]
21
- assert_equal units[:week], data[:week]
22
- assert_equal units[:month], data[:month]
23
- assert_equal units[:year], data[:year]
24
- assert_equal units[:hour], data[:hour]
25
- assert_equal units[:minute], data[:minute]
26
- assert_equal units[:second], data[:second]
18
+ assert_operator data.keys.count, :>=, 46
19
+ assert_equal units[:day], data[:'duration-day']
20
+ assert_equal units[:week], data[:'duration-week']
21
+ assert_equal units[:month], data[:'duration-month']
22
+ assert_equal units[:year], data[:'duration-year']
23
+ assert_equal units[:hour], data[:'duration-hour']
24
+ assert_equal units[:minute], data[:'duration-minute']
25
+ assert_equal units[:second], data[:'duration-second']
27
26
  end
28
27
 
29
28
  # Cldr::Export::Data.locales.each do |locale|
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__) + '/../../test_helper'))
4
+ require 'time'
5
+
6
+ class TestCldrDataMetazones < Test::Unit::TestCase
7
+ test 'windows zone DE' do
8
+ zones = Cldr::Export::Data::WindowsZones.new
9
+ assert_equal( ['Europe/Berlin', 'Europe/Busingen'], zones['W. Europe Standard Time']['DE'])
10
+ end
11
+
12
+ end
data/test/export_test.rb CHANGED
@@ -33,7 +33,10 @@ class TestExtract < Test::Unit::TestCase
33
33
 
34
34
  test "exported data starts with the locale at top level" do
35
35
  Cldr::Export.export(:locales => %w(de), :components => %w(calendars))
36
- data = YAML.load(File.open(Cldr::Export.path('de', 'calendars', 'yml')))
36
+ data = {}
37
+ File.open(Cldr::Export.path('de', 'calendars', 'yml')) do |f|
38
+ data = YAML.load(f)
39
+ end
37
40
  assert data['de']
38
41
  end
39
42
 
@@ -189,8 +189,8 @@ class TestCldrDateFormat < Test::Unit::TestCase
189
189
  end
190
190
 
191
191
  test "pattern MMM" do
192
- assert_equal 'Jan', format(Date.new(2010, 1, 1), 'MMM')
193
- assert_equal 'Okt', format(Date.new(2010, 10, 1), 'MMM')
192
+ assert_equal 'Jan.', format(Date.new(2010, 1, 1), 'MMM')
193
+ assert_equal 'Okt.', format(Date.new(2010, 10, 1), 'MMM')
194
194
  end
195
195
 
196
196
  test "pattern MMMM" do
@@ -26,7 +26,7 @@ if $0 == __FILE__
26
26
  end
27
27
 
28
28
  define_method :"test: mapping for gregorian.rb" do
29
- assert_equal ['test/data/calendars_test.rb'], tests_for("lib/cldr/calendars/gregorian.rb")
29
+ assert_equal ['test/export/data/calendars_test.rb'], tests_for("lib/cldr/calendars/gregorian.rb")
30
30
  end
31
31
 
32
32
  define_method :"test: default mapping for test files" do
metadata CHANGED
@@ -1,71 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-cldr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sven Fuchs
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-08-01 00:00:00.000000000Z
11
+ date: 2014-02-16 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: thor
16
- requirement: &70146354889260 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70146354889260
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: i18n
27
- requirement: &70146354888620 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *70146354888620
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: ya2yaml
38
- requirement: &70146354887760 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - '>='
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :runtime
45
49
  prerelease: false
46
- version_requirements: *70146354887760
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: nokogiri
49
- requirement: &70146354886960 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  type: :runtime
56
63
  prerelease: false
57
- version_requirements: *70146354886960
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubyzip
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
58
83
  - !ruby/object:Gem::Dependency
59
84
  name: jeweler
60
- requirement: &70146354886240 !ruby/object:Gem::Requirement
61
- none: false
85
+ requirement: !ruby/object:Gem::Requirement
62
86
  requirements:
63
- - - ! '>='
87
+ - - '>='
64
88
  - !ruby/object:Gem::Version
65
89
  version: '0'
66
90
  type: :development
67
91
  prerelease: false
68
- version_requirements: *70146354886240
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry-nav
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
69
125
  description: Ruby library for exporting and using data from CLDR, see http://cldr.unicode.org
70
126
  email: svenfuchs@artweb-design.de
71
127
  executables: []
@@ -94,16 +150,24 @@ files:
94
150
  - lib/cldr/export/data/calendars.rb
95
151
  - lib/cldr/export/data/calendars/gregorian.rb
96
152
  - lib/cldr/export/data/currencies.rb
153
+ - lib/cldr/export/data/currency_digits_and_rounding.rb
97
154
  - lib/cldr/export/data/delimiters.rb
98
155
  - lib/cldr/export/data/languages.rb
156
+ - lib/cldr/export/data/layout.rb
157
+ - lib/cldr/export/data/lists.rb
158
+ - lib/cldr/export/data/metazones.rb
159
+ - lib/cldr/export/data/numbering_systems.rb
99
160
  - lib/cldr/export/data/numbers.rb
100
161
  - lib/cldr/export/data/plurals.rb
101
162
  - lib/cldr/export/data/plurals/cldr_grammar.treetop
102
163
  - lib/cldr/export/data/plurals/grammar.rb
103
164
  - lib/cldr/export/data/plurals/rules.rb
165
+ - lib/cldr/export/data/rbnf.rb
166
+ - lib/cldr/export/data/rbnf_root.rb
104
167
  - lib/cldr/export/data/territories.rb
105
168
  - lib/cldr/export/data/timezones.rb
106
169
  - lib/cldr/export/data/units.rb
170
+ - lib/cldr/export/data/windows_zones.rb
107
171
  - lib/cldr/export/ruby.rb
108
172
  - lib/cldr/export/yaml.rb
109
173
  - lib/cldr/format.rb
@@ -131,11 +195,13 @@ files:
131
195
  - test/export/data/currencies_test.rb
132
196
  - test/export/data/delimiters_test.rb
133
197
  - test/export/data/languages_test.rb
198
+ - test/export/data/metazones_test.rb
134
199
  - test/export/data/numbers_test.rb
135
200
  - test/export/data/plurals_test.rb
136
201
  - test/export/data/territories_test.rb
137
202
  - test/export/data/timezones_test.rb
138
203
  - test/export/data/units_test.rb
204
+ - test/export/data/windows_zones_test.rb
139
205
  - test/export_test.rb
140
206
  - test/format/all.rb
141
207
  - test/format/currency_test.rb
@@ -151,29 +217,25 @@ files:
151
217
  - test/test_helper.rb
152
218
  homepage: http://github.com/svenfuchs/ruby-cldr
153
219
  licenses: []
220
+ metadata: {}
154
221
  post_install_message:
155
222
  rdoc_options: []
156
223
  require_paths:
157
224
  - lib
158
225
  required_ruby_version: !ruby/object:Gem::Requirement
159
- none: false
160
226
  requirements:
161
- - - ! '>='
227
+ - - '>='
162
228
  - !ruby/object:Gem::Version
163
229
  version: '0'
164
- segments:
165
- - 0
166
- hash: 1186465596136012030
167
230
  required_rubygems_version: !ruby/object:Gem::Requirement
168
- none: false
169
231
  requirements:
170
- - - ! '>='
232
+ - - '>='
171
233
  - !ruby/object:Gem::Version
172
234
  version: '0'
173
235
  requirements: []
174
236
  rubyforge_project:
175
- rubygems_version: 1.8.6
237
+ rubygems_version: 2.1.11
176
238
  signing_key:
177
- specification_version: 3
239
+ specification_version: 4
178
240
  summary: Ruby library for exporting and using data from CLDR
179
241
  test_files: []