twitter_cldr 6.8.0 → 6.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -28
  3. data/lib/twitter_cldr/resources/calendars_importer.rb +48 -46
  4. data/lib/twitter_cldr/resources/cldr_data_builder.rb +36 -0
  5. data/lib/twitter_cldr/resources/cldr_document_set.rb +157 -0
  6. data/lib/twitter_cldr/resources/cldr_dtd.rb +110 -0
  7. data/lib/twitter_cldr/resources/cldr_locale.rb +78 -0
  8. data/lib/twitter_cldr/resources/list_formats_importer.rb +1 -1
  9. data/lib/twitter_cldr/resources/loader.rb +18 -1
  10. data/lib/twitter_cldr/resources/number_formats_importer.rb +1 -1
  11. data/lib/twitter_cldr/resources/readme_renderer.rb +6 -2
  12. data/lib/twitter_cldr/resources/requirements/cldr_requirement.rb +12 -61
  13. data/lib/twitter_cldr/resources/territories_importer.rb +1 -1
  14. data/lib/twitter_cldr/resources/timezones_importer.rb +1 -1
  15. data/lib/twitter_cldr/resources/unicode_property_aliases_importer.rb +2 -0
  16. data/lib/twitter_cldr/resources/units_importer.rb +1 -1
  17. data/lib/twitter_cldr/resources.rb +8 -3
  18. data/lib/twitter_cldr/shared/calendar.rb +1 -1
  19. data/lib/twitter_cldr/timezones/generic_location.rb +15 -15
  20. data/lib/twitter_cldr/timezones/gmt_location.rb +2 -2
  21. data/lib/twitter_cldr/timezones/iso8601_location.rb +2 -2
  22. data/lib/twitter_cldr/timezones/timezone.rb +11 -7
  23. data/lib/twitter_cldr/version.rb +1 -1
  24. data/resources/locales/ar/calendars.yml +2 -1
  25. data/resources/locales/az/calendars.yml +2 -1
  26. data/resources/locales/be/calendars.yml +2 -1
  27. data/resources/locales/bg/calendars.yml +2 -1
  28. data/resources/locales/bn/calendars.yml +2 -1
  29. data/resources/locales/bo/calendars.yml +68 -36
  30. data/resources/locales/bs/calendars.yml +1 -0
  31. data/resources/locales/cy/calendars.yml +1 -0
  32. data/resources/locales/el/calendars.yml +2 -1
  33. data/resources/locales/en/calendars.yml +75 -54
  34. data/resources/locales/en-001/calendars.yml +65 -53
  35. data/resources/locales/en-150/calendars.yml +65 -53
  36. data/resources/locales/en-AU/calendars.yml +4 -0
  37. data/resources/locales/en-CA/calendars.yml +66 -58
  38. data/resources/locales/en-GB/calendars.yml +7 -0
  39. data/resources/locales/en-IE/calendars.yml +65 -53
  40. data/resources/locales/en-IN/calendars.yml +65 -53
  41. data/resources/locales/en-NZ/calendars.yml +65 -53
  42. data/resources/locales/en-SG/calendars.yml +65 -53
  43. data/resources/locales/en-US/calendars.yml +75 -54
  44. data/resources/locales/en-ZA/calendars.yml +65 -53
  45. data/resources/locales/eo/calendars.yml +88 -61
  46. data/resources/locales/es/calendars.yml +2 -1
  47. data/resources/locales/es-419/calendars.yml +2 -1
  48. data/resources/locales/es-AR/calendars.yml +2 -1
  49. data/resources/locales/es-CO/calendars.yml +2 -1
  50. data/resources/locales/es-MX/calendars.yml +2 -1
  51. data/resources/locales/es-US/calendars.yml +2 -1
  52. data/resources/locales/fil/calendars.yml +4 -3
  53. data/resources/locales/ga/calendars.yml +4 -4
  54. data/resources/locales/gl/calendars.yml +2 -1
  55. data/resources/locales/hi/calendars.yml +2 -1
  56. data/resources/locales/hy/calendars.yml +4 -3
  57. data/resources/locales/ka/calendars.yml +2 -1
  58. data/resources/locales/kk/calendars.yml +2 -1
  59. data/resources/locales/km/calendars.yml +2 -1
  60. data/resources/locales/kn/calendars.yml +2 -1
  61. data/resources/locales/ko/calendars.yml +2 -1
  62. data/resources/locales/lo/calendars.yml +2 -1
  63. data/resources/locales/mk/calendars.yml +1 -1
  64. data/resources/locales/mr/calendars.yml +2 -1
  65. data/resources/locales/mt/calendars.yml +2 -1
  66. data/resources/locales/my/calendars.yml +2 -1
  67. data/resources/locales/pl/calendars.yml +2 -1
  68. data/resources/locales/pt/calendars.yml +35 -34
  69. data/resources/locales/pt-PT/calendars.yml +21 -20
  70. data/resources/locales/ru/calendars.yml +7 -7
  71. data/resources/locales/sk/calendars.yml +2 -1
  72. data/resources/locales/sl/calendars.yml +2 -1
  73. data/resources/locales/sr/calendars.yml +2 -0
  74. data/resources/locales/sr-Cyrl-ME/calendars.yml +3 -1
  75. data/resources/locales/sr-Latn-ME/calendars.yml +3 -1
  76. data/resources/locales/sw/calendars.yml +2 -1
  77. data/resources/locales/ta/calendars.yml +2 -1
  78. data/resources/locales/th/calendars.yml +1 -0
  79. data/resources/locales/tr/calendars.yml +2 -1
  80. data/resources/locales/ur/calendars.yml +2 -1
  81. data/resources/locales/xh/calendars.yml +46 -15
  82. data/resources/locales/zh-Hant/calendars.yml +4 -4
  83. data/resources/locales/zu/calendars.yml +3 -1
  84. data/spec/formatters/calendars/datetime_formatter_spec.rb +2 -2
  85. data/spec/localized/localized_array_spec.rb +3 -1
  86. data/spec/localized/localized_hash_spec.rb +1 -1
  87. data/spec/shared/calendar_spec.rb +25 -8
  88. data/spec/timezones/timezone_spec.rb +41 -0
  89. data/spec/utils/yaml/yaml_spec.rb +2 -3
  90. metadata +7 -3
