world-flags 0.3.2.2 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/Gemfile.lock +2 -0
- data/README.md +39 -11
- data/VERSION +1 -1
- data/{app/config/country_codes/iso-3166-2.en.json → config/countries/locale_countries.en.json} +0 -0
- data/config/languages/locale_languages.en.json +253 -0
- data/config/locale_map/locale_to_country_code.json +35 -0
- data/lib/world-flags.rb +49 -90
- data/lib/world_flags/countries.rb +53 -57
- data/lib/world_flags/country_util.rb +46 -0
- data/lib/world_flags/helper/view/util.rb +2 -2
- data/lib/world_flags/lang_util.rb +46 -0
- data/lib/world_flags/languages.rb +59 -63
- data/lib/world_flags/rails/engine.rb +1 -5
- data/sandbox/languages_country_extract.rb +15 -0
- data/sandbox/languages_table.txt +185 -0
- data/sandbox/official_languages.html +1073 -0
- data/sandbox/official_languages.txt +413 -0
- data/spec/world_flags/view_helper_spec.rb +41 -11
- data/world-flags.gemspec +14 -3
- metadata +28 -4
@@ -0,0 +1,413 @@
|
|
1
|
+
%% http://en.wikipedia.org/wiki/List_of_official_languages
|
2
|
+
Abaza:
|
3
|
+
Karachay–Cherkessia#
|
4
|
+
Adyghe:
|
5
|
+
Adygea#
|
6
|
+
Aghul:
|
7
|
+
Dagestan#
|
8
|
+
Albanian:
|
9
|
+
Serbia#
|
10
|
+
Macedonia#
|
11
|
+
Albanian:
|
12
|
+
Montenegro#
|
13
|
+
Altay:
|
14
|
+
Republic of Altay#
|
15
|
+
Aranese#
|
16
|
+
Armenian:
|
17
|
+
Nagorno Karabagh#
|
18
|
+
Assamese:
|
19
|
+
India#
|
20
|
+
Assam#
|
21
|
+
Avar:
|
22
|
+
Dagestan#
|
23
|
+
Azeri:
|
24
|
+
Dagestan#
|
25
|
+
Balkar:
|
26
|
+
Kabardino-Balkaria#
|
27
|
+
Bashkir:
|
28
|
+
Bashkortostan#
|
29
|
+
Basque:
|
30
|
+
Basque Community#
|
31
|
+
Navarre#
|
32
|
+
Bengali:
|
33
|
+
India#
|
34
|
+
Andaman Islands#
|
35
|
+
Nicobar Islands#
|
36
|
+
Assam#
|
37
|
+
Tripura#
|
38
|
+
West Bengal#
|
39
|
+
Bosnian:
|
40
|
+
Serbia#
|
41
|
+
Sandžak#
|
42
|
+
Montenegro#
|
43
|
+
Buryat:
|
44
|
+
Buryatia#
|
45
|
+
Zabaykalsky Krai#
|
46
|
+
Agin-Buryat Okrug#
|
47
|
+
Cantonese Chinese:
|
48
|
+
Hong Kong#
|
49
|
+
Macau#
|
50
|
+
Catalan:
|
51
|
+
Spain
|
52
|
+
Balearic Islands#
|
53
|
+
Catalonia#
|
54
|
+
Valencia#
|
55
|
+
France#
|
56
|
+
Pyrénées Orientales#
|
57
|
+
Italy#
|
58
|
+
Alguero#
|
59
|
+
Chechen:
|
60
|
+
Chechnya#
|
61
|
+
Dagestan#
|
62
|
+
Cherkess:
|
63
|
+
Karachay–Cherkessia#
|
64
|
+
Chipewyan:
|
65
|
+
Northwest Territories#
|
66
|
+
Chukchi:
|
67
|
+
Sakha#
|
68
|
+
Chuvash#
|
69
|
+
Chuvashia#
|
70
|
+
Cree:
|
71
|
+
Northwest Territories#
|
72
|
+
Crimean Tatar#
|
73
|
+
Crimea#
|
74
|
+
Croatian:
|
75
|
+
Austria
|
76
|
+
Burgenland#
|
77
|
+
Molise#
|
78
|
+
Serbia
|
79
|
+
Vojvodina#
|
80
|
+
Montenegro#
|
81
|
+
Dargwa:
|
82
|
+
Dagestan#
|
83
|
+
Dolgan:
|
84
|
+
Sakha#
|
85
|
+
Dutch:
|
86
|
+
The Nord-Pas-de-Calais#
|
87
|
+
English:
|
88
|
+
Canada#
|
89
|
+
Alberta#
|
90
|
+
British Columbia#
|
91
|
+
Manitoba#
|
92
|
+
Newfoundland#
|
93
|
+
Labrador#
|
94
|
+
Nova Scotia#
|
95
|
+
Ontario#
|
96
|
+
Prince Edward Island#
|
97
|
+
Saskatchewan#
|
98
|
+
New Brunswick#
|
99
|
+
Northwest Territories#
|
100
|
+
Nunavut#
|
101
|
+
Yukon#
|
102
|
+
The United Kingdom:
|
103
|
+
England#
|
104
|
+
Northern Ireland#
|
105
|
+
Scotland#
|
106
|
+
Wales#
|
107
|
+
Isle of Man#
|
108
|
+
Guernsey#
|
109
|
+
Jersey#
|
110
|
+
Erzya:
|
111
|
+
Mordovia#
|
112
|
+
Even:
|
113
|
+
Sakha#
|
114
|
+
Evenki:
|
115
|
+
Sakha#
|
116
|
+
Faroese:
|
117
|
+
Faroe Islands#
|
118
|
+
Finnish:
|
119
|
+
Karelia#
|
120
|
+
French:
|
121
|
+
Canada#
|
122
|
+
New Brunswick#
|
123
|
+
Northwest Territories#
|
124
|
+
Nunavut#
|
125
|
+
Quebec#
|
126
|
+
Yukon#
|
127
|
+
Guernsey#
|
128
|
+
Jersey#
|
129
|
+
Pondicherry#
|
130
|
+
Gagauz:
|
131
|
+
Gagauzia#
|
132
|
+
Galician:
|
133
|
+
Spain#
|
134
|
+
Galicia#
|
135
|
+
German:
|
136
|
+
Italy#
|
137
|
+
South Tyrol#
|
138
|
+
Greek:
|
139
|
+
Albania#
|
140
|
+
Italy#
|
141
|
+
Salento#
|
142
|
+
Calabria#
|
143
|
+
Guaraní:
|
144
|
+
Argentina#
|
145
|
+
Corrientes Province#
|
146
|
+
Gujarati:
|
147
|
+
India#
|
148
|
+
Dadra and Nagar Haveli#
|
149
|
+
Daman and Diu#
|
150
|
+
Gujarat#
|
151
|
+
Hawaiian:
|
152
|
+
Hawaii#
|
153
|
+
Hungarian:
|
154
|
+
Serbia#
|
155
|
+
Vojvodina#
|
156
|
+
Romania#
|
157
|
+
Slovenia#
|
158
|
+
Croatia#
|
159
|
+
Slovakia#
|
160
|
+
Austria#
|
161
|
+
Ingush:
|
162
|
+
Ingushetia#
|
163
|
+
Inuktitut:
|
164
|
+
Nunavut#
|
165
|
+
Irish:
|
166
|
+
Northern Ireland#
|
167
|
+
Italian:
|
168
|
+
Croatia#
|
169
|
+
Istria county#
|
170
|
+
Slovenia#
|
171
|
+
Japanese:
|
172
|
+
Palau#
|
173
|
+
Angaur#
|
174
|
+
Kabardian#
|
175
|
+
Kabardino-Balkaria#
|
176
|
+
Kalaallisut:
|
177
|
+
Greenland#
|
178
|
+
Kalmyk:
|
179
|
+
Kalmykia#
|
180
|
+
India#
|
181
|
+
Karnataka#
|
182
|
+
Karachay:
|
183
|
+
Karachay–Cherkessia#
|
184
|
+
Karelian:
|
185
|
+
Karelia#
|
186
|
+
Kashmiri:
|
187
|
+
India#
|
188
|
+
Jammu#
|
189
|
+
Kashmir#
|
190
|
+
Kazakh:
|
191
|
+
Altay#
|
192
|
+
Republic of China#
|
193
|
+
Mongolia
|
194
|
+
Khakas:
|
195
|
+
Khakassia#
|
196
|
+
Khanty:
|
197
|
+
Khanty–Mansi Okrug#
|
198
|
+
Yamalo-Nenets Okrug#
|
199
|
+
Komi:
|
200
|
+
Komi#
|
201
|
+
Komi-Permyak:
|
202
|
+
Perm Krai#
|
203
|
+
Komi-Permyak Okrug#
|
204
|
+
Korean:
|
205
|
+
Republic of China
|
206
|
+
Changbai#
|
207
|
+
Yanbian#
|
208
|
+
Kumyk:
|
209
|
+
Dagestan#
|
210
|
+
Kyrgyz:
|
211
|
+
Republic of China#
|
212
|
+
Kizilsu#
|
213
|
+
Lak:
|
214
|
+
Dagestan#
|
215
|
+
Lezgian#
|
216
|
+
Dagestan#
|
217
|
+
Macedonian:
|
218
|
+
Serbia#
|
219
|
+
Malayalam:
|
220
|
+
India#
|
221
|
+
Kerala#
|
222
|
+
Pondicherry#
|
223
|
+
Lakshadweep#
|
224
|
+
Mansi:
|
225
|
+
Khanty–Mansi Okrug#
|
226
|
+
Marathi:
|
227
|
+
India#
|
228
|
+
Maharashtra#
|
229
|
+
Goa#
|
230
|
+
Dadra and Nagar Haveli#
|
231
|
+
Daman and Diu#
|
232
|
+
Mari#
|
233
|
+
Mari El#
|
234
|
+
Mayan:
|
235
|
+
Mexico#
|
236
|
+
Guatemala#
|
237
|
+
Belize#
|
238
|
+
Honduras#
|
239
|
+
El Salvador#
|
240
|
+
Moksha:
|
241
|
+
Mordovia#
|
242
|
+
Mongolian:
|
243
|
+
Republic of China#
|
244
|
+
Inner Mongolia#
|
245
|
+
Haixi#
|
246
|
+
Bortala#
|
247
|
+
Bayin'gholin#
|
248
|
+
Dorbod#
|
249
|
+
Qian Gorlos#
|
250
|
+
Harqin Left#
|
251
|
+
Fuxin#
|
252
|
+
Weichang#
|
253
|
+
Subei#
|
254
|
+
Henan#
|
255
|
+
Náhuatl:
|
256
|
+
Mexico#
|
257
|
+
El Salvador#
|
258
|
+
Nenets:
|
259
|
+
Khanty–Mansi Okrug#
|
260
|
+
Yamalo-Nenets Okrug#
|
261
|
+
Nepali:
|
262
|
+
India#
|
263
|
+
Nogai:
|
264
|
+
Dagestan#
|
265
|
+
Karachay–Cherkessia#
|
266
|
+
Occitan (Aranese):
|
267
|
+
Aran Valley#
|
268
|
+
Oriya:
|
269
|
+
India#
|
270
|
+
Orissa#
|
271
|
+
Ossetic#
|
272
|
+
North Ossetia—Alania#
|
273
|
+
Portuguese:
|
274
|
+
Macau#
|
275
|
+
Punjabi:
|
276
|
+
Pakistan
|
277
|
+
India#
|
278
|
+
Punjab#
|
279
|
+
Delhi#
|
280
|
+
Romanian:
|
281
|
+
Vojvodina#
|
282
|
+
Adygea#
|
283
|
+
Altay#
|
284
|
+
Bashkortostan#
|
285
|
+
Buryatia#
|
286
|
+
Chechnya#
|
287
|
+
Chuvashia#
|
288
|
+
Dagestan#
|
289
|
+
Ingushetia#
|
290
|
+
Kabardino-Balkaria#
|
291
|
+
Kalmykia#
|
292
|
+
Karachay–Cherkessia#
|
293
|
+
Karelia#
|
294
|
+
Khakassia#
|
295
|
+
Komi#
|
296
|
+
Mari El#
|
297
|
+
Mordovia#
|
298
|
+
North Ossetia—Alania#
|
299
|
+
Sakha#
|
300
|
+
Tatarstan#
|
301
|
+
Tyva#
|
302
|
+
Udmurtia#
|
303
|
+
Russia#
|
304
|
+
Rusyn:
|
305
|
+
Vojvodina#
|
306
|
+
Ukraine#
|
307
|
+
Zakarapts'ka#
|
308
|
+
Rutul:
|
309
|
+
Dagestan#
|
310
|
+
Sakha:
|
311
|
+
Sakha#
|
312
|
+
Sanskrit:
|
313
|
+
India#
|
314
|
+
Sami:
|
315
|
+
Finland#
|
316
|
+
Norway#
|
317
|
+
Sweden#
|
318
|
+
Sarikoli:
|
319
|
+
Republic of China#
|
320
|
+
Taxkorgan#
|
321
|
+
Scottish Gaelic:
|
322
|
+
Scotland#
|
323
|
+
Scots:
|
324
|
+
Scotland#
|
325
|
+
Northern Ireland#
|
326
|
+
Donegal#
|
327
|
+
Selkup:
|
328
|
+
Yamalo-Nenets Okrug#
|
329
|
+
Sindhi:
|
330
|
+
India#
|
331
|
+
Pakistan#
|
332
|
+
Slovak:
|
333
|
+
Serbia#
|
334
|
+
Vojvodina#
|
335
|
+
Slovene:
|
336
|
+
Italy#
|
337
|
+
Friuli-Venezia Giulia#
|
338
|
+
Austria#
|
339
|
+
Carinthia#
|
340
|
+
Spanish:
|
341
|
+
Puerto Rico
|
342
|
+
Philippines
|
343
|
+
Tabasaran:
|
344
|
+
Dagestan#
|
345
|
+
Tahitian:
|
346
|
+
French Polynesia#
|
347
|
+
Tamil:
|
348
|
+
India#
|
349
|
+
Andaman Islands#
|
350
|
+
Nicobar Islands#
|
351
|
+
Pondicherry#
|
352
|
+
Tamil Nadu#
|
353
|
+
Tat:
|
354
|
+
Dagestan#
|
355
|
+
Tatar:
|
356
|
+
Tatarstan#
|
357
|
+
Telugu:
|
358
|
+
India#
|
359
|
+
Andhra Pradesh#
|
360
|
+
Pondicherry#
|
361
|
+
Tibetan:
|
362
|
+
Tibet#
|
363
|
+
Aba#
|
364
|
+
Garzê#
|
365
|
+
Diqing#
|
366
|
+
Wenshan#
|
367
|
+
Gannan#
|
368
|
+
Haibai#
|
369
|
+
Hainan#
|
370
|
+
Huangnan#
|
371
|
+
Golog#
|
372
|
+
Gyêgu#
|
373
|
+
Haixi#
|
374
|
+
Muli#
|
375
|
+
Tianzhu#
|
376
|
+
Tsakhur:
|
377
|
+
Dagestan#
|
378
|
+
Tswana:
|
379
|
+
South Africa#
|
380
|
+
Turkish:
|
381
|
+
Macedonia#
|
382
|
+
Centar Župa#
|
383
|
+
Kosovo#
|
384
|
+
Bulgaria#
|
385
|
+
Tuvan:
|
386
|
+
Tyva#
|
387
|
+
Udmurt:
|
388
|
+
Udmurtia#
|
389
|
+
Urdu:
|
390
|
+
India#
|
391
|
+
Jammu#
|
392
|
+
Kashmir#
|
393
|
+
Delhi Territory#
|
394
|
+
Uttar Pradesh state#
|
395
|
+
Bihar state#
|
396
|
+
Andhra Pradesh#
|
397
|
+
Uyghur:
|
398
|
+
Xinjiang#
|
399
|
+
Veps:
|
400
|
+
Karelia#
|
401
|
+
Vietnamese:
|
402
|
+
China#
|
403
|
+
Cambodia#
|
404
|
+
Laos#
|
405
|
+
Welsh:
|
406
|
+
Wales#
|
407
|
+
Yiddish:
|
408
|
+
Russia#
|
409
|
+
Yukaghir:
|
410
|
+
Sakha#
|
411
|
+
Zhuang:
|
412
|
+
Guangxi#
|
413
|
+
Lianshan#
|
@@ -7,7 +7,9 @@ describe WorldFlags::Helper::View do
|
|
7
7
|
before do
|
8
8
|
WorldFlags.auto_select!
|
9
9
|
I18n.locale = 'ar'
|
10
|
-
WorldFlags.active_locales = [:da, :sv, :
|
10
|
+
WorldFlags.active_locales = [:da, :sv, :nb, :en, :ar]
|
11
|
+
|
12
|
+
WorldFlags.raise_error!
|
11
13
|
end
|
12
14
|
|
13
15
|
it "should be empty, with an empty block" do
|
@@ -37,38 +39,66 @@ describe WorldFlags::Helper::View do
|
|
37
39
|
output = flags_list 32 do
|
38
40
|
flags [:ar, :gb]
|
39
41
|
end
|
40
|
-
output.should == "<ul class=\"f32\"><li class=\"flag ar selected\" data-cc=\"ar\" data-
|
42
|
+
output.should == "<ul class=\"f32\"><li class=\"flag ar selected\" data-cc=\"ar\" data-country_name=\"Argentina\" data-language_name=\"Argentinian Spanish\" data-locale=\"ar\"> </li><li class=\"flag gb\" data-cc=\"gb\" data-country_name=\"Great Britain\" data-language_name=\"British English\" data-locale=\"gb\"> </li></ul>"
|
41
43
|
end
|
42
44
|
|
43
45
|
it "should list flags using args" do
|
44
46
|
output = flags_list 32 do
|
45
47
|
flags :ar, :gb
|
46
48
|
end
|
47
|
-
output.should == "<ul class=\"f32\"><li class=\"flag ar selected\" data-cc=\"ar\" data-
|
49
|
+
output.should == "<ul class=\"f32\"><li class=\"flag ar selected\" data-cc=\"ar\" data-country_name=\"Argentina\" data-language_name=\"Argentinian Spanish\" data-locale=\"ar\"> </li><li class=\"flag gb\" data-cc=\"gb\" data-country_name=\"Great Britain\" data-language_name=\"British English\" data-locale=\"gb\"> </li></ul>"
|
48
50
|
end
|
49
51
|
|
50
52
|
it "should list flags using args and :with_semi" do
|
51
53
|
output = flags_list 32 do
|
52
54
|
flags :ar, :gb, :with_semi => true
|
53
55
|
end
|
54
|
-
output.should == "<ul class=\"f32\"><li class=\"flag ar selected\" data-cc=\"ar\" data-
|
56
|
+
output.should == "<ul class=\"f32\"><li class=\"flag ar selected\" data-cc=\"ar\" data-country_name=\"Argentina\" data-language_name=\"Argentinian Spanish\" data-locale=\"ar\"> </li><li class=\"flag gb semi\" data-cc=\"gb\" data-country_name=\"Great Britain\" data-language_name=\"British English\" data-locale=\"gb\"> </li></ul>"
|
55
57
|
end
|
56
58
|
|
57
59
|
it "should list flags" do
|
58
60
|
output = flag_title :ar, 'Argentina'
|
59
|
-
output.should == "<li class=\"flag ar selected\" data-cc=\"ar\" data-
|
61
|
+
output.should == "<li class=\"flag ar selected\" data-cc=\"ar\" data-country_name=\"Argentina\" data-language_name=\"Argentinian Spanish\" data-locale=\"ar\" title=\"Argentina\"> </li>"
|
60
62
|
end
|
61
63
|
|
62
64
|
describe 'Countries' do
|
63
|
-
|
64
|
-
|
65
|
+
context 'Danish locale' do
|
66
|
+
before do
|
67
|
+
I18n.locale = 'da'
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should list nordic flags using args and :with_semi" do
|
71
|
+
output = flags_list 32 do
|
72
|
+
flags :dk, :se, :no, :with_semi => true, :country => :da
|
73
|
+
end
|
74
|
+
output.should == "<ul class=\"f32\"><li class=\"flag dk selected\" data-cc=\"dk\" data-country_name=\"Danmark\" data-language_name=\"Dansk\" data-locale=\"dk\"> </li><li class=\"flag se semi\" data-cc=\"se\" data-country_name=\"USA\" data-language_name=\"Svensk\" data-locale=\"se\"> </li><li class=\"flag no semi\" data-cc=\"no\" data-country_name=\"Norge\" data-language_name=\"Norsk\" data-locale=\"no\"> </li></ul>"
|
75
|
+
end
|
65
76
|
end
|
66
77
|
|
67
|
-
|
68
|
-
|
69
|
-
|
78
|
+
context 'Swedish locale' do
|
79
|
+
before do
|
80
|
+
I18n.locale = 'sv'
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should list nordic flags using args and :with_semi" do
|
84
|
+
output = flags_list 32 do
|
85
|
+
flags :dk, :se, :no, :with_semi => true, :country => :da
|
86
|
+
end
|
87
|
+
output.should == "<ul class=\"f32\"><li class=\"flag dk semi\" data-cc=\"dk\" data-country_name=\"Danmark\" data-language_name=\"Dansk\" data-locale=\"dk\"> </li><li class=\"flag se selected\" data-cc=\"se\" data-country_name=\"USA\" data-language_name=\"Svenska\" data-locale=\"se\"> </li><li class=\"flag no semi\" data-cc=\"no\" data-country_name=\"Norge\" data-language_name=\"Norsk\" data-locale=\"no\"> </li></ul>"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'Norwegian locale' do
|
92
|
+
before do
|
93
|
+
I18n.locale = 'nb'
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should list nordic flags using args and :with_semi" do
|
97
|
+
output = flags_list 32 do
|
98
|
+
flags :dk, :se, :no, :with_semi => true, :country => :da
|
99
|
+
end
|
100
|
+
output.should == "<ul class=\"f32\"><li class=\"flag dk semi\" data-cc=\"dk\" data-country_name=\"Danmark\" data-language_name=\"Dansk\" data-locale=\"dk\"> </li><li class=\"flag se semi\" data-cc=\"se\" data-country_name=\"Sverige\" data-language_name=\"Svensk\" data-locale=\"se\"> </li><li class=\"flag no selected\" data-cc=\"no\" data-country_name=\"Norge\" data-language_name=\"Norsk\" data-locale=\"no\"> </li></ul>"
|
70
101
|
end
|
71
|
-
output.should == "<ul class=\"f32\"><li class=\"flag dk selected\" data-cc=\"dk\" data-country=\"Danmark\" data-locale=\"da\"> </li><li class=\"flag se semi\" data-cc=\"se\" data-country=\"Sverige\" data-locale=\"sv\"> </li><li class=\"flag no semi\" data-cc=\"no\" data-country=\"Norge\" data-locale=\"no\"> </li></ul>"
|
72
102
|
end
|
73
103
|
end
|
74
104
|
end
|