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
@@ -45,12 +45,12 @@ describe LocalizedDate do
45
45
  it "should ago-ify a date with a number of different units" do
46
46
  date_time = DateTime.new(2010, 6, 6, 12, 12, 30)
47
47
  loc_date = date_time.localize(:de).to_date
48
- expect(loc_date.ago(base_time: base_time).to_s(unit: :second)).to match_normalized("Vor 5270400 Sekunden")
49
- expect(loc_date.ago(base_time: base_time).to_s(unit: :minute)).to match_normalized("Vor 87840 Minuten")
50
- expect(loc_date.ago(base_time: base_time).to_s(unit: :hour)).to match_normalized("Vor 1464 Stunden")
51
- expect(loc_date.ago(base_time: base_time).to_s(unit: :day)).to match_normalized("Vor 61 Tagen")
52
- expect(loc_date.ago(base_time: base_time).to_s(unit: :month)).to match_normalized("Vor 2 Monaten")
53
- expect(loc_date.ago(base_time: base_time).to_s(unit: :year)).to match_normalized("Vor 0 Jahren")
48
+ expect(loc_date.ago(base_time: base_time).to_s(unit: :second)).to match_normalized("vor 5270400 Sekunden")
49
+ expect(loc_date.ago(base_time: base_time).to_s(unit: :minute)).to match_normalized("vor 87840 Minuten")
50
+ expect(loc_date.ago(base_time: base_time).to_s(unit: :hour)).to match_normalized("vor 1464 Stunden")
51
+ expect(loc_date.ago(base_time: base_time).to_s(unit: :day)).to match_normalized("vor 61 Tagen")
52
+ expect(loc_date.ago(base_time: base_time).to_s(unit: :month)).to match_normalized("vor 2 Monaten")
53
+ expect(loc_date.ago(base_time: base_time).to_s(unit: :year)).to match_normalized("vor 0 Jahren")
54
54
  end
55
55
 
56
56
  it "should return an error if called on a date in the future" do
@@ -66,12 +66,12 @@ describe LocalizedDate do
66
66
  it "should until-ify with a number of different units" do
67
67
  date_time = DateTime.new(2010, 10, 10, 12, 12, 30)
68
68
  loc_date = date_time.localize(:de).to_date
69
- expect(loc_date.until(base_time: base_time).to_s(unit: :second)).to match_normalized("In 5616000 Sekunden")
70
- expect(loc_date.until(base_time: base_time).to_s(unit: :minute)).to match_normalized("In 93600 Minuten")
71
- expect(loc_date.until(base_time: base_time).to_s(unit: :hour)).to match_normalized("In 1560 Stunden")
72
- expect(loc_date.until(base_time: base_time).to_s(unit: :day)).to match_normalized("In 65 Tagen")
73
- expect(loc_date.until(base_time: base_time).to_s(unit: :month)).to match_normalized("In 2 Monaten")
74
- expect(loc_date.until(base_time: base_time).to_s(unit: :year)).to match_normalized("In 0 Jahren")
69
+ expect(loc_date.until(base_time: base_time).to_s(unit: :second)).to match_normalized("in 5616000 Sekunden")
70
+ expect(loc_date.until(base_time: base_time).to_s(unit: :minute)).to match_normalized("in 93600 Minuten")
71
+ expect(loc_date.until(base_time: base_time).to_s(unit: :hour)).to match_normalized("in 1560 Stunden")
72
+ expect(loc_date.until(base_time: base_time).to_s(unit: :day)).to match_normalized("in 65 Tagen")
73
+ expect(loc_date.until(base_time: base_time).to_s(unit: :month)).to match_normalized("in 2 Monaten")
74
+ expect(loc_date.until(base_time: base_time).to_s(unit: :year)).to match_normalized("in 0 Jahren")
75
75
  end
76
76
 
77
77
  it "should return an error if called on a date in the past" do
@@ -148,4 +148,4 @@ describe LocalizedDate do
148
148
  end
149
149
  end
150
150
 
151
- end
151
+ end
@@ -10,29 +10,28 @@ include TwitterCldr::Localized
10
10
  describe LocalizedTimespan do
11
11
  it "should format a numer of seconds in different units" do
12
12
  timespan = LocalizedTimespan.new(-172800, locale: :de)