@@ -126,7 +126,8 @@
126
126
  0: BCE
127
127
  1: CE
128
128
  :narrow:
129
- 0: ""
129
+ 0: BCE
130
+ 1: CE
130
131
  :fields:
131
132
  :day: Usuku
132
133
  :day-narrow: Usuku
@@ -166,6 +167,7 @@
166
167
  :weekday-short: "Usuku evikini"
167
168
  :weekdayOfMonth: "usuku lwenyanga"
168
169
  :weekdayOfMonth-narrow: "usuku lwenyanga"
170
+ :weekdayOfMonth-short: "usuku lwenyanga"
169
171
  :year: Unyaka
170
172
  :year-narrow: Unyaka
171
173
  :year-short: Unyaka
@@ -444,8 +444,8 @@ describe TwitterCldr::Formatters::DateTimeFormatter do
444
444
  end
445
445
 
446
446
  it "pattern LLL" do
447
- expect(@formatter.send(:month_stand_alone, Date.new(2010, 1, 1), 'LLL', 3)).to eq("Jan")
448
- expect(@formatter.send(:month_stand_alone, Date.new(2010, 10, 1), 'LLL', 3)).to eq("Okt")
447
+ expect(@formatter.send(:month_stand_alone, Date.new(2010, 1, 1), 'LLL', 3)).to eq("Jan.")
448
+ expect(@formatter.send(:month_stand_alone, Date.new(2010, 10, 1), 'LLL', 3)).to eq("Okt.")
449
449
  end
450
450
 
451
451
  it "pattern LLLL" do
@@ -69,7 +69,9 @@ describe TwitterCldr::Localized::LocalizedArray do
69
69
  describe "#to_yaml" do
70
70
  it "should be able to successfully roundtrip the array" do
71
71
  arr = [:foo, "bar", Object.new]
72
- result = YAML.load(arr.localize.to_yaml)
72
+ result = TwitterCldr::Resources::Loader.load_yaml(
73
+ arr.localize.to_yaml, permitted_classes: [Object, Symbol]
74
+ )
73
75
 
74
76
  expect(result[0]).to eq(:foo)
75
77
  expect(result[1]).to eq("bar")
