twitter_cldr 3.5.0 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -6
  3. data/History.txt +3 -0
  4. data/README.md +15 -15
  5. data/lib/twitter_cldr/data_readers/data_reader.rb +2 -2
  6. data/lib/twitter_cldr/data_readers/timespan_data_reader.rb +23 -78
  7. data/lib/twitter_cldr/formatters/numbers/rbnf.rb +1 -1
  8. data/lib/twitter_cldr/resources/locales_resources_importer.rb +3 -3
  9. data/lib/twitter_cldr/tokenizers/numbers/rbnf_tokenizer.rb +1 -4
  10. data/lib/twitter_cldr/version.rb +1 -1
  11. data/resources/custom/shared/postal_codes.yml +8 -0
  12. data/resources/locales/af/fields.yml +325 -98
  13. data/resources/locales/ar/fields.yml +532 -210
  14. data/resources/locales/ar/plurals.yml +4 -3
  15. data/resources/locales/be/fields.yml +21 -112
  16. data/resources/locales/be/plurals.yml +6 -4
  17. data/resources/locales/bg/fields.yml +342 -98
  18. data/resources/locales/bn/fields.yml +342 -98
  19. data/resources/locales/bn/plurals.yml +2 -2
  20. data/resources/locales/ca/fields.yml +342 -98
  21. data/resources/locales/ca/plurals.yml +2 -2
  22. data/resources/locales/cs/fields.yml +438 -126
  23. data/resources/locales/cs/plurals.yml +3 -3
  24. data/resources/locales/cy/fields.yml +202 -98
  25. data/resources/locales/da/fields.yml +342 -98
  26. data/resources/locales/da/plurals.yml +2 -2
  27. data/resources/locales/de-CH/fields.yml +342 -98
  28. data/resources/locales/de-CH/plurals.yml +2 -2
  29. data/resources/locales/de/fields.yml +342 -98
  30. data/resources/locales/de/plurals.yml +2 -2
  31. data/resources/locales/el/fields.yml +342 -98
  32. data/resources/locales/en-150/fields.yml +283 -98
  33. data/resources/locales/en-150/plurals.yml +5 -5
  34. data/resources/locales/en-AU/fields.yml +283 -98
  35. data/resources/locales/en-AU/plurals.yml +5 -5
  36. data/resources/locales/en-CA/fields.yml +283 -98
  37. data/resources/locales/en-CA/plurals.yml +5 -5
  38. data/resources/locales/en-GB/fields.yml +357 -98
  39. data/resources/locales/en-GB/plurals.yml +5 -5
  40. data/resources/locales/en-IE/fields.yml +283 -98
  41. data/resources/locales/en-IE/plurals.yml +5 -5
  42. data/resources/locales/en-SG/fields.yml +283 -98
  43. data/resources/locales/en-SG/plurals.yml +5 -5
  44. data/resources/locales/en-ZA/fields.yml +283 -98
  45. data/resources/locales/en-ZA/plurals.yml +5 -5
  46. data/resources/locales/en/fields.yml +283 -98
  47. data/resources/locales/en/plurals.yml +5 -5
  48. data/resources/locales/es-419/fields.yml +342 -98
  49. data/resources/locales/es-CO/fields.yml +342 -98
  50. data/resources/locales/es-MX/fields.yml +342 -98
  51. data/resources/locales/es-US/fields.yml +342 -98
  52. data/resources/locales/es/fields.yml +342 -98
  53. data/resources/locales/eu/fields.yml +342 -98
  54. data/resources/locales/fa/fields.yml +342 -98
  55. data/resources/locales/fa/plurals.yml +2 -2
  56. data/resources/locales/fi/fields.yml +342 -98
  57. data/resources/locales/fi/plurals.yml +2 -2
  58. data/resources/locales/fil/fields.yml +342 -98
  59. data/resources/locales/fil/plurals.yml +4 -4
  60. data/resources/locales/fr-BE/fields.yml +342 -98
  61. data/resources/locales/fr-CA/fields.yml +342 -98
  62. data/resources/locales/fr-CH/fields.yml +342 -98
  63. data/resources/locales/fr/fields.yml +342 -98
  64. data/resources/locales/ga/fields.yml +484 -98
  65. data/resources/locales/ga/plurals.yml +3 -3
  66. data/resources/locales/gl/fields.yml +313 -98
  67. data/resources/locales/gl/plurals.yml +2 -2
  68. data/resources/locales/gu/fields.yml +342 -98
  69. data/resources/locales/gu/plurals.yml +7 -7
  70. data/resources/locales/he/fields.yml +438 -154
  71. data/resources/locales/he/plurals.yml +4 -3
  72. data/resources/locales/hi/fields.yml +342 -98
  73. data/resources/locales/hi/plurals.yml +2 -2
  74. data/resources/locales/hr/fields.yml +390 -154
  75. data/resources/locales/hr/plurals.yml +7 -4
  76. data/resources/locales/hu/fields.yml +342 -98
  77. data/resources/locales/id/fields.yml +294 -98
  78. data/resources/locales/is/fields.yml +342 -98
  79. data/resources/locales/is/plurals.yml +2 -2
  80. data/resources/locales/it-CH/fields.yml +342 -98
  81. data/resources/locales/it-CH/plurals.yml +2 -2
  82. data/resources/locales/it/fields.yml +342 -98
  83. data/resources/locales/it/plurals.yml +2 -2
  84. data/resources/locales/ja/fields.yml +294 -98
  85. data/resources/locales/kn/fields.yml +342 -98
  86. data/resources/locales/kn/plurals.yml +3 -3
  87. data/resources/locales/ko/fields.yml +294 -98
  88. data/resources/locales/lv/fields.yml +390 -126
  89. data/resources/locales/lv/plurals.yml +6 -4
  90. data/resources/locales/mr/fields.yml +340 -98
  91. data/resources/locales/mr/plurals.yml +6 -7
  92. data/resources/locales/ms/fields.yml +294 -98
  93. data/resources/locales/nb/fields.yml +342 -98
  94. data/resources/locales/nl/fields.yml +342 -98
  95. data/resources/locales/nl/plurals.yml +2 -2
  96. data/resources/locales/pl/fields.yml +438 -154
  97. data/resources/locales/pl/plurals.yml +8 -4
  98. data/resources/locales/pt/fields.yml +342 -98
  99. data/resources/locales/pt/plurals.yml +2 -2
  100. data/resources/locales/ro/fields.yml +390 -126
  101. data/resources/locales/ro/plurals.yml +4 -3
  102. data/resources/locales/ru/fields.yml +438 -154
  103. data/resources/locales/ru/plurals.yml +8 -4
  104. data/resources/locales/sk/fields.yml +438 -126
  105. data/resources/locales/sk/plurals.yml +3 -3
  106. data/resources/locales/sq/fields.yml +340 -98
  107. data/resources/locales/sq/plurals.yml +2 -2
  108. data/resources/locales/sr/fields.yml +390 -154
  109. data/resources/locales/sr/plurals.yml +7 -4
  110. data/resources/locales/sv/fields.yml +342 -98
  111. data/resources/locales/sv/plurals.yml +4 -4
  112. data/resources/locales/ta/fields.yml +342 -98
  113. data/resources/locales/th/fields.yml +294 -98
  114. data/resources/locales/tr/fields.yml +342 -98
  115. data/resources/locales/uk/fields.yml +438 -154
  116. data/resources/locales/uk/plurals.yml +10 -6
  117. data/resources/locales/ur/fields.yml +342 -98
  118. data/resources/locales/ur/plurals.yml +2 -2
  119. data/resources/locales/vi/fields.yml +294 -98
  120. data/resources/locales/zh-Hant/fields.yml +294 -98
  121. data/resources/locales/zh/fields.yml +294 -98
  122. data/spec/data_readers/timespan_data_reader_spec.rb +68 -3
  123. data/spec/localized/localized_date_spec.rb +13 -13
  124. data/spec/localized/localized_timespan_spec.rb +43 -84
  125. data/twitter_cldr.gemspec +1 -1
  126. metadata +6 -5
