en16931 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/Rakefile +19 -0
- data/data/LICENSE-CLDR.txt +41 -0
- data/data/countries.yml +4632 -0
- data/lib/en16931/pdf/labels.rb +3 -0
- data/lib/en16931/pdf/renderer.rb +1 -4
- data/lib/en16931/pdf.rb +1 -0
- data/lib/en16931/version.rb +1 -1
- metadata +3 -1
data/lib/en16931/pdf/labels.rb
CHANGED
|
@@ -166,6 +166,9 @@ module EN16931
|
|
|
166
166
|
|
|
167
167
|
# A supported locale as a symbol; anything unknown falls back to German.
|
|
168
168
|
def self.locale(value) = LABELS.key?(value&.to_sym) ? value.to_sym : :de
|
|
169
|
+
|
|
170
|
+
# Country names per locale from CLDR, see `rake countries`.
|
|
171
|
+
def self.countries = @countries ||= YAML.load_file(File.join(ROOT, "data", "countries.yml"))
|
|
169
172
|
end
|
|
170
173
|
end
|
|
171
174
|
end
|
data/lib/en16931/pdf/renderer.rb
CHANGED
|
@@ -255,10 +255,7 @@ module EN16931
|
|
|
255
255
|
def date(d) = d.strftime(FORMATS.fetch(locale)[2])
|
|
256
256
|
def unit(code) = LABELS.fetch(locale)[:units].fetch(code, code)
|
|
257
257
|
|
|
258
|
-
def country_name(code)
|
|
259
|
-
{ "DE" => "Deutschland", "AT" => "Österreich", "CH" => "Schweiz", "FR" => "Frankreich", "NL" => "Niederlande",
|
|
260
|
-
"US" => "USA", "GB" => "Vereinigtes Königreich", "IE" => "Irland", "LU" => "Luxemburg" }.fetch(code, code)
|
|
261
|
-
end
|
|
258
|
+
def country_name(code) = Renderer.countries.fetch(locale.to_s).fetch(code, code)
|
|
262
259
|
end
|
|
263
260
|
end
|
|
264
261
|
end
|
data/lib/en16931/pdf.rb
CHANGED
data/lib/en16931/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: en16931
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Markus Schwed
|
|
@@ -93,6 +93,8 @@ files:
|
|
|
93
93
|
- LICENSE.txt
|
|
94
94
|
- README.md
|
|
95
95
|
- Rakefile
|
|
96
|
+
- data/LICENSE-CLDR.txt
|
|
97
|
+
- data/countries.yml
|
|
96
98
|
- fonts/DejaVuSans-Bold.ttf
|
|
97
99
|
- fonts/DejaVuSans.ttf
|
|
98
100
|
- fonts/LICENSE-DejaVu.txt
|