worldwide 1.14.3 → 1.14.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/Gemfile.lock +1 -1
- data/data/cldr/paths.txt +4582 -0
- data/data/other/paths.txt +1529 -0
- data/data/regions/BV.yml +1 -1
- data/data/regions/FI.yml +1 -1
- data/data/regions/paths.txt +1980 -0
- data/lib/worldwide/cldr/fallbacks.rb +15 -1
- data/lib/worldwide/config.rb +3 -3
- data/lib/worldwide/paths.rb +6 -0
- data/lib/worldwide/version.rb +1 -1
- metadata +5 -2
@@ -16,7 +16,8 @@ module Worldwide
|
|
16
16
|
|
17
17
|
def descendants(locale)
|
18
18
|
compute_all_ancestors
|
19
|
-
|
19
|
+
compute_all_descendants
|
20
|
+
@all_descendants[locale.to_sym] || []
|
20
21
|
end
|
21
22
|
|
22
23
|
def defined_parent_locales
|
@@ -57,6 +58,19 @@ module Worldwide
|
|
57
58
|
|
58
59
|
@all_ancestors_computed = true
|
59
60
|
end
|
61
|
+
|
62
|
+
def compute_all_descendants
|
63
|
+
return if @all_descendants
|
64
|
+
|
65
|
+
@all_descendants = {}
|
66
|
+
|
67
|
+
each do |locale, ancestors|
|
68
|
+
ancestors.each do |ancestor|
|
69
|
+
@all_descendants[ancestor] ||= []
|
70
|
+
@all_descendants[ancestor] << locale
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
60
74
|
end
|
61
75
|
end
|
62
76
|
end
|
data/lib/worldwide/config.rb
CHANGED
@@ -106,7 +106,7 @@ module Worldwide
|
|
106
106
|
end
|
107
107
|
|
108
108
|
def cldr_locale_paths(locale_set, components)
|
109
|
-
|
109
|
+
Paths::CLDR_LOCALE_PATHS.select do |path|
|
110
110
|
match = path.match(CLDR_LOCALE_PATH_REGEX)
|
111
111
|
match && locale_set.include?(match[:locale]) && components.include?(match[:component])
|
112
112
|
end
|
@@ -119,14 +119,14 @@ module Worldwide
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def other_data_path(locale_set)
|
122
|
-
|
122
|
+
Paths::OTHER_DATA_PATHS.select do |path|
|
123
123
|
match = path.match(OTHER_LOCALE_PATH_REGEX)
|
124
124
|
match && locale_set.include?(match[:locale])
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
128
|
def regions_data_path(locale_set)
|
129
|
-
|
129
|
+
Paths::REGION_DATA_PATHS.select do |path|
|
130
130
|
match = path.match(REGIONS_LOCALE_PATH_REGEX)
|
131
131
|
match && locale_set.include?(match[:locale])
|
132
132
|
end
|
data/lib/worldwide/paths.rb
CHANGED
@@ -5,10 +5,16 @@ module Worldwide
|
|
5
5
|
GEM_ROOT = File.expand_path(File.join(__dir__, "../.."))
|
6
6
|
DATA_ROOT = File.join(GEM_ROOT, "data")
|
7
7
|
CLDR_ROOT = File.join(GEM_ROOT, "data/cldr")
|
8
|
+
CLDR_LOCALE_PATHS_FILE = File.join(CLDR_ROOT, "paths.txt")
|
9
|
+
CLDR_LOCALE_PATHS = File.read(CLDR_LOCALE_PATHS_FILE).lines.map { |path| File.join(GEM_ROOT, path.strip) }
|
8
10
|
OTHER_DATA_ROOT = File.join(GEM_ROOT, "data/other")
|
11
|
+
OTHER_DATA_PATHS_FILE = File.join(OTHER_DATA_ROOT, "paths.txt")
|
12
|
+
OTHER_DATA_PATHS = File.read(OTHER_DATA_PATHS_FILE).lines.map { |path| File.join(GEM_ROOT, path.strip) }
|
9
13
|
CURRENCY_MAPPINGS = File.join(OTHER_DATA_ROOT, "currency/mappings")
|
10
14
|
GENERATED_LOCALE_ROOT = File.join(OTHER_DATA_ROOT, "generated")
|
11
15
|
REGIONS_ROOT = File.join(DATA_ROOT, "regions")
|
16
|
+
REGION_DATA_PATHS_FILE = File.join(REGIONS_ROOT, "paths.txt")
|
17
|
+
REGION_DATA_PATHS = File.read(REGION_DATA_PATHS_FILE).lines.map { |path| File.join(GEM_ROOT, path.strip) }
|
12
18
|
TIME_ZONE_ROOT = File.join(OTHER_DATA_ROOT, "timezones")
|
13
19
|
end
|
14
20
|
end
|
data/lib/worldwide/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: worldwide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -4671,6 +4671,7 @@ files:
|
|
4671
4671
|
- data/cldr/metazones.yml
|
4672
4672
|
- data/cldr/numbering_systems.yml
|
4673
4673
|
- data/cldr/parent_locales.yml
|
4674
|
+
- data/cldr/paths.txt
|
4674
4675
|
- data/cldr/rbnf_root.yml
|
4675
4676
|
- data/cldr/region_currencies.yml
|
4676
4677
|
- data/cldr/region_validity.yml
|
@@ -6119,6 +6120,7 @@ files:
|
|
6119
6120
|
- data/other/names/vi.yml
|
6120
6121
|
- data/other/names/zh-CN.yml
|
6121
6122
|
- data/other/names/zh-TW.yml
|
6123
|
+
- data/other/paths.txt
|
6122
6124
|
- data/other/territories/bg.yml
|
6123
6125
|
- data/other/territories/cs.yml
|
6124
6126
|
- data/other/territories/da.yml
|
@@ -8438,6 +8440,7 @@ files:
|
|
8438
8440
|
- data/regions/_default/vi.yml
|
8439
8441
|
- data/regions/_default/zh-CN.yml
|
8440
8442
|
- data/regions/_default/zh-TW.yml
|
8443
|
+
- data/regions/paths.txt
|
8441
8444
|
- data/top_locales.yml
|
8442
8445
|
- data/world.yml
|
8443
8446
|
- docs/address_format_strings.md
|