@@ -2,107 +2,303 @@
2
2
  :zh:
3
3
  :fields:
4
4
  :day:
5
- :default:
6
- :one: "{0} day"
7
- :other: "{0}天"
8
- :short:
9
- :one: "{0} day"
10
- :other: "{0}天"
11
- :day-future:
12
- :default:
13
- :one: "In {0} day"
14
- :other: "{0}天后"
15
- :day-past:
16
- :default:
17
- :one: "{0} day ago"
18
- :other: "{0}天前"
5
+ :display_name:
6
+ :relative:
7
+ -1: 昨天
8
+ -2: 前天
9
+ 0: 今天
10
+ 1: 明天
11
+ 2: 后天
12
+ :relative_time:
13
+ :future:
14
+ :other: "{0}天后"
15
+ :past:
16
+ :other: "{0}天前"
17
+ :day-narrow:
18
+ :display_name:
19
+ :relative_time:
20
+ :future:
21
+ :other: "{0}天后"
22
+ :past:
23
+ :other: "{0}天前"
24
+ :day-short:
25
+ :display_name: 日
26
+ :relative_time:
27
+ :future:
28
+ :other: "{0}天后"
29
+ :past:
30
+ :other: "{0}天前"
31
+ :dayperiod:
32
+ :display_name: 上午/下午
33
+ :era:
34
+ :display_name: 纪元
35
+ :fri:
36
+ :relative:
37
+ -1: 上周五
38
+ 0: 本周五
39
+ 1: 下周五
40
+ :fri-narrow:
41
+ :relative:
42
+ -1: 上周五
43
+ 0: 本周五
44
+ 1: 下周五
45
+ :fri-short:
46
+ :relative:
47
+ -1: 上周五
48
+ 0: 本周五
49
+ 1: 下周五
19
50
  :hour:
