Skip to content

Commit 8e522a1

Browse files
committed
Upgrade to CLDR v46, Unicode v16
1 parent 29758ac commit 8e522a1

File tree

1,678 files changed

+233320
-209984
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,678 files changed

+233320
-209984
lines changed

.github/workflows/unit_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
runs-on: ubuntu-latest
66
strategy:
77
matrix:
8-
ruby-version: [2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2]
8+
ruby-version: [2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4]
99
steps:
1010
- uses: actions/checkout@v2
1111
- name: Set up Ruby ${{ matrix.ruby-version }}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions

Gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ gemspec
44

55
group :development, :test do
66
gem 'rake'
7-
gem 'pry-byebug' unless RUBY_PLATFORM == 'java'
87
gem 'ruby-prof' unless RUBY_PLATFORM == 'java'
98
gem 'regexp_parser', '~> 0.5'
109
gem 'benchmark-ips'
@@ -13,7 +12,7 @@ group :development, :test do
1312
# gemspec allows any version, but most people are probably using 1.x, so
1413
# let's test and develop against that
1514
gem 'tzinfo', '< 2'
16-
gem 'tzinfo-data', '= 1.2023.3' # try to keep in sync with ICU
15+
gem 'tzinfo-data', '= 1.2024.2' # try to keep in sync with ICU
1716
end
1817

1918
group :development do

README.md

Lines changed: 12 additions & 12 deletions

README.md.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ TwitterCldr patches core Ruby objects like `Integer` and `Date` to make localiza
4040
1337.localize(:es).to_s # <%= assert(1337.localize(:es).to_s, "1.337").inspect %>
4141

4242
# currencies, default USD
43-
1337.localize(:es).to_currency.to_s # <%= assert(1337.localize(:es).to_currency.to_s, "1.337,00 $").inspect %>
43+
1337.localize(:es).to_currency.to_s # <%= assert(1337.localize(:es).to_currency.to_s, "1.337,00 US$").inspect %>
4444
1337.localize(:es).to_currency.to_s(:currency => "EUR") # <%= assert(1337.localize(:es).to_currency.to_s(:currency => "EUR"), "1.337,00 €").inspect %>
4545

4646
# percentages
@@ -60,7 +60,7 @@ num = TwitterCldr::Localized::LocalizedNumber.new(1337, :es)
6060
num.to_currency.to_s # ...etc
6161
```
6262

63-
<% assert(TwitterCldr::Localized::LocalizedNumber.new(1337, :es).to_currency.to_s, "1.337,00 $") %>
63+
<% assert(TwitterCldr::Localized::LocalizedNumber.new(1337, :es).to_currency.to_s, "1.337,00 US$") %>
6464

6565
#### More on Currencies
6666

@@ -71,7 +71,7 @@ If you're looking for a list of supported currencies, use the `TwitterCldr::Shar
7171
TwitterCldr::Shared::Currencies.currency_codes # <%= ellipsize(assert(TwitterCldr::Shared::Currencies.currency_codes.sort[0..3], ["ADP", "AED", "AFA", "AFN"])) %>
7272

7373
# data for a specific currency code
74-
TwitterCldr::Shared::Currencies.for_code("CAD") # <%= assert(TwitterCldr::Shared::Currencies.for_code("CAD"), {:currency=>:CAD, :name=>"Canadian Dollar", :cldr_symbol=>"CA$", :symbol=>"$", :code_points=>[36]}).inspect %>
74+
TwitterCldr::Shared::Currencies.for_code("CAD") # <%= assert(TwitterCldr::Shared::Currencies.for_code("CAD"), {:currency=>:CAD, :name=>"Canadian Dollar", :cldr_symbol=>"CA$", :symbol=>"CA$", :code_points=>[67, 65, 36]}).inspect %>
7575
```
7676

7777
#### Short / Long Decimals
@@ -92,7 +92,7 @@ TwitterCLDR supports formatting numbers with an attached unit, for example "12 d
9292

9393
```ruby
9494
12.localize.to_unit.length_mile # <%= assert(12.localize.to_unit.length_mile, "12 miles").inspect %>
95-
12.localize(:ru).to_unit.length_mile # <%= assert(12.localize(:ru).to_unit.length_mile, "12 миль").inspect %>
95+
12.localize(:ru).to_unit.length_mile # <%= assert(12.localize(:ru).to_unit.length_mile, "12 милях").inspect %>
9696
```
9797
Units support a few different forms, long, short, and narrow:
9898

Rakefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ require 'rubygems/package_task'
1313

1414
require './lib/twitter_cldr'
1515

16-
require 'pry-byebug' unless RUBY_PLATFORM == 'java'
17-
1816
Bundler::GemHelper.install_tasks
1917

2018
task default: :spec

lib/twitter_cldr/resources/calendars_importer.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,8 @@ def formats(type)
175175
def additional_formats
176176
return {} unless calendar
177177

178-
dtd.find_attr('dateFormatItem', 'id').values.each_with_object({}) do |id, result|
179-
node = calendar.xpath("dateTimeFormats/availableFormats/dateFormatItem[@id='#{id}']").first
180-
result[id] = node.content if node
178+
calendar.xpath("dateTimeFormats/availableFormats/dateFormatItem").each_with_object({}) do |date_format_item, result|
179+
result[date_format_item.attribute("id").value] = date_format_item.content
181180
end
182181
end
183182

lib/twitter_cldr/resources/rbnf_test_importer.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,11 @@ def clean_up_name(name)
8282
end
8383

8484
def import_ruleset(locale, formatter, ruleset_name)
85-
test_numbers_for(locale).each_with_object({}) do |num, ret|
85+
TEST_NUMBERS.each_with_object({}) do |num, ret|
8686
ret[num] = formatter.format(num, ruleset_name)
8787
end
8888
end
8989

90-
def test_numbers_for(locale)
91-
# for some reason, russian doesn't support large numbers
92-
if locale.to_s == 'ru'
93-
TEST_NUMBERS - [138_400]
94-
else
95-
TEST_NUMBERS
96-
end
97-
end
98-
9990
def output_file_for(locale)
10091
File.join(params.fetch(:output_path), locale, 'rbnf_test.yml')
10192
end

lib/twitter_cldr/resources/timezone_tests_importer.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ def generate_test_cases_for_locale(locale)
8585
ulocale = ulocale_class.new(locale.to_s)
8686

8787
TZInfo::Timezone.all_identifiers.each_with_object({}) do |tz_id, ret|
88+
next if tz_id == 'Factory'
89+
8890
tz = tz_class.getTimeZone(tz_id)
8991
offset = tz.getRawOffset
9092

lib/twitter_cldr/resources/timezones_importer.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def timezones
130130
short = nodes_to_hash(zone.xpath('short/*'))
131131
result[type][:short] = short unless short.empty?
132132
city = zone.xpath('exemplarCity').first
133-
if city && !unconfirmed_draft?(city)
133+
if city && !unconfirmed_draft?(city) && !secondary?(city)
134134
result[type][:city] = city.content
135135
end
136136
result
@@ -165,6 +165,12 @@ def unconfirmed_draft?(node)
165165
node.attributes['draft'].value == 'unconfirmed'
166166
end
167167

168+
def secondary?(node)
169+
node &&
170+
node.attributes['alt'] &&
171+
node.attributes['alt'].value == 'secondary'
172+
end
173+
168174
def doc
169175
@doc ||= begin
170176
locale_fs = locale.to_s.gsub('-', '_')

0 commit comments

Comments
 (0)