bcp47 0.3.0 → 0.3.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.
- data/Gemfile +2 -0
- data/Gemfile.lock +2 -0
- data/VERSION +1 -1
- data/bcp47.gemspec +3 -2
- data/data/iso-3166-1.yml +139 -385
- data/data/iso-639-1.yml +0 -188
- data/lib/bcp47.rb +4 -0
- data/lib/bcp47/language.rb +5 -0
- data/lib/bcp47/region.rb +5 -0
- data/lib/bcp47/subtag.rb +15 -3
- data/locales/en.yml +435 -0
- data/spec/lib/bcp47/language_spec.rb +2 -2
- data/spec/lib/bcp47/region_spec.rb +2 -2
- data/spec/lib/bcp47/subtag_spec.rb +19 -10
- metadata +16 -15
data/lib/bcp47.rb
CHANGED
data/lib/bcp47/language.rb
CHANGED
data/lib/bcp47/region.rb
CHANGED
data/lib/bcp47/subtag.rb
CHANGED
@@ -1,10 +1,17 @@
|
|
1
1
|
module BCP47
|
2
2
|
class Subtag
|
3
|
-
attr_reader :code
|
3
|
+
attr_reader :code
|
4
4
|
|
5
5
|
def initialize(code, options={})
|
6
6
|
@code = code
|
7
|
-
|
7
|
+
end
|
8
|
+
|
9
|
+
def ==(object)
|
10
|
+
code == object.code
|
11
|
+
end
|
12
|
+
|
13
|
+
def name
|
14
|
+
I18n.t(code, scope: i18n_scope)
|
8
15
|
end
|
9
16
|
|
10
17
|
def full_name
|
@@ -14,7 +21,7 @@ module BCP47
|
|
14
21
|
def self.all
|
15
22
|
YAML.load_file(self::DEFINITIONS_FILE).map do |code, options|
|
16
23
|
symbolized_options = {}
|
17
|
-
options.keys.each { |key| symbolized_options[key.to_sym] = options[key] }
|
24
|
+
options.keys.each { |key| symbolized_options[key.to_sym] = options[key] } if options
|
18
25
|
new(code, symbolized_options)
|
19
26
|
end
|
20
27
|
end
|
@@ -30,5 +37,10 @@ module BCP47
|
|
30
37
|
def self.codes
|
31
38
|
all.map(&:code)
|
32
39
|
end
|
40
|
+
|
41
|
+
private
|
42
|
+
def i18n_scope
|
43
|
+
%w(vendor bcp47).join('.')
|
44
|
+
end
|
33
45
|
end
|
34
46
|
end
|
data/locales/en.yml
ADDED
@@ -0,0 +1,435 @@
|
|
1
|
+
en:
|
2
|
+
vendor:
|
3
|
+
bcp47:
|
4
|
+
languages:
|
5
|
+
aa: Afar
|
6
|
+
ab: Abkhazian
|
7
|
+
ae: Avestan
|
8
|
+
af: Afrikaans
|
9
|
+
ak: Akan
|
10
|
+
am: Amharic
|
11
|
+
an: Aragonese
|
12
|
+
ar: Arabic
|
13
|
+
as: Assamese
|
14
|
+
av: Avaric
|
15
|
+
ay: Aymara
|
16
|
+
az: Azerbaijani
|
17
|
+
ba: Bashkir
|
18
|
+
be: Belarusian
|
19
|
+
bg: Bulgarian
|
20
|
+
bh: Bihari
|
21
|
+
bi: Bislama
|
22
|
+
bm: Bambara
|
23
|
+
bn: Bengali
|
24
|
+
bo: Tibetan
|
25
|
+
br: Breton
|
26
|
+
bs: Bosnian
|
27
|
+
ca: Catalan
|
28
|
+
ce: Chechen
|
29
|
+
ch: Chamorro
|
30
|
+
co: Corsican
|
31
|
+
cr: Cree
|
32
|
+
cs: Czech
|
33
|
+
cu: Church Slavic
|
34
|
+
cv: Chuvash
|
35
|
+
cy: Welsh
|
36
|
+
da: Danish
|
37
|
+
de: German
|
38
|
+
dv: Divehi
|
39
|
+
dz: Dzongkha
|
40
|
+
ee: Ewe
|
41
|
+
el: Greek
|
42
|
+
en: English
|
43
|
+
eo: Esperanto
|
44
|
+
es: Spanish
|
45
|
+
et: Estonian
|
46
|
+
eu: Basque
|
47
|
+
fa: Persian
|
48
|
+
ff: Fulah
|
49
|
+
fi: Finnish
|
50
|
+
fj: Fijian
|
51
|
+
fo: Faroese
|
52
|
+
fr: French
|
53
|
+
fy: Western Frisian
|
54
|
+
ga: Irish
|
55
|
+
gd: Gaelic
|
56
|
+
gl: Galician
|
57
|
+
gn: Guarani
|
58
|
+
gu: Gujarati
|
59
|
+
gv: Manx
|
60
|
+
ha: Hausa
|
61
|
+
he: Hebrew
|
62
|
+
hi: Hindi
|
63
|
+
ho: Hiri Motu
|
64
|
+
hr: Croatian
|
65
|
+
ht: Haitian
|
66
|
+
hu: Hungarian
|
67
|
+
hy: Armenian
|
68
|
+
hz: Herero
|
69
|
+
ia: Interlingua
|
70
|
+
id: Indonesian
|
71
|
+
ie: Interlingue
|
72
|
+
ig: Igbo
|
73
|
+
ii: Sichuan Yi
|
74
|
+
ik: Inupiaq
|
75
|
+
io: Ido
|
76
|
+
is: Icelandic
|
77
|
+
it: Italian
|
78
|
+
iu: Inuktitut
|
79
|
+
ja: Japanese
|
80
|
+
jv: Javanese
|
81
|
+
ka: Georgian
|
82
|
+
kg: Kongo
|
83
|
+
ki: Kikuyu
|
84
|
+
kj: Kuanyama
|
85
|
+
kk: Kazakh
|
86
|
+
kl: Kalaallisut
|
87
|
+
km: Central Khmer
|
88
|
+
kn: Kannada
|
89
|
+
ko: Korean
|
90
|
+
kr: Kanuri
|
91
|
+
ks: Kashmiri
|
92
|
+
ku: Kurdish
|
93
|
+
kv: Komi
|
94
|
+
kw: Cornish
|
95
|
+
ky: Kirghiz
|
96
|
+
la: Latin
|
97
|
+
lb: Luxembourgish
|
98
|
+
lg: Ganda
|
99
|
+
li: Limburgan
|
100
|
+
ln: Lingala
|
101
|
+
lo: Lao
|
102
|
+
lt: Lithuanian
|
103
|
+
lu: Luba-Katanga
|
104
|
+
lv: Latvian
|
105
|
+
mg: Malagasy
|
106
|
+
mh: Marshallese
|
107
|
+
mi: Maori
|
108
|
+
mk: Macedonian
|
109
|
+
ml: Malayalam
|
110
|
+
mn: Mongolian
|
111
|
+
mr: Marathi
|
112
|
+
ms: Malay
|
113
|
+
mt: Maltese
|
114
|
+
my: Burmese
|
115
|
+
na: Nauru
|
116
|
+
nb: Norwegian Bokmål
|
117
|
+
nd: North Ndebele
|
118
|
+
ne: Nepali
|
119
|
+
ng: Ndonga
|
120
|
+
nl: Dutch
|
121
|
+
nn: Norwegian Nynorsk
|
122
|
+
false: Norwegian
|
123
|
+
nr: South Ndebele
|
124
|
+
nv: Navajo
|
125
|
+
ny: Chichewa
|
126
|
+
oc: Occitan
|
127
|
+
oj: Ojibwa
|
128
|
+
om: Oromo
|
129
|
+
or: Oriya
|
130
|
+
os: Ossetian
|
131
|
+
pa: Panjabi
|
132
|
+
pi: Pali
|
133
|
+
pl: Polish
|
134
|
+
ps: Pushto
|
135
|
+
pt: Portuguese
|
136
|
+
qu: Quechua
|
137
|
+
rm: Romansh
|
138
|
+
rn: Rundi
|
139
|
+
ro: Romanian
|
140
|
+
ru: Russian
|
141
|
+
rw: Kinyarwanda
|
142
|
+
sa: Sanskrit
|
143
|
+
sc: Sardinian
|
144
|
+
sd: Sindhi
|
145
|
+
se: Northern Sami
|
146
|
+
sg: Sango
|
147
|
+
si: Sinhala
|
148
|
+
sk: Slovak
|
149
|
+
sl: Slovenian
|
150
|
+
sm: Samoan
|
151
|
+
sn: Shona
|
152
|
+
so: Somali
|
153
|
+
sq: Albanian
|
154
|
+
sr: Serbian
|
155
|
+
ss: Swati
|
156
|
+
st: Sotho, Southern
|
157
|
+
su: Sundanese
|
158
|
+
sv: Swedish
|
159
|
+
sw: Swahili
|
160
|
+
ta: Tamil
|
161
|
+
te: Telugu
|
162
|
+
tg: Tajik
|
163
|
+
th: Thai
|
164
|
+
ti: Tigrinya
|
165
|
+
tk: Turkmen
|
166
|
+
tl: Tagalog
|
167
|
+
tn: Tswana
|
168
|
+
to: Tonga
|
169
|
+
tr: Turkish
|
170
|
+
ts: Tsonga
|
171
|
+
tt: Tatar
|
172
|
+
tw: Twi
|
173
|
+
ty: Tahitian
|
174
|
+
ug: Uighur
|
175
|
+
uk: Ukrainian
|
176
|
+
ur: Urdu
|
177
|
+
uz: Uzbek
|
178
|
+
ve: Venda
|
179
|
+
vo: Volapuk
|
180
|
+
vi: Vietnamese
|
181
|
+
wa: Walloon
|
182
|
+
wo: Wolof
|
183
|
+
xh: Xhosa
|
184
|
+
yi: Yiddish
|
185
|
+
yo: Yoruba
|
186
|
+
za: Zhuang
|
187
|
+
zh: Chinese
|
188
|
+
zu: Zulu
|
189
|
+
regions:
|
190
|
+
AF: Afghanistan
|
191
|
+
AX: Aland Islands
|
192
|
+
AL: Albania
|
193
|
+
DZ: Algeria
|
194
|
+
AS: American Samoa
|
195
|
+
AD: Andorra
|
196
|
+
AO: Angola
|
197
|
+
AI: Anguilla
|
198
|
+
AQ: Antarctica
|
199
|
+
AG: Antigua and Barbuda
|
200
|
+
AR: Argentina
|
201
|
+
AM: Armenia
|
202
|
+
AW: Aruba
|
203
|
+
AU: Australia
|
204
|
+
AT: Austria
|
205
|
+
AZ: Azerbaijan
|
206
|
+
BS: Bahamas
|
207
|
+
BH: Bahrain
|
208
|
+
BD: Bangladesh
|
209
|
+
BB: Barbados
|
210
|
+
BY: Belarus
|
211
|
+
BE: Belgium
|
212
|
+
BZ: Belize
|
213
|
+
BJ: Benin
|
214
|
+
BM: Bermuda
|
215
|
+
BT: Bhutan
|
216
|
+
BO: Bolivia
|
217
|
+
BA: Bosnia and Herzegovina
|
218
|
+
BW: Botswana
|
219
|
+
BV: Bouvet Island
|
220
|
+
BR: Brazil
|
221
|
+
IO: British Indian Ocean Territory
|
222
|
+
BN: Brunei Darussalam
|
223
|
+
BG: Bulgaria
|
224
|
+
BF: Burkina Faso
|
225
|
+
BI: Burundi
|
226
|
+
KH: Cambodia
|
227
|
+
CM: Cameroon
|
228
|
+
CA: Canada
|
229
|
+
CV: Cape Verde
|
230
|
+
KY: Cayman Islands
|
231
|
+
CF: Central African Republic
|
232
|
+
TD: Chad
|
233
|
+
CL: Chile
|
234
|
+
CN: China
|
235
|
+
CX: Christmas Island
|
236
|
+
CC: Cocos (Keeling) Islands
|
237
|
+
CO: Colombia
|
238
|
+
KM: Comoros
|
239
|
+
CD: Congo, the Democratic Republic of the
|
240
|
+
CG: Congo
|
241
|
+
CK: Cook Islands
|
242
|
+
CR: Costa Rica
|
243
|
+
CI: Cote D'Ivoire
|
244
|
+
HR: Croatia
|
245
|
+
CU: Cuba
|
246
|
+
CY: Cyprus
|
247
|
+
CZ: Czech Republic
|
248
|
+
DK: Denmark
|
249
|
+
DJ: Djibouti
|
250
|
+
DM: Dominica
|
251
|
+
DO: Dominican Republic
|
252
|
+
EC: Ecuador
|
253
|
+
EG: Egypt
|
254
|
+
SV: El Salvador
|
255
|
+
GQ: Equatorial Guinea
|
256
|
+
ER: Eritrea
|
257
|
+
EE: Estonia
|
258
|
+
ET: Ethiopia
|
259
|
+
FK: Falkland Islands (Malvinas)
|
260
|
+
FO: Faroe Islands
|
261
|
+
FJ: Fiji
|
262
|
+
FI: Finland
|
263
|
+
FR: France
|
264
|
+
GF: French Guiana
|
265
|
+
PF: French Polynesia
|
266
|
+
TF: French Southern Territories
|
267
|
+
GA: Gabon
|
268
|
+
GM: Gambia
|
269
|
+
GE: Georgia
|
270
|
+
DE: Germany
|
271
|
+
GH: Ghana
|
272
|
+
GI: Gibraltar
|
273
|
+
GR: Greece
|
274
|
+
GL: Greenland
|
275
|
+
GD: Grenada
|
276
|
+
GP: Guadeloupe
|
277
|
+
GU: Guam
|
278
|
+
GT: Guatemala
|
279
|
+
GG: Guernsey
|
280
|
+
GN: Guinea
|
281
|
+
GW: Guinea-Bissau
|
282
|
+
GY: Guyana
|
283
|
+
HT: Haiti
|
284
|
+
HM: Heard Island and Mcdonald Islands
|
285
|
+
HN: Honduras
|
286
|
+
HK: Hong Kong
|
287
|
+
HU: Hungary
|
288
|
+
IS: Iceland
|
289
|
+
IN: India
|
290
|
+
ID: Indonesia
|
291
|
+
IR: Iran (Islamic Republic of)
|
292
|
+
IQ: Iraq
|
293
|
+
IE: Ireland
|
294
|
+
IM: Isle of Man
|
295
|
+
IL: Israel
|
296
|
+
IT: Italy
|
297
|
+
JM: Jamaica
|
298
|
+
JP: Japan
|
299
|
+
JE: Jersey
|
300
|
+
JO: Jordan
|
301
|
+
KZ: Kazakhstan
|
302
|
+
KE: Kenya
|
303
|
+
KI: Kiribati
|
304
|
+
KP: Korea, Democratic People'S Republic of
|
305
|
+
KR: Korea, Republic of
|
306
|
+
KW: Kuwait
|
307
|
+
KG: Kyrgyzstan
|
308
|
+
LA: Lao People'S Democratic Republic
|
309
|
+
LV: Latvia
|
310
|
+
LB: Lebanon
|
311
|
+
LS: Lesotho
|
312
|
+
LR: Liberia
|
313
|
+
LY: Libyan Arab Jamahiriya
|
314
|
+
LI: Liechtenstein
|
315
|
+
LT: Lithuania
|
316
|
+
LU: Luxembourg
|
317
|
+
MO: Macao
|
318
|
+
MK: Macedonia, the Former Yugoslav Republic of
|
319
|
+
MG: Madagascar
|
320
|
+
MW: Malawi
|
321
|
+
MY: Malaysia
|
322
|
+
MV: Maldives
|
323
|
+
ML: Mali
|
324
|
+
MT: Malta
|
325
|
+
MH: Marshall Islands
|
326
|
+
MQ: Martinique
|
327
|
+
MR: Mauritania
|
328
|
+
MU: Mauritius
|
329
|
+
YT: Mayotte
|
330
|
+
MX: Mexico
|
331
|
+
FM: Micronesia, Federated States of
|
332
|
+
MD: Moldova, Republic of
|
333
|
+
MC: Monaco
|
334
|
+
MN: Mongolia
|
335
|
+
ME: Montenegro
|
336
|
+
MS: Montserrat
|
337
|
+
MA: Morocco
|
338
|
+
MZ: Mozambique
|
339
|
+
MM: Myanmar
|
340
|
+
NA: Namibia
|
341
|
+
NR: Nauru
|
342
|
+
NP: Nepal
|
343
|
+
NL: Netherlands
|
344
|
+
AN: Netherlands Antilles
|
345
|
+
NC: New Caledonia
|
346
|
+
NZ: New Zealand
|
347
|
+
NI: Nicaragua
|
348
|
+
NE: Niger
|
349
|
+
NG: Nigeria
|
350
|
+
NU: Niue
|
351
|
+
NF: Norfolk Island
|
352
|
+
MP: Northern Mariana Islands
|
353
|
+
NO: Norway
|
354
|
+
OM: Oman
|
355
|
+
PK: Pakistan
|
356
|
+
PW: Palau
|
357
|
+
PS: Palestinian Territory, Occupied
|
358
|
+
PA: Panama
|
359
|
+
PG: Papua New Guinea
|
360
|
+
PY: Paraguay
|
361
|
+
PE: Peru
|
362
|
+
PH: Philippines
|
363
|
+
PN: Pitcairn
|
364
|
+
PL: Poland
|
365
|
+
PT: Portugal
|
366
|
+
PR: Puerto Rico
|
367
|
+
QA: Qatar
|
368
|
+
RE: Reunion
|
369
|
+
RO: Romania
|
370
|
+
RU: Russian Federation
|
371
|
+
RW: Rwanda
|
372
|
+
BL: Saint Barthelemy
|
373
|
+
SH: Saint Helena
|
374
|
+
KN: Saint Kitts and Nevis
|
375
|
+
LC: Saint Lucia
|
376
|
+
MF: Saint Martin (French Part)
|
377
|
+
PM: Saint Pierre and Miquelon
|
378
|
+
VC: Saint Vincent and the Grenadines
|
379
|
+
WS: Samoa
|
380
|
+
SM: San Marino
|
381
|
+
ST: Sao Tome and Principe
|
382
|
+
SA: Saudi Arabia
|
383
|
+
SN: Senegal
|
384
|
+
RS: Serbia
|
385
|
+
SC: Seychelles
|
386
|
+
SL: Sierra Leone
|
387
|
+
SG: Singapore
|
388
|
+
SK: Slovakia
|
389
|
+
SI: Slovenia
|
390
|
+
SB: Solomon Islands
|
391
|
+
SO: Somalia
|
392
|
+
ZA: South Africa
|
393
|
+
GS: South Georgia and the South Sandwich Islands
|
394
|
+
ES: Spain
|
395
|
+
LK: Sri Lanka
|
396
|
+
SD: Sudan
|
397
|
+
SR: Suriname
|
398
|
+
SJ: Svalbard and Jan Mayen
|
399
|
+
SZ: Swaziland
|
400
|
+
SE: Sweden
|
401
|
+
CH: Switzerland
|
402
|
+
SY: Syrian Arab Republic
|
403
|
+
TW: Taiwan, Province of China
|
404
|
+
TJ: Tajikistan
|
405
|
+
TZ: Tanzania, United Republic of
|
406
|
+
TH: Thailand
|
407
|
+
TL: Timor-Leste
|
408
|
+
TG: Togo
|
409
|
+
TK: Tokelau
|
410
|
+
TO: Tonga
|
411
|
+
TT: Trinidad and Tobago
|
412
|
+
TN: Tunisia
|
413
|
+
TR: Turkey
|
414
|
+
TM: Turkmenistan
|
415
|
+
TC: Turks and Caicos Islands
|
416
|
+
TV: Tuvalu
|
417
|
+
UG: Uganda
|
418
|
+
UA: Ukraine
|
419
|
+
AE: United Arab Emirates
|
420
|
+
GB: United Kingdom
|
421
|
+
US: United States
|
422
|
+
UM: United States Minor Outlying Islands
|
423
|
+
UY: Uruguay
|
424
|
+
UZ: Uzbekistan
|
425
|
+
VU: Vanuatu
|
426
|
+
VA: Vatican City State (Holy See)
|
427
|
+
VE: Venezuela
|
428
|
+
VN: Viet Nam
|
429
|
+
VG: Virgin Islands (British)
|
430
|
+
VI: Virgin Islands (U.S.)
|
431
|
+
WF: Wallis and Futuna
|
432
|
+
EH: Western Sahara
|
433
|
+
YE: Yemen
|
434
|
+
ZM: Zambia
|
435
|
+
ZW: Zimbabwe
|