13
- expect(timespan.to_s(unit: :hour)).to match_normalized("Vor 48 Stunden")
14
- expect(timespan.to_s(unit: :day)).to match_normalized("Vor 2 Tagen")
13
+ expect(timespan.to_s(unit: :hour)).to match_normalized("vor 48 Stunden")
14
+ expect(timespan.to_s(unit: :day)).to match_normalized("vor 2 Tagen")
15
15
  end
16
16
 
17
17
  it "approximates timespans accurately if explicity asked" do
18
18
  options = {
19
- direction: :none,
20
19
  approximate: true
21
20
  }
22
21
 
23
22
  expected = {
24
- 44 => "44 Sekunden",
25
- 45 => "1 Minute",
26
- 2699 => "45 Minuten",
27
- 2700 => "1 Stunde",
28
- 64799 => "18 Stunden",
29
- 64800 => "1 Tag",
30
- 453599 => "5 Tage",
31
- 453600 => "1 Woche",
32
- 1972307 => "3 Wochen",
33
- 1972308 => "1 Monat",
34
- 23667694 => "9 Monate",
35
- 23667695 => "1 Jahr"
23
+ 44 => "in 44 Sekunden",
24
+ 45 => "in 1 Minute",
25
+ 2699 => "in 45 Minuten",
26
+ 2700 => "in 1 Stunde",
27
+ 64799 => "in 18 Stunden",
28
+ 64800 => "in 1 Tag",
29
+ 453599 => "in 5 Tagen",
30
+ 453600 => "in 1 Woche",
31
+ 1972307 => "in 3 Wochen",
32
+ 1972308 => "in 1 Monat",
33
+ 23667694 => "in 9 Monaten",
34
+ 23667695 => "in 1 Jahr"
36
35
  }
37
36
 
38
37
  expected.each_pair do |seconds, text|
@@ -42,60 +41,39 @@ describe LocalizedTimespan do
42
41
  end
43
42
 
44
43
  it "doesn't approximate timespans by default" do
45
- options = { direction: :none }
46
44
  expected = {
47
- 44 => "44 Sekunden",
48
- 45 => "45 Sekunden",
49
- 2699 => "45 Minuten",
50
- 2700 => "45 Minuten",
51
- 64799 => "18 Stunden",
52
- 64800 => "18 Stunden",
53
- 453599 => "5 Tage",
54
- 453600 => "5 Tage",
55
- 1972307 => "3 Wochen",
56
- 1972308 => "3 Wochen",
57
- 23667694 => "9 Monate",
58
- 23667695 => "9 Monate",
59
- 31556926 => "1 Jahr"
45
+ 44 => "in 44 Sekunden",
46
+ 45 => "in 45 Sekunden",
47
+ 2699 => "in 45 Minuten",
48
+ 2700 => "in 45 Minuten",
49
+ 64799 => "in 18 Stunden",
50
+ 64800 => "in 18 Stunden",
51
+ 453599 => "in 5 Tagen",
52
+ 453600 => "in 5 Tagen",
53
+ 1972307 => "in 3 Wochen",
54
+ 1972308 => "in 3 Wochen",
55
+ 23667694 => "in 9 Monaten",
56
+ 23667695 => "in 9 Monaten",
57
+ 31556926 => "in 1 Jahr"
60
58
  }
61
59
 
62
60
  expected.each_pair do |seconds, text|
63
61
  timespan = LocalizedTimespan.new(seconds, locale: :de)
64
- expect(timespan.to_s(options)).to match_normalized(text)
65
- end
66
- end
67
-
68
- describe "non-directional" do
69
- it "works for a variety of units" do
70
- timespan = LocalizedTimespan.new(3273932, locale: :de)
71
- options = { direction: :none }
72
- expected = {
73
- year: '0 Jahre',
74
- month: '1 Monat',
75
- week: '5 Wochen',
76
- day: '38 Tage',
77
- hour: '909 Stunden',
78
- minute: '54566 Minuten',
79
- second: '3273932 Sekunden'
80
- }
81
-
82
- expected.each_pair do |unit, text|
83
- expect(timespan.to_s(options.merge(unit: unit))).to match_normalized(text)
84
- end
62
+ expect(timespan.to_s).to match_normalized(text)
85
63
  end
86
64
  end
87
65
 
88
66
  describe "ago" do
89
67
  it "works for a variety of units" do
90
68
  timespan = LocalizedTimespan.new(-3273932, locale: :de)