@@ -9,7 +9,7 @@ describe TwitterCldr::Localized::LocalizedHash do
9
9
  describe "#to_yaml" do
10
10
  it "should be able to successfully roundtrip the hash" do
11
11
  hash = { foo: "bar", "string_key" => Object.new }
12
- result = YAML.load(hash.localize.to_yaml)
12
+ result = TwitterCldr::Resources::Loader.load_yaml(hash.localize.to_yaml, permitted_classes: [Object, Symbol])
13
13
 
14
14
  expect(result).to include(:foo)
15
15
  expect(result).to include("string_key")
@@ -13,6 +13,7 @@ describe TwitterCldr::Shared::Calendar do
13
13
  # clear cache for each test
14
14
  described_class.send(:class_variable_set, :@@calendar_cache, {})
15
15
  described_class.send(:class_variable_set, :@@field_cache, {})
16
+ described_class.send(:class_variable_set, :@@day_periods_cache, {})
16
17
  end
17
18
 
18
19
  before(:each) { clear_cache }
@@ -56,12 +57,28 @@ describe TwitterCldr::Shared::Calendar do
56
57
  end
57
58
 
58
59
  it 'supports abbreviated names form' do
59
- expect(calendar.months(:abbreviated)).to eq(%w[Jan Feb Mär Apr Mai Jun Jul Aug Sep Okt Nov Dez])
60
+ expect(calendar.months(:abbreviated)).to eq(%w[Jan. Feb. März Apr. Mai Juni Juli Aug. Sept. Okt. Nov. Dez.])
60
61
  end
61
62
 
62
63
  it 'returns nil if invalid names form is passed' do
63
64
  expect(calendar.months(:wat)).to eq(nil)
64
65
  end
66
+
67
+ context 'with English locale' do
68
+ let(:calendar) { described_class.new(:en) }
69
+
70
+ it 'supports wide names form' do
71
+ expect(calendar.months(:wide)).to eq(%w[January February March April May June July August September October November December])
72
+ end
73
+
74
+ it 'supports narrow names form' do
75
+ expect(calendar.months(:narrow)).to eq(%w[J F M A M J J A S O N D])
76
+ end
77
+
78
+ it 'supports abbreviated names form' do
79
+ expect(calendar.months(:abbreviated)).to eq(%w[Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec])
80
+ end
81
+ end
65
82
  end
66
83
 
67
84
  context 'when some data is missing' do
@@ -109,13 +126,13 @@ describe TwitterCldr::Shared::Calendar do
109
126
 
110
127
  it 'supports abbreviated names form' do
111
128
  expect(calendar.weekdays(:abbreviated)).to eq({
112
- sun: 'So',
113
- mon: 'Mo',
114
- tue: 'Di',
115
- wed: 'Mi',
116
- thu: 'Do',
117
- fri: 'Fr',
118
- sat: 'Sa'
129
+ sun: 'So.',
130
+ mon: 'Mo.',
131
+ tue: 'Di.',
132
+ wed: 'Mi.',
133
+ thu: 'Do.',
134
+ fri: 'Fr.',
135
+ sat: 'Sa.'
119
136
  })
120
137
  end
121
138
 
@@ -266,4 +266,45 @@ describe 'Timezones' do
266
266
  end
267
267
  end
268
268
  end
