flag_icon 1.3.0 → 1.4.0
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/.github/workflows/main.yml +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +15 -11
- data/lib/flag_icon/countries.rb +26 -0
- data/lib/flag_icon/helpers.rb +4 -4
- data/lib/flag_icon/rails/version.rb +1 -1
- data/vendor/assets/images/flags/4x3/es-eu.svg +6 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78a58941ebb040264752e3c9fe571cdbc3c44470fc8b208d1185b73022d753d6
|
4
|
+
data.tar.gz: 34a33ea24ba19c0c444762c5db5394b63bc64953f545ea77dcaa27a7d72cd14b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5f7f371225973e3576a00fd7aba1d7d9eb47db7f9f8b79f34c4c1e8b9a179d145abb85a4ea4a9ccbec42869d25c03771fb3ed0e1b9621cf4533679e6b64d96f
|
7
|
+
data.tar.gz: 070ba5223c5e44f94ac2b75f128910674fcee0c6e214c20ca94cff225955e89350368342b17a70e25ed26774fc69d4dd2377b4e607727c1ce5bb92aa5df9bb19
|
data/.github/workflows/main.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
# FlagIcon
|
2
|
+
[](https://badge.fury.io/rb/flag_icon)
|
3
|
+
|
4
|
+
### Purpose
|
2
5
|
An attempt to map languages to flags!
|
3
6
|
|
7
|
+
### Approach
|
8
|
+
Matching flags to languages can be really tricky and even problematic sometimes because there is no direct association
|
9
|
+
between languages and countries since the same language is spoken in many countries and many languages are spoken in a single.
|
10
|
+
So a effort was made to identify the official language of each country and then assign the flag to the language not the country.
|
11
|
+
|
12
|
+
So for a title from Mexico which has spanish as the official language the spanish flag will appear.
|
13
|
+
|
14
|
+
Therefore if you notice any flags being mismatched please raise an [issue](https://github.com/alexwebgr/flag_icon/issues)
|
15
|
+
or even better open a [pull request](https://github.com/alexwebgr/flag_icon/pulls)
|
16
|
+
|
4
17
|
|
5
18
|
## Installation
|
6
19
|
|
@@ -33,9 +46,9 @@ language_icon
|
|
33
46
|
# It returns HTML element with country icon
|
34
47
|
#
|
35
48
|
# @param code -> country iso code
|
36
|
-
# @example
|
49
|
+
# @example county_icon('gr')
|
37
50
|
# @return String
|
38
|
-
|
51
|
+
county_icon
|
39
52
|
```
|
40
53
|
```ruby
|
41
54
|
# It returns the language name
|
@@ -97,15 +110,6 @@ available_languages
|
|
97
110
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
98
111
|
|
99
112
|
## Contributing
|
100
|
-
Matching flags to languages can be really tricky and even problematic sometimes because there is no direct association
|
101
|
-
between languages and countries since the same language is spoken in many countries and many languages are spoken in a single.
|
102
|
-
So a effort was made to identify the official language of each country and then assign the flag to the language not the country.
|
103
|
-
|
104
|
-
So for a title from Mexico which has spanish as the official language the spanish flag will appear.
|
105
|
-
|
106
|
-
Therefore if you notice any flags being mismatched please raise an [issue](https://github.com/alexwebgr/flag_icon/issues)
|
107
|
-
or even better open a [pull request](https://github.com/alexwebgr/flag_icon/pulls)
|
108
|
-
|
109
113
|
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/alexwebgr/flag_icon/blob/master/CODE_OF_CONDUCT.md).
|
110
114
|
|
111
115
|
## License
|
data/lib/flag_icon/countries.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module FlagIcon::Countries
|
2
2
|
# ISO country codes to county name
|
3
3
|
NAMES = {
|
4
|
+
ab: "Abkhazia",
|
4
5
|
ad: "Andorra",
|
5
6
|
ae: "United Arab Emirates",
|
6
7
|
af: "Afghanistan",
|
@@ -260,6 +261,7 @@ module FlagIcon::Countries
|
|
260
261
|
fa: "af",
|
261
262
|
en: "gb",
|
262
263
|
al: "al",
|
264
|
+
sq: "al",
|
263
265
|
am: "am",
|
264
266
|
hy: "am",
|
265
267
|
es: "es",
|
@@ -287,6 +289,12 @@ module FlagIcon::Countries
|
|
287
289
|
hi: "in",
|
288
290
|
ta: "in",
|
289
291
|
te: "in",
|
292
|
+
as: "in",
|
293
|
+
gu: "in",
|
294
|
+
kn: "in",
|
295
|
+
mr: "in",
|
296
|
+
pa: "in",
|
297
|
+
sa: "in",
|
290
298
|
is: "is",
|
291
299
|
it: "it",
|
292
300
|
ja: "jp",
|
@@ -305,6 +313,7 @@ module FlagIcon::Countries
|
|
305
313
|
mh: "mh",
|
306
314
|
mk: "mk",
|
307
315
|
ml: "ml",
|
316
|
+
bm: "ml",
|
308
317
|
my: "mm",
|
309
318
|
mn: "mn",
|
310
319
|
dv: "mv",
|
@@ -312,6 +321,7 @@ module FlagIcon::Countries
|
|
312
321
|
ms: "my",
|
313
322
|
nl: "nl",
|
314
323
|
no: "no",
|
324
|
+
nb: "no",
|
315
325
|
ne: "np",
|
316
326
|
na: "nr",
|
317
327
|
ur: "pk",
|
@@ -338,10 +348,24 @@ module FlagIcon::Countries
|
|
338
348
|
bi: "vu",
|
339
349
|
sm: "ws",
|
340
350
|
zu: "za",
|
351
|
+
bg: "bg",
|
352
|
+
cy: "gb-wls",
|
353
|
+
eu: "es-eu",
|
354
|
+
he: "il",
|
355
|
+
yi: "il",
|
356
|
+
ig: "ng",
|
357
|
+
ik: "ak",
|
358
|
+
ln: "cd",
|
359
|
+
sk: "sk",
|
360
|
+
sl: "si",
|
361
|
+
wo: "sn",
|
362
|
+
ak: "gh",
|
341
363
|
}
|
342
364
|
|
343
365
|
# language code to language name
|
344
366
|
LANGUAGES = {
|
367
|
+
"ak": "Akan",
|
368
|
+
"ig": "Igbo",
|
345
369
|
"ab": "Abkhazian",
|
346
370
|
"aa": "Afar",
|
347
371
|
"af": "Afrikaans",
|
@@ -361,6 +385,7 @@ module FlagIcon::Countries
|
|
361
385
|
"br": "Breton",
|
362
386
|
"bg": "Bulgarian",
|
363
387
|
"my": "Burmese",
|
388
|
+
"bm": "Bambara",
|
364
389
|
"be": "Byelorussian (Belarusian)",
|
365
390
|
"km": "Cambodian",
|
366
391
|
"ca": "Catalan",
|
@@ -428,6 +453,7 @@ module FlagIcon::Countries
|
|
428
453
|
"na": "Nauru",
|
429
454
|
"ne": "Nepali",
|
430
455
|
"no": "Norwegian",
|
456
|
+
"nb": "Bokmål",
|
431
457
|
"oc": "Occitan",
|
432
458
|
"or": "Oriya",
|
433
459
|
"om": "Oromo (Afan, Galla)",
|
data/lib/flag_icon/helpers.rb
CHANGED
@@ -23,7 +23,7 @@ module FlagIcon
|
|
23
23
|
# @example language_name('el') # => gr
|
24
24
|
# @return String
|
25
25
|
def language_flag(code)
|
26
|
-
FlagIcon::Countries::LANGUAGE_FLAGS[code.to_sym]
|
26
|
+
FlagIcon::Countries::LANGUAGE_FLAGS[code.to_sym] || 'xx'
|
27
27
|
end
|
28
28
|
|
29
29
|
# It returns the country iso code
|
@@ -52,9 +52,9 @@ module FlagIcon
|
|
52
52
|
# It returns HTML element with country icon
|
53
53
|
#
|
54
54
|
# @param code -> country iso code
|
55
|
-
# @example
|
55
|
+
# @example county_icon('gr')
|
56
56
|
# @return String
|
57
|
-
def
|
57
|
+
def county_icon(code)
|
58
58
|
"<span class='flag-icon flag-icon-#{code}' title='Available in #{country_name(code)}'></span>"
|
59
59
|
end
|
60
60
|
|
@@ -87,7 +87,7 @@ module FlagIcon
|
|
87
87
|
module_function :language_flag
|
88
88
|
module_function :select_language
|
89
89
|
module_function :language_icon
|
90
|
-
module_function :
|
90
|
+
module_function :county_icon
|
91
91
|
module_function :popular_languages
|
92
92
|
module_function :available_languages
|
93
93
|
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 28" width="1000" height="560">
|
3
|
+
<path d="M0,0 v28 h50 v-28 z" fill="#D52B1E"/>
|
4
|
+
<path d="M0,0 L50,28 M50,0 L0,28" stroke="#009B48" stroke-width="4.3"/>
|
5
|
+
<path d="M25,0 v28 M0,14 h50" stroke="#fff" stroke-width="4.3"/>
|
6
|
+
</svg>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flag_icon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alexwebgr
|
@@ -167,6 +167,7 @@ files:
|
|
167
167
|
- vendor/assets/images/flags/4x3/en.svg
|
168
168
|
- vendor/assets/images/flags/4x3/er.svg
|
169
169
|
- vendor/assets/images/flags/4x3/es-ct.svg
|
170
|
+
- vendor/assets/images/flags/4x3/es-eu.svg
|
170
171
|
- vendor/assets/images/flags/4x3/es-ga.svg
|
171
172
|
- vendor/assets/images/flags/4x3/es.svg
|
172
173
|
- vendor/assets/images/flags/4x3/et.svg
|