91
- expected = {
92
- year: 'Vor 0 Jahren',
93
- month: 'Vor 1 Monat',
94
- week: 'Vor 5 Wochen',
95
- day: 'Vor 38 Tagen',
96
- hour: 'Vor 909 Stunden',
97
- minute: 'Vor 54566 Minuten',
98
- second: 'Vor 3273932 Sekunden'
69
+ expected = {
70
+ year: 'vor 0 Jahren',
71
+ month: 'vor 1 Monat',
72
+ week: 'vor 5 Wochen',
73
+ day: 'vor 38 Tagen',
74
+ hour: 'vor 909 Stunden',
75
+ minute: 'vor 54566 Minuten',
76
+ second: 'vor 3273932 Sekunden'
99
77
  }
100
78
 
101
79
  expected.each_pair do |unit, text|
@@ -108,13 +86,13 @@ describe LocalizedTimespan do
108
86
  it "works for a variety of units" do
109
87
  timespan = LocalizedTimespan.new(3273932, locale: :de)
110
88
  expected = {
111
- year: 'In 0 Jahren',
112
- month: 'In 1 Monat',
113
- week: 'In 5 Wochen',
114
- day: 'In 38 Tagen',
115
- hour: 'In 909 Stunden',
116
- minute: 'In 54566 Minuten',
117
- second: 'In 3273932 Sekunden'
89
+ year: 'in 0 Jahren',
90
+ month: 'in 1 Monat',
91
+ week: 'in 5 Wochen',
92
+ day: 'in 38 Tagen',
93
+ hour: 'in 909 Stunden',
94
+ minute: 'in 54566 Minuten',
95
+ second: 'in 3273932 Sekunden'
118
96
  }
119
97
 
120
98
  expected.each_pair do |unit, text|
@@ -122,23 +100,4 @@ describe LocalizedTimespan do
122
100
  end
123
101
  end
124
102
  end
125
-
126
- # Note: non-directional timespans are the only ones that support the abbreviated type (i.e. ago and until cannot be abbreviated)
127
- describe "non-directional" do
128
- it "works for a variety of units" do
129
- # year/month/week not supported
130
- timespan = LocalizedTimespan.new(3273932)
131
- options = { type: :abbreviated, direction: :none }
132
- expected = {
133
- day: '38d',
134
- hour: '909h',
135
- minute: '54566m',
136
- second: '3273932s'
137
- }
138
-
139
- expected.each_pair do |unit, text|
140
- expect(timespan.to_s(options.merge(unit: unit))).to match_normalized(text)
141
- end
142
- end
143
- end
144
103
  end
data/twitter_cldr.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency 'json', '~> 1.0' if RUBY_VERSION < '2'
19
19
  s.add_dependency 'camertron-eprun'
20
20
  s.add_dependency 'tzinfo'
21
- s.add_dependency 'cldr-plurals-runtime-rb', '~> 1.0.0'
21
+ s.add_dependency 'cldr-plurals-runtime-rb', '~> 1.0'
22
22
 
23
23
  s.require_path = 'lib'
24
24
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter_cldr
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0
4
+ version: 3.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-10 00:00:00.000000000 Z
11
+ date: 2016-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: camertron-eprun
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.0
47
+ version: '1.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.0
54
+ version: '1.0'
55
55
  description: Ruby implementation of the ICU (International Components for Unicode)
56
56
  that uses the Common Locale Data Repository to format dates, plurals, and more.
57
57
  email:
@@ -426,6 +426,7 @@ files:
426
426
  - resources/custom/locales/vi/fields.yml
427
427
  - resources/custom/locales/zh-Hant/fields.yml
428
428
  - resources/custom/locales/zh/fields.yml
429
+ - resources/custom/shared/postal_codes.yml
429
430
  - resources/locales/af/calendars.yml
430
431
  - resources/locales/af/currencies.yml
431
432
  - resources/locales/af/fields.yml
@@ -2478,7 +2479,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2478
2479
  version: '0'
2479
2480
  requirements: []
2480
2481
  rubyforge_project:
2481
- rubygems_version: 2.2.3
2482
+ rubygems_version: 2.6.6
2482
2483
  signing_key:
2483
2484
  specification_version: 4
2484
2485
  summary: Ruby implementation of the ICU (International Components for Unicode) that