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.
- checksums.yaml +4 -4
- data/Gemfile +3 -6
- data/History.txt +3 -0
- data/README.md +15 -15
- data/lib/twitter_cldr/data_readers/data_reader.rb +2 -2
- data/lib/twitter_cldr/data_readers/timespan_data_reader.rb +23 -78
- data/lib/twitter_cldr/formatters/numbers/rbnf.rb +1 -1
- data/lib/twitter_cldr/resources/locales_resources_importer.rb +3 -3
- data/lib/twitter_cldr/tokenizers/numbers/rbnf_tokenizer.rb +1 -4
- data/lib/twitter_cldr/version.rb +1 -1
- data/resources/custom/shared/postal_codes.yml +8 -0
- data/resources/locales/af/fields.yml +325 -98
- data/resources/locales/ar/fields.yml +532 -210
- data/resources/locales/ar/plurals.yml +4 -3
- data/resources/locales/be/fields.yml +21 -112
- data/resources/locales/be/plurals.yml +6 -4
- data/resources/locales/bg/fields.yml +342 -98
- data/resources/locales/bn/fields.yml +342 -98
- data/resources/locales/bn/plurals.yml +2 -2
- data/resources/locales/ca/fields.yml +342 -98
- data/resources/locales/ca/plurals.yml +2 -2
- data/resources/locales/cs/fields.yml +438 -126
- data/resources/locales/cs/plurals.yml +3 -3
- data/resources/locales/cy/fields.yml +202 -98
- data/resources/locales/da/fields.yml +342 -98
- data/resources/locales/da/plurals.yml +2 -2
- data/resources/locales/de-CH/fields.yml +342 -98
- data/resources/locales/de-CH/plurals.yml +2 -2
- data/resources/locales/de/fields.yml +342 -98
- data/resources/locales/de/plurals.yml +2 -2
- data/resources/locales/el/fields.yml +342 -98
- data/resources/locales/en-150/fields.yml +283 -98
- data/resources/locales/en-150/plurals.yml +5 -5
- data/resources/locales/en-AU/fields.yml +283 -98
- data/resources/locales/en-AU/plurals.yml +5 -5
- data/resources/locales/en-CA/fields.yml +283 -98
- data/resources/locales/en-CA/plurals.yml +5 -5
- data/resources/locales/en-GB/fields.yml +357 -98
- data/resources/locales/en-GB/plurals.yml +5 -5
- data/resources/locales/en-IE/fields.yml +283 -98
- data/resources/locales/en-IE/plurals.yml +5 -5
- data/resources/locales/en-SG/fields.yml +283 -98
- data/resources/locales/en-SG/plurals.yml +5 -5
- data/resources/locales/en-ZA/fields.yml +283 -98
- data/resources/locales/en-ZA/plurals.yml +5 -5
- data/resources/locales/en/fields.yml +283 -98
- data/resources/locales/en/plurals.yml +5 -5
- data/resources/locales/es-419/fields.yml +342 -98
- data/resources/locales/es-CO/fields.yml +342 -98
- data/resources/locales/es-MX/fields.yml +342 -98
- data/resources/locales/es-US/fields.yml +342 -98
- data/resources/locales/es/fields.yml +342 -98
- data/resources/locales/eu/fields.yml +342 -98
- data/resources/locales/fa/fields.yml +342 -98
- data/resources/locales/fa/plurals.yml +2 -2
- data/resources/locales/fi/fields.yml +342 -98
- data/resources/locales/fi/plurals.yml +2 -2
- data/resources/locales/fil/fields.yml +342 -98
- data/resources/locales/fil/plurals.yml +4 -4
- data/resources/locales/fr-BE/fields.yml +342 -98
- data/resources/locales/fr-CA/fields.yml +342 -98
- data/resources/locales/fr-CH/fields.yml +342 -98
- data/resources/locales/fr/fields.yml +342 -98
- data/resources/locales/ga/fields.yml +484 -98
- data/resources/locales/ga/plurals.yml +3 -3
- data/resources/locales/gl/fields.yml +313 -98
- data/resources/locales/gl/plurals.yml +2 -2
- data/resources/locales/gu/fields.yml +342 -98
- data/resources/locales/gu/plurals.yml +7 -7
- data/resources/locales/he/fields.yml +438 -154
- data/resources/locales/he/plurals.yml +4 -3
- data/resources/locales/hi/fields.yml +342 -98
- data/resources/locales/hi/plurals.yml +2 -2
- data/resources/locales/hr/fields.yml +390 -154
- data/resources/locales/hr/plurals.yml +7 -4
- data/resources/locales/hu/fields.yml +342 -98
- data/resources/locales/id/fields.yml +294 -98
- data/resources/locales/is/fields.yml +342 -98
- data/resources/locales/is/plurals.yml +2 -2
- data/resources/locales/it-CH/fields.yml +342 -98
- data/resources/locales/it-CH/plurals.yml +2 -2
- data/resources/locales/it/fields.yml +342 -98
- data/resources/locales/it/plurals.yml +2 -2
- data/resources/locales/ja/fields.yml +294 -98
- data/resources/locales/kn/fields.yml +342 -98
- data/resources/locales/kn/plurals.yml +3 -3
- data/resources/locales/ko/fields.yml +294 -98
- data/resources/locales/lv/fields.yml +390 -126
- data/resources/locales/lv/plurals.yml +6 -4
- data/resources/locales/mr/fields.yml +340 -98
- data/resources/locales/mr/plurals.yml +6 -7
- data/resources/locales/ms/fields.yml +294 -98
- data/resources/locales/nb/fields.yml +342 -98
- data/resources/locales/nl/fields.yml +342 -98
- data/resources/locales/nl/plurals.yml +2 -2
- data/resources/locales/pl/fields.yml +438 -154
- data/resources/locales/pl/plurals.yml +8 -4
- data/resources/locales/pt/fields.yml +342 -98
- data/resources/locales/pt/plurals.yml +2 -2
- data/resources/locales/ro/fields.yml +390 -126
- data/resources/locales/ro/plurals.yml +4 -3
- data/resources/locales/ru/fields.yml +438 -154
- data/resources/locales/ru/plurals.yml +8 -4
- data/resources/locales/sk/fields.yml +438 -126
- data/resources/locales/sk/plurals.yml +3 -3
- data/resources/locales/sq/fields.yml +340 -98
- data/resources/locales/sq/plurals.yml +2 -2
- data/resources/locales/sr/fields.yml +390 -154
- data/resources/locales/sr/plurals.yml +7 -4
- data/resources/locales/sv/fields.yml +342 -98
- data/resources/locales/sv/plurals.yml +4 -4
- data/resources/locales/ta/fields.yml +342 -98
- data/resources/locales/th/fields.yml +294 -98
- data/resources/locales/tr/fields.yml +342 -98
- data/resources/locales/uk/fields.yml +438 -154
- data/resources/locales/uk/plurals.yml +10 -6
- data/resources/locales/ur/fields.yml +342 -98
- data/resources/locales/ur/plurals.yml +2 -2
- data/resources/locales/vi/fields.yml +294 -98
- data/resources/locales/zh-Hant/fields.yml +294 -98
- data/resources/locales/zh/fields.yml +294 -98
- data/spec/data_readers/timespan_data_reader_spec.rb +68 -3
- data/spec/localized/localized_date_spec.rb +13 -13
- data/spec/localized/localized_timespan_spec.rb +43 -84
- data/twitter_cldr.gemspec +1 -1
- 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("
|
49
|
-
expect(loc_date.ago(base_time: base_time).to_s(unit: :minute)).to match_normalized("
|
50
|
-
expect(loc_date.ago(base_time: base_time).to_s(unit: :hour)).to match_normalized("
|
51
|
-
expect(loc_date.ago(base_time: base_time).to_s(unit: :day)).to match_normalized("
|
52
|
-
expect(loc_date.ago(base_time: base_time).to_s(unit: :month)).to match_normalized("
|
53
|
-
expect(loc_date.ago(base_time: base_time).to_s(unit: :year)).to match_normalized("
|
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("
|
70
|
-
expect(loc_date.until(base_time: base_time).to_s(unit: :minute)).to match_normalized("
|
71
|
-
expect(loc_date.until(base_time: base_time).to_s(unit: :hour)).to match_normalized("
|
72
|
-
expect(loc_date.until(base_time: base_time).to_s(unit: :day)).to match_normalized("
|
73
|
-
expect(loc_date.until(base_time: base_time).to_s(unit: :month)).to match_normalized("
|
74
|
-
expect(loc_date.until(base_time: base_time).to_s(unit: :year)).to match_normalized("
|
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("
|
14
|
-
expect(timespan.to_s(unit: :day)).to match_normalized("
|
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
|
31
|
-
453600 => "1 Woche",
|
32
|
-
1972307 => "3 Wochen",
|
33
|
-
1972308 => "1 Monat",
|
34
|
-
23667694 => "9
|
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
|
54
|
-
453600 => "5
|
55
|
-
1972307 => "3 Wochen",
|
56
|
-
1972308 => "3 Wochen",
|
57
|
-
23667694 => "9
|
58
|
-
23667695 => "9
|
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
|
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: '
|
93
|
-
month: '
|
94
|
-
week: '
|
95
|
-
day: '
|
96
|
-
hour: '
|
97
|
-
minute: '
|
98
|
-
second: '
|
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: '
|
112
|
-
month: '
|
113
|
-
week: '
|
114
|
-
day: '
|
115
|
-
hour: '
|
116
|
-
minute: '
|
117
|
-
second: '
|
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
|
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.
|
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-
|
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
|
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
|
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.
|
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
|