269
+
270
+ describe '#display_name_for' do
271
+ let(:tz) { TwitterCldr::Timezones::Timezone.instance('America/New_York', :en) }
272
+
273
+ it 'accepts a dst argument', :aggregate_failures do
274
+ zoned_date = Time.new(2021, 11, 7, 1, 1, 23, -4 * 3600)
275
+ dst_date = Time.new(2021, 11, 7, 1, 1, 23, 0)
276
+ non_dst_date = Time.new(2021, 11, 7, 12, 1, 23, 0)
277
+
278
+ expect(tz.display_name_for(zoned_date, :specific_long, true)).to eq 'Eastern Daylight Time'
279
+ expect(tz.display_name_for(dst_date, :specific_long, true)).to eq 'Eastern Daylight Time'
280
+ expect(tz.display_name_for(non_dst_date, :specific_long, false)).to eq 'Eastern Standard Time'
281
+ expect(tz.display_name_for(zoned_date, :iso_extended_local_full, true)).to eq '-04:00'
282
+ expect(tz.display_name_for(dst_date, :iso_extended_local_full, true)).to eq '-04:00'
283
+ expect(tz.display_name_for(non_dst_date, :iso_extended_local_full, false)).to eq '-05:00'
284
+ end
285
+
286
+ it 'accepts a block to handle ambiguous times' do
287
+ # Known ambiguous time
288
+ time = Time.new(2021, 11, 7, 1, 1, 23, 0)
289
+
290
+ expect { tz.display_name_for(time, :generic_short) }.to raise_error(TZInfo::AmbiguousTime)
291
+ expect { tz.display_name_for(time, :generic_short, &:first) }.to_not raise_error
292
+ end
293
+ end
294
+
295
+ describe '#period_for_local' do
296
+ let(:tz) { TwitterCldr::Timezones::Timezone.instance('America/New_York', :en) }
297
+ # Known ambiguous time
298
+ let(:time) { Time.new(2021, 11, 7, 1, 1, 23, 0) }
299
+
300
+ it 'accepts a block to handle ambiguous times' do
301
+ expect { tz.period_for_local(time) }.to raise_error(TZInfo::AmbiguousTime)
302
+ expect { tz.period_for_local(time, &:first) }.to_not raise_error
303
+ end
304
+
305
+ it 'accepts a dst argument', :aggregate_failures do
306
+ expect(tz.period_for_local(time, false).dst?).to be false
307
+ expect(tz.period_for_local(time, true).dst?).to be true
308
+ end
309
+ end
269
310
  end
@@ -345,7 +345,6 @@ describe TwitterCldr::Utils do
345
345
  :foo,
346
346
  1..10,
347
347
  /abc\nxyz/i,
348
- @struct,
349
348
  @klass,
350
349
  ]
351
350
  s.force_encoding("BINARY") if s.respond_to? :force_encoding
@@ -373,7 +372,7 @@ describe TwitterCldr::Utils do
373
372
  obj
374
373
  end
375
374
  y = TwitterCldr::Utils::YAML.dump(src, syck_compatible: true)
376
- r = YAML.load(y)
375
+ r = TwitterCldr::Resources::Loader.load_yaml(y, permitted_classes: [Date, Moo, Range, Regexp, Symbol, Time])
377
376
  expect(src).to eq(r)
378
377
  end
379
378
  end
@@ -402,7 +401,7 @@ describe TwitterCldr::Utils do
402
401
  {1=>-2, -1=>@gif, '_foo'=>'bar', 'ぬお-ぬお'=>321},
403
402
  ].each do |src|
404
403
  y = TwitterCldr::Utils::YAML.dump(src, syck_compatible: true)
405
- r = YAML.load(y)
404
+ r = TwitterCldr::Resources::Loader.load_yaml(y, permitted_classes: [Date, Range, Symbol, Time])
406
405
  expect(src).to eq(r)
407
406
  end
408
407
  end
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: 6.8.0
4
+ version: 6.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-11 00:00:00.000000000 Z
11
+ date: 2022-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: camertron-eprun
@@ -138,6 +138,10 @@ files:
138
138
  - lib/twitter_cldr/resources/calendars_importer.rb
139
139
  - lib/twitter_cldr/resources/casefolder.rb.erb
140
140
  - lib/twitter_cldr/resources/casefolder_class_generator.rb
141
+ - lib/twitter_cldr/resources/cldr_data_builder.rb
142
+ - lib/twitter_cldr/resources/cldr_document_set.rb
143
+ - lib/twitter_cldr/resources/cldr_dtd.rb
144
+ - lib/twitter_cldr/resources/cldr_locale.rb
141
145
  - lib/twitter_cldr/resources/collation_tests_importer.rb
142
146
  - lib/twitter_cldr/resources/collation_tries_importer.rb
143
147
  - lib/twitter_cldr/resources/currency_symbols_importer.rb
@@ -3998,7 +4002,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
3998
4002
  - !ruby/object:Gem::Version
3999
4003
  version: '0'
4000
4004
  requirements: []
4001
- rubygems_version: 3.2.22
4005
+ rubygems_version: 3.3.3
4002
4006
  signing_key:
4003
4007
  specification_version: 4
4004
4008
  summary: Ruby implementation of the ICU (International Components for Unicode) that