20
- :default:
21
- :one: "{0} hour"
22
- :other: "{0}小时"
23
- :short:
24
- :one: "{0} hr"
25
- :other: "{0}小时"
26
- :hour-future:
27
- :default:
28
- :one: "In {0} hour"
29
- :other: "{0}小时后"
30
- :hour-past:
31
- :default:
32
- :one: "{0} hour ago"
33
- :other: "{0}小时前"
51
+ :display_name: 小时
52
+ :relative_time:
53
+ :future:
54
+ :other: "{0}小时后"
55
+ :past:
56
+ :other: "{0}小时前"
57
+ :hour-narrow:
58
+ :display_name: 小时
59
+ :relative_time:
60
+ :future:
61
+ :other: "{0}小时后"
62
+ :past:
63
+ :other: "{0}小时前"
64
+ :hour-short:
65
+ :display_name: 小时
66
+ :relative_time:
67
+ :future:
68
+ :other: "{0}小时后"
69
+ :past:
70
+ :other: "{0}小时前"
34
71
  :minute:
35
- :default:
36
- :one: "{0} minute"
37
- :other: "{0}分钟"
38
- :short:
39
- :one: "{0} min"
40
- :other: "{0}"
41
- :minute-future:
42
- :default:
43
- :one: "In {0} minute"
44
- :other: "{0}分钟后"
45
- :minute-past:
46
- :default:
47
- :one: "{0} minute ago"
48
- :other: "{0}分钟前"
72
+ :display_name: 分钟
73
+ :relative_time:
74
+ :future:
75
+ :other: "{0}分钟后"
76
+ :past:
77
+ :other: "{0}分钟前"
78
+ :minute-narrow:
79
+ :display_name: 分钟
80
+ :relative_time:
81
+ :future:
82
+ :other: "{0}分钟后"
83
+ :past:
84
+ :other: "{0}分钟前"
85
+ :minute-short:
86
+ :display_name: 分钟
87
+ :relative_time:
88
+ :future:
89
+ :other: "{0}分钟后"
90
+ :past:
91
+ :other: "{0}分钟前"
92
+ :mon:
93
+ :relative:
94
+ -1: 上周一
95
+ 0: 本周一
96
+ 1: 下周一
97
+ :mon-narrow:
98
+ :relative:
99
+ -1: 上周一
100
+ 0: 本周一
101
+ 1: 下周一
102
+ :mon-short:
103
+ :relative:
104
+ -1: 上周一
105
+ 0: 本周一
106
+ 1: 下周一
49
107
  :month:
50
- :default:
51
- :one: "{0} month"
52
- :other: "{0}个月"
53
- :short:
54
- :one: "{0} mth"
55
- :other: "{0}个月"
56
- :month-future:
57
- :default:
58
- :one: "In {0} month"
59
- :other: "{0}个月后"
60
- :month-past:
61
- :default:
62
- :one: "{0} month ago"
63
- :other: "{0}个月前"
108
+ :display_name:
109
+ :relative:
110
+ -1: 上个月
111
+ 0: 本月
112
+ 1: 下个月
113
+ :relative_time:
114
+ :future:
115
+ :other: "{0}个月后"
116
+ :past:
117
+ :other: "{0}个月前"
118
+ :month-narrow:
119
+ :display_name:
120
+ :relative_time:
121
+ :future:
122
+ :other: "{0}个月后"
123
+ :past:
124
+ :other: "{0}个月前"
125
+ :month-short:
126
+ :display_name: 月
127
+ :relative_time:
128
+ :future:
129
+ :other: "{0}个月后"
130
+ :past:
131
+ :other: "{0}个月前"
132
+ :quarter:
133
+ :display_name: 季
134
+ :relative_time:
135
+ :future:
136
+ :other: "{0}季度后"
137
+ :past:
138
+ :other: "{0}季度前"
139
+ :quarter-narrow:
140
+ :display_name: 季
141
+ :relative_time:
142
+ :future:
143
+ :other: "{0}季度后"
144
+ :past:
145
+ :other: "{0}季度前"
146
+ :quarter-short:
147
+ :display_name: 季
148
+ :relative_time:
149
+ :future:
150
+ :other: "{0}季度后"
151
+ :past:
152
+ :other: "{0}季度前"
153
+ :sat:
154
+ :relative:
155
+ -1: 上周六
156
+ 0: 本周六
157
+ 1: 下周六
158
+ :sat-narrow:
159
+ :relative:
160
+ -1: 上周六
161
+ 0: 本周六
162
+ 1: 下周六
163
+ :sat-short:
164
+ :relative:
165
+ -1: 上周六
166
+ 0: 本周六
167
+ 1: 下周六
64
168
  :second:
65
- :default:
66
- :one: "{0} second"
67
- :other: "{0}秒钟"
68
- :short:
69
- :one: "{0} sec"
70
- :other: "{0}"
71
- :second-future:
72
- :default:
73
- :one: "In {0} second"
74
- :other: "{0}秒钟后"
75
- :second-past:
76
- :default:
77
- :one: "{0} second ago"
78
- :other: "{0}秒钟前"
169
+ :display_name: 秒钟
170
+ :relative:
171
+ 0: 现在
172
+ :relative_time:
173
+ :future:
174
+ :other: "{0}秒钟后"
175
+ :past:
176
+ :other: "{0}秒钟前"
177
+ :second-narrow:
178
+ :display_name: 秒钟
179
+ :relative_time:
180
+ :future:
181
+ :other: "{0}秒后"
182
+ :past:
183
+ :other: "{0}秒前"
184
+ :second-short:
185
+ :display_name: 秒钟
186
+ :relative_time:
187
+ :future:
188
+ :other: "{0}秒后"
189
+ :past:
190
+ :other: "{0}秒前"
191
+ :sun:
192
+ :relative:
193
+ -1: 上周日
194
+ 0: 本周日
195
+ 1: 下周日
196
+ :sun-narrow:
197
+ :relative:
198
+ -1: 上周日
199
+ 0: 本周日
200
+ 1: 下周日
201
+ :sun-short:
202
+ :relative:
203
+ -1: 上周日
204
+ 0: 本周日
205
+ 1: 下周日
206
+ :thu:
207
+ :relative:
208
+ -1: 上周四
209
+ 0: 本周四
210
+ 1: 下周四
211
+ :thu-narrow:
212
+ :relative:
213
+ -1: 上周四
214
+ 0: 本周四
215
+ 1: 下周四
216
+ :thu-short:
217
+ :relative:
218
+ -1: 上周四
219
+ 0: 本周四
220
+ 1: 下周四
221
+ :tue:
222
+ :relative:
223
+ -1: 上周二
224
+ 0: 本周二
225
+ 1: 下周二
226
+ :tue-narrow:
227
+ :relative:
228
+ -1: 上周二
229
+ 0: 本周二
230
+ 1: 下周二
231
+ :tue-short:
232
+ :relative:
233
+ -1: 上周二
234
+ 0: 本周二
235
+ 1: 下周二
236
+ :wed:
237
+ :relative:
238
+ -1: 上周三
239
+ 0: 本周三
240
+ 1: 下周三
241
+ :wed-narrow:
242
+ :relative:
243
+ -1: 上周三
244
+ 0: 本周三
245
+ 1: 下周三
246
+ :wed-short:
247
+ :relative:
248
+ -1: 上周三
249
+ 0: 本周三
250
+ 1: 下周三
79
251
  :week:
80
- :default:
81
- :one: "{0} week"
82
- :other: "{0}周"
83
- :short:
84
- :one: "{0} wk"
85
- :other: "{0}周"
86
- :week-future:
87
- :default:
88
- :one: "In {0} week"
89
- :other: "{0}周后"
90
- :week-past:
91
- :default:
92
- :one: "{0} week ago"
93
- :other: "{0}周前"
252
+ :display_name:
253
+ :relative:
254
+ -1: 上周
255
+ 0: 本周
256
+ 1: 下周
257
+ :relative_time:
258
+ :future:
259
+ :other: "{0}周后"
260
+ :past:
261
+ :other: "{0}周前"
262
+ :week-narrow:
263
+ :display_name:
264
+ :relative_time:
265
+ :future:
266
+ :other: "{0}周后"
267
+ :past:
268
+ :other: "{0}周前"
269
+ :week-short:
270
+ :display_name: 周
271
+ :relative_time:
272
+ :future:
273
+ :other: "{0}周后"
274
+ :past:
275
+ :other: "{0}周前"
276
+ :weekday:
277
+ :display_name: 工作日
94
278
  :year:
95
- :default:
96
- :one: "{0} year"
97
- :other: "{0}年"
98
- :short:
99
- :one: "{0} yr"
100
- :other: "{0}年"
101
- :year-future:
102
- :default:
103
- :one: "In {0} year"
104
- :other: "{0}年后"
105
- :year-past:
106
- :default:
107
- :one: "{0} year ago"
108
- :other: "{0}年前"
279
+ :display_name:
280
+ :relative:
281
+ -1: 去年
282
+ 0: 今年
283
+ 1: 明年
284
+ :relative_time:
285
+ :future:
286
+ :other: "{0}年后"
287
+ :past:
288
+ :other: "{0}年前"
289
+ :year-narrow:
290
+ :display_name:
291
+ :relative_time:
292
+ :future:
293
+ :other: "{0}年后"
294
+ :past:
295
+ :other: "{0}年前"
296
+ :year-short:
297
+ :display_name: 年
298
+ :relative_time:
299
+ :future:
300
+ :other: "{0}年后"
301
+ :past:
302
+ :other: "{0}年前"
303
+ :zone:
304
+ :display_name: 时区
@@ -8,9 +8,74 @@ require 'spec_helper'
8
8
  include TwitterCldr::DataReaders
9
9
 
10
10
  describe TimespanDataReader do
11
- let(:data_reader) { TimespanDataReader.new(:sv, 2) }
11
+ it 'sets default options and identifies plural rule' do
12
+ data_reader = TimespanDataReader.new(:sv, 2)
13
+ expect(data_reader.locale).to eq(:sv)
14
+ expect(data_reader.type).to eq(:default)
15
+ expect(data_reader.direction).to eq(:ago)
16
+ expect(data_reader.unit).to eq(nil)
17
+ expect(data_reader.plural_rule).to eq(:other)
18
+ end
19
+
20
+ describe '#pattern' do
21
+ test_cases = {
22
+ ago: {
23
+ default: {
24
+ second: 'för {0} sekunder sedan',
25
+ minute: 'för {0} minuter sedan',
26
+ hour: 'för {0} timmar sedan',
27
+ day: 'för {0} dagar sedan',
28
+ week: 'för {0} veckor sedan',
29
+ month: 'för {0} månader sedan',
30
+ year: 'för {0} år sedan'
31
+ },
32
+
33
+ narrow: {
34
+ second: '−{0} s',
35
+ minute: '−{0} min',
36
+ hour: '−{0} h',
37
+ day: '−{0} d',
38
+ week: '-{0} v.',
39
+ month: '-{0} mån.',
40
+ year: '-{0} år'
41
+ }
42
+ },
43
+
44
+ until: {
45
+ default: {
46
+ second: 'om {0} sekunder',
47
+ minute: 'om {0} minuter',
48
+ hour: 'om {0} timmar',
49
+ day: 'om {0} dagar',
50
+ week: 'om {0} veckor',
51
+ month: 'om {0} månader',
52
+ year: 'om {0} år'
53
+ },
54
+
55
+ narrow: {
56
+ second: '+{0} s',
57
+ minute: '+{0} m',
58
+ hour: '+{0} h',
59
+ day: '+{0} d',
60
+ week: '+{0} v.',
61
+ month: '+{0} mån.',
62
+ year: '+{0} år'
63
+ }
64
+ }
65
+ }
66
+
67
+ test_cases.each_pair do |direction, dir_hash|
68
+ dir_hash.each_pair do |type, type_hash|
69
+ type_hash.each_pair do |unit, expected_value|
70
+ it "finds the correct pattern with direction '#{direction}', type '#{type}', and unit '#{unit}'" do
71
+ data_reader = TimespanDataReader.new(:sv, 2, {
72
+ direction: direction, type: type, unit: unit
73
+ })
12
74
 
13
- xit "works" do
14
- # TODO: add tests
75
+ expect(data_reader.pattern).to match_normalized(expected_value)
76
+ end
77
+ end
78
+ end
79
+ end
15
80
  end
16
81
  end