flag_icon 1.0.0 → 1.5.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 +5 -8
- data/.github/workflows/publish.yml +33 -0
- data/.gitignore +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +130 -3
- data/LICENSE.txt +1 -1
- data/README.md +99 -8
- data/flag_icon.gemspec +2 -1
- data/lib/flag_icon/countries.rb +29 -0
- data/lib/flag_icon/helpers.rb +101 -0
- data/lib/flag_icon/rails/version.rb +1 -1
- data/lib/flag_icon/railtie.rb +2 -2
- data/lib/flag_icon.rb +4 -1
- data/vendor/assets/images/flags/4x3/ak.svg +109 -0
- data/vendor/assets/images/flags/4x3/es-eu.svg +6 -0
- data/vendor/assets/stylesheets/flag-icons/_flag-icons-list.scss +3 -3
- metadata +29 -12
- data/lib/flag_icon/helper.rb +0 -40
- data/vendor/assets/images/flags/4x3/hi.svg +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eb44a2a8ed7fb1441698dcea487554797d9a325e94dc85fd56b7652c01d23c6
|
4
|
+
data.tar.gz: 95f2d1a9f896e7aa0678dd41bbff73f7cb2f26a2eb747fa9b82b15c40bf2c30e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8acf0dc35b8fe1fe8afdec533f17062b7dc283431d6b0a96a711d999f2c72f9c81a967c318f7df7a1f8e84567adbec0b4cb36bc4b4d9ac33a5915c91147656b4
|
7
|
+
data.tar.gz: 7d949f724295bffd37af1347e7b7ef42a8d705d4fbf6ab199caa420bd2cebd13684e5ff6662c3016b954f758cae5eb064b765686d6bb29b4b07117d7b730121c
|
data/.github/workflows/main.yml
CHANGED
@@ -1,25 +1,22 @@
|
|
1
|
-
name:
|
1
|
+
name: Run tests
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
5
|
branches:
|
6
|
-
-
|
6
|
+
- '*'
|
7
|
+
- '!amin'
|
8
|
+
|
7
9
|
|
8
10
|
jobs:
|
9
11
|
build:
|
10
12
|
runs-on: ubuntu-latest
|
11
13
|
|
12
|
-
strategy:
|
13
|
-
matrix:
|
14
|
-
ruby:
|
15
|
-
- 3.0.3
|
16
|
-
|
17
14
|
steps:
|
18
15
|
- uses: actions/checkout@v2
|
19
16
|
- name: Set up Ruby
|
20
17
|
uses: ruby/setup-ruby@v1
|
21
18
|
with:
|
22
|
-
ruby-version:
|
19
|
+
ruby-version: 3.0.3
|
23
20
|
bundler-cache: true
|
24
21
|
- name: Run the default task
|
25
22
|
run: bundle exec rake
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: Publish Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main ]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
permissions:
|
11
|
+
contents: read
|
12
|
+
packages: write
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: Set up Ruby
|
17
|
+
uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: 3.0.3
|
20
|
+
bundler-cache: true
|
21
|
+
- name: Run the default task
|
22
|
+
run: bundle exec rake
|
23
|
+
|
24
|
+
- name: Publish to RubyGems
|
25
|
+
run: |
|
26
|
+
mkdir -p $HOME/.gem
|
27
|
+
touch $HOME/.gem/credentials
|
28
|
+
chmod 0600 $HOME/.gem/credentials
|
29
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
30
|
+
gem build flag_icon.gemspec
|
31
|
+
gem push *.gem
|
32
|
+
env:
|
33
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/.gitignore
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.3
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,122 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
flag_icon (1.
|
4
|
+
flag_icon (1.5.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
actioncable (6.1.4.1)
|
10
|
+
actionpack (= 6.1.4.1)
|
11
|
+
activesupport (= 6.1.4.1)
|
12
|
+
nio4r (~> 2.0)
|
13
|
+
websocket-driver (>= 0.6.1)
|
14
|
+
actionmailbox (6.1.4.1)
|
15
|
+
actionpack (= 6.1.4.1)
|
16
|
+
activejob (= 6.1.4.1)
|
17
|
+
activerecord (= 6.1.4.1)
|
18
|
+
activestorage (= 6.1.4.1)
|
19
|
+
activesupport (= 6.1.4.1)
|
20
|
+
mail (>= 2.7.1)
|
21
|
+
actionmailer (6.1.4.1)
|
22
|
+
actionpack (= 6.1.4.1)
|
23
|
+
actionview (= 6.1.4.1)
|
24
|
+
activejob (= 6.1.4.1)
|
25
|
+
activesupport (= 6.1.4.1)
|
26
|
+
mail (~> 2.5, >= 2.5.4)
|
27
|
+
rails-dom-testing (~> 2.0)
|
28
|
+
actionpack (6.1.4.1)
|
29
|
+
actionview (= 6.1.4.1)
|
30
|
+
activesupport (= 6.1.4.1)
|
31
|
+
rack (~> 2.0, >= 2.0.9)
|
32
|
+
rack-test (>= 0.6.3)
|
33
|
+
rails-dom-testing (~> 2.0)
|
34
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
+
actiontext (6.1.4.1)
|
36
|
+
actionpack (= 6.1.4.1)
|
37
|
+
activerecord (= 6.1.4.1)
|
38
|
+
activestorage (= 6.1.4.1)
|
39
|
+
activesupport (= 6.1.4.1)
|
40
|
+
nokogiri (>= 1.8.5)
|
41
|
+
actionview (6.1.4.1)
|
42
|
+
activesupport (= 6.1.4.1)
|
43
|
+
builder (~> 3.1)
|
44
|
+
erubi (~> 1.4)
|
45
|
+
rails-dom-testing (~> 2.0)
|
46
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
+
activejob (6.1.4.1)
|
48
|
+
activesupport (= 6.1.4.1)
|
49
|
+
globalid (>= 0.3.6)
|
50
|
+
activemodel (6.1.4.1)
|
51
|
+
activesupport (= 6.1.4.1)
|
52
|
+
activerecord (6.1.4.1)
|
53
|
+
activemodel (= 6.1.4.1)
|
54
|
+
activesupport (= 6.1.4.1)
|
55
|
+
activestorage (6.1.4.1)
|
56
|
+
actionpack (= 6.1.4.1)
|
57
|
+
activejob (= 6.1.4.1)
|
58
|
+
activerecord (= 6.1.4.1)
|
59
|
+
activesupport (= 6.1.4.1)
|
60
|
+
marcel (~> 1.0.0)
|
61
|
+
mini_mime (>= 1.1.0)
|
62
|
+
activesupport (6.1.4.1)
|
63
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
64
|
+
i18n (>= 1.6, < 2)
|
65
|
+
minitest (>= 5.1)
|
66
|
+
tzinfo (~> 2.0)
|
67
|
+
zeitwerk (~> 2.3)
|
68
|
+
builder (3.2.4)
|
69
|
+
concurrent-ruby (1.1.9)
|
70
|
+
crass (1.0.6)
|
9
71
|
diff-lcs (1.5.0)
|
10
72
|
docile (1.4.0)
|
73
|
+
erubi (1.10.0)
|
74
|
+
globalid (1.0.0)
|
75
|
+
activesupport (>= 5.0)
|
76
|
+
i18n (1.8.11)
|
77
|
+
concurrent-ruby (~> 1.0)
|
78
|
+
loofah (2.13.0)
|
79
|
+
crass (~> 1.0.2)
|
80
|
+
nokogiri (>= 1.5.9)
|
81
|
+
mail (2.7.1)
|
82
|
+
mini_mime (>= 0.1.1)
|
83
|
+
marcel (1.0.2)
|
84
|
+
method_source (1.0.0)
|
85
|
+
mini_mime (1.1.2)
|
86
|
+
minitest (5.15.0)
|
87
|
+
nio4r (2.5.8)
|
88
|
+
nokogiri (1.13.0-x86_64-linux)
|
89
|
+
racc (~> 1.4)
|
90
|
+
racc (1.6.0)
|
91
|
+
rack (2.2.3)
|
92
|
+
rack-test (1.1.0)
|
93
|
+
rack (>= 1.0, < 3)
|
94
|
+
rails (6.1.4.1)
|
95
|
+
actioncable (= 6.1.4.1)
|
96
|
+
actionmailbox (= 6.1.4.1)
|
97
|
+
actionmailer (= 6.1.4.1)
|
98
|
+
actionpack (= 6.1.4.1)
|
99
|
+
actiontext (= 6.1.4.1)
|
100
|
+
actionview (= 6.1.4.1)
|
101
|
+
activejob (= 6.1.4.1)
|
102
|
+
activemodel (= 6.1.4.1)
|
103
|
+
activerecord (= 6.1.4.1)
|
104
|
+
activestorage (= 6.1.4.1)
|
105
|
+
activesupport (= 6.1.4.1)
|
106
|
+
bundler (>= 1.15.0)
|
107
|
+
railties (= 6.1.4.1)
|
108
|
+
sprockets-rails (>= 2.0.0)
|
109
|
+
rails-dom-testing (2.0.3)
|
110
|
+
activesupport (>= 4.2.0)
|
111
|
+
nokogiri (>= 1.6)
|
112
|
+
rails-html-sanitizer (1.4.2)
|
113
|
+
loofah (~> 2.3)
|
114
|
+
railties (6.1.4.1)
|
115
|
+
actionpack (= 6.1.4.1)
|
116
|
+
activesupport (= 6.1.4.1)
|
117
|
+
method_source
|
118
|
+
rake (>= 0.13)
|
119
|
+
thor (~> 1.0)
|
11
120
|
rake (13.0.6)
|
12
121
|
rspec (3.10.0)
|
13
122
|
rspec-core (~> 3.10.0)
|
@@ -28,15 +137,33 @@ GEM
|
|
28
137
|
simplecov_json_formatter (~> 0.1)
|
29
138
|
simplecov-html (0.12.3)
|
30
139
|
simplecov_json_formatter (0.1.3)
|
140
|
+
sprockets (4.0.2)
|
141
|
+
concurrent-ruby (~> 1.0)
|
142
|
+
rack (> 1, < 3)
|
143
|
+
sprockets-rails (3.4.2)
|
144
|
+
actionpack (>= 5.2)
|
145
|
+
activesupport (>= 5.2)
|
146
|
+
sprockets (>= 3.0.0)
|
147
|
+
thor (1.2.1)
|
148
|
+
tzinfo (2.0.4)
|
149
|
+
concurrent-ruby (~> 1.0)
|
150
|
+
websocket-driver (0.7.5)
|
151
|
+
websocket-extensions (>= 0.1.0)
|
152
|
+
websocket-extensions (0.1.5)
|
153
|
+
zeitwerk (2.5.1)
|
31
154
|
|
32
155
|
PLATFORMS
|
33
156
|
x86_64-linux
|
34
157
|
|
35
158
|
DEPENDENCIES
|
36
159
|
flag_icon!
|
160
|
+
rails (~> 6.1)
|
37
161
|
rake (~> 13.0)
|
38
162
|
rspec (~> 3.0)
|
39
|
-
simplecov
|
163
|
+
simplecov (~> 0.21)
|
164
|
+
|
165
|
+
RUBY VERSION
|
166
|
+
ruby 3.0.3p157
|
40
167
|
|
41
168
|
BUNDLED WITH
|
42
|
-
2.2.
|
169
|
+
2.2.32
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,18 @@
|
|
1
1
|
# FlagIcon
|
2
|
+
[](https://badge.fury.io/rb/flag_icon)
|
2
3
|
|
3
|
-
|
4
|
+
### Purpose
|
5
|
+
An attempt to map languages to country flags!
|
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 country.
|
10
|
+
|
11
|
+
So for a title from Mexico which has spanish as the official language the spanish flag will appear.
|
12
|
+
|
13
|
+
If you notice any flags being mismatched please raise an [issue](https://github.com/alexwebgr/flag_icon/issues)
|
14
|
+
or even better open a [pull request](https://github.com/alexwebgr/flag_icon/pulls)
|
4
15
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
16
|
|
7
17
|
## Installation
|
8
18
|
|
@@ -21,18 +31,92 @@ Or install it yourself as:
|
|
21
31
|
$ gem install flag_icon
|
22
32
|
|
23
33
|
## Usage
|
34
|
+
There is a number of helpers available that will render country names, language names and flags given a country code or locale.
|
24
35
|
|
25
|
-
|
36
|
+
```ruby
|
37
|
+
# It returns HTML element with country icon and title
|
38
|
+
#
|
39
|
+
# @param code -> language locale
|
40
|
+
# @example language_icon('el')
|
41
|
+
# @return String
|
42
|
+
language_icon
|
43
|
+
```
|
44
|
+
```ruby
|
45
|
+
# It returns HTML element with country icon and title
|
46
|
+
#
|
47
|
+
# @param code -> country iso code
|
48
|
+
# @example country_icon('gr')
|
49
|
+
# @return String
|
50
|
+
country_icon
|
51
|
+
```
|
52
|
+
```ruby
|
53
|
+
# It returns the language name
|
54
|
+
#
|
55
|
+
# @param code -> language locale
|
56
|
+
# @example language_name('el') # => Greek
|
57
|
+
# @return String
|
58
|
+
language_name
|
59
|
+
```
|
60
|
+
```ruby
|
61
|
+
# It returns the country name
|
62
|
+
#
|
63
|
+
# @param code -> country iso code
|
64
|
+
# @example country_name('gr') # => Greece
|
65
|
+
# @return String
|
66
|
+
country_name
|
67
|
+
```
|
68
|
+
```ruby
|
69
|
+
# It returns the country iso code
|
70
|
+
#
|
71
|
+
# @param code -> language locale
|
72
|
+
# @example language_flag('el') # => gr
|
73
|
+
# @return String
|
74
|
+
language_flag
|
75
|
+
```
|
76
|
+
```ruby
|
77
|
+
# It returns an array that can be used in the select tag
|
78
|
+
#
|
79
|
+
# @example select_language
|
80
|
+
# @return Array
|
81
|
+
select_language
|
82
|
+
```
|
83
|
+
```ruby
|
84
|
+
# It returns an hash of arrays that can be used in the select tag
|
85
|
+
#
|
86
|
+
# @param popular -> title of the popular group
|
87
|
+
# @param available -> title of the available group
|
88
|
+
# @example grouped_select_language(popular: 'Popular', available: 'Available')
|
89
|
+
# @return Hash
|
90
|
+
grouped_select_language
|
91
|
+
```
|
92
|
+
```ruby
|
93
|
+
# Define in your application_helper to override the popular languages
|
94
|
+
# Default: [['English', :en], ['Spanish', :es]]
|
95
|
+
#
|
96
|
+
# @example
|
97
|
+
# def popular_languages
|
98
|
+
# [['English', :en], ['Spanish', :es]]
|
99
|
+
# end
|
100
|
+
# @return Array
|
101
|
+
popular_languages
|
102
|
+
```
|
103
|
+
```ruby
|
104
|
+
# Define in your application_helper to override the available languages
|
105
|
+
# @example [['English', :en], ['Spanish', :es]] #default
|
106
|
+
# @example
|
107
|
+
# def available_languages
|
108
|
+
# Language.all.order(:language_locale).pluck(:language_locale)
|
109
|
+
# end
|
110
|
+
# @return Array
|
111
|
+
available_languages
|
26
112
|
|
113
|
+
```
|
27
114
|
## Development
|
28
115
|
|
29
116
|
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.
|
30
117
|
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
118
|
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/flag_icon. 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/[USERNAME]/flag_icon/blob/master/CODE_OF_CONDUCT.md).
|
119
|
+
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).
|
36
120
|
|
37
121
|
## License
|
38
122
|
|
@@ -40,4 +124,11 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
40
124
|
|
41
125
|
## Code of Conduct
|
42
126
|
|
43
|
-
Everyone interacting in the FlagIcon project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
127
|
+
Everyone interacting in the FlagIcon project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/alexwebgr/flag_icon/blob/master/CODE_OF_CONDUCT.md).
|
128
|
+
|
129
|
+
## Credits
|
130
|
+
* Flag icons and css from [flag-icons](https://github.com/lipis/flag-icons)
|
131
|
+
* Country names [xqisocodes.html](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html)
|
132
|
+
* Language to country mapping [country_locale_map.json](https://github.com/riboseinc/country_to_locales_mapping/blob/master/data/country_locale_map.json)
|
133
|
+
* Language to country mapping [language-identifiers.html](http://www.i18nguy.com/unicode/language-identifiers.html)
|
134
|
+
|
data/flag_icon.gemspec
CHANGED
@@ -28,7 +28,8 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ["lib", '"vendor"']
|
30
30
|
|
31
|
+
spec.add_development_dependency "rails", "~> 6.1"
|
31
32
|
spec.add_development_dependency "rake", "~> 13.0"
|
32
33
|
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
-
spec.add_development_dependency "simplecov"
|
34
|
+
spec.add_development_dependency "simplecov", "~> 0.21"
|
34
35
|
end
|
data/lib/flag_icon/countries.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module FlagIcon::Countries
|
2
2
|
# ISO country codes to county name
|
3
3
|
NAMES = {
|
4
|
+
ab: "Abkhazia",
|
5
|
+
ak: "Alaska",
|
4
6
|
ad: "Andorra",
|
5
7
|
ae: "United Arab Emirates",
|
6
8
|
af: "Afghanistan",
|
@@ -256,10 +258,12 @@ module FlagIcon::Countries
|
|
256
258
|
LANGUAGE_FLAGS = {
|
257
259
|
ca: "es-ct",
|
258
260
|
gl: "es-ga",
|
261
|
+
eu: "es-eu",
|
259
262
|
ar: "ae",
|
260
263
|
fa: "af",
|
261
264
|
en: "gb",
|
262
265
|
al: "al",
|
266
|
+
sq: "al",
|
263
267
|
am: "am",
|
264
268
|
hy: "am",
|
265
269
|
es: "es",
|
@@ -287,9 +291,16 @@ module FlagIcon::Countries
|
|
287
291
|
hi: "in",
|
288
292
|
ta: "in",
|
289
293
|
te: "in",
|
294
|
+
as: "in",
|
295
|
+
gu: "in",
|
296
|
+
kn: "in",
|
297
|
+
mr: "in",
|
298
|
+
pa: "in",
|
299
|
+
sa: "in",
|
290
300
|
is: "is",
|
291
301
|
it: "it",
|
292
302
|
ja: "jp",
|
303
|
+
jp: "jp",
|
293
304
|
ky: "kg",
|
294
305
|
km: "kh",
|
295
306
|
ko: "ko",
|
@@ -305,6 +316,7 @@ module FlagIcon::Countries
|
|
305
316
|
mh: "mh",
|
306
317
|
mk: "mk",
|
307
318
|
ml: "ml",
|
319
|
+
bm: "ml",
|
308
320
|
my: "mm",
|
309
321
|
mn: "mn",
|
310
322
|
dv: "mv",
|
@@ -312,6 +324,7 @@ module FlagIcon::Countries
|
|
312
324
|
ms: "my",
|
313
325
|
nl: "nl",
|
314
326
|
no: "no",
|
327
|
+
nb: "no",
|
315
328
|
ne: "np",
|
316
329
|
na: "nr",
|
317
330
|
ur: "pk",
|
@@ -338,10 +351,24 @@ module FlagIcon::Countries
|
|
338
351
|
bi: "vu",
|
339
352
|
sm: "ws",
|
340
353
|
zu: "za",
|
354
|
+
bg: "bg",
|
355
|
+
cy: "gb-wls",
|
356
|
+
he: "il",
|
357
|
+
yi: "il",
|
358
|
+
ig: "ng",
|
359
|
+
ik: "ak",
|
360
|
+
ln: "cd",
|
361
|
+
sk: "sk",
|
362
|
+
sl: "si",
|
363
|
+
wo: "sn",
|
364
|
+
ak: "gh",
|
365
|
+
ab: "ab",
|
341
366
|
}
|
342
367
|
|
343
368
|
# language code to language name
|
344
369
|
LANGUAGES = {
|
370
|
+
"ak": "Akan",
|
371
|
+
"ig": "Igbo",
|
345
372
|
"ab": "Abkhazian",
|
346
373
|
"aa": "Afar",
|
347
374
|
"af": "Afrikaans",
|
@@ -361,6 +388,7 @@ module FlagIcon::Countries
|
|
361
388
|
"br": "Breton",
|
362
389
|
"bg": "Bulgarian",
|
363
390
|
"my": "Burmese",
|
391
|
+
"bm": "Bambara",
|
364
392
|
"be": "Byelorussian (Belarusian)",
|
365
393
|
"km": "Cambodian",
|
366
394
|
"ca": "Catalan",
|
@@ -428,6 +456,7 @@ module FlagIcon::Countries
|
|
428
456
|
"na": "Nauru",
|
429
457
|
"ne": "Nepali",
|
430
458
|
"no": "Norwegian",
|
459
|
+
"nb": "Bokmål",
|
431
460
|
"oc": "Occitan",
|
432
461
|
"or": "Oriya",
|
433
462
|
"om": "Oromo (Afan, Galla)",
|
@@ -0,0 +1,101 @@
|
|
1
|
+
module FlagIcon
|
2
|
+
# It returns the language name
|
3
|
+
#
|
4
|
+
# @param code -> language locale
|
5
|
+
# @example language_name('el') # => Greek
|
6
|
+
# @return String
|
7
|
+
def language_name(code)
|
8
|
+
FlagIcon::Countries::LANGUAGES[code.to_sym]
|
9
|
+
end
|
10
|
+
|
11
|
+
# It returns the country name
|
12
|
+
#
|
13
|
+
# @param code -> country iso code
|
14
|
+
# @example country_name('gr') # => Greece
|
15
|
+
# @return String
|
16
|
+
def country_name(code)
|
17
|
+
FlagIcon::Countries::NAMES[code.to_sym]
|
18
|
+
end
|
19
|
+
|
20
|
+
# It returns the country iso code
|
21
|
+
#
|
22
|
+
# @param code -> language locale
|
23
|
+
# @example language_flag('el') # => gr
|
24
|
+
# @return String
|
25
|
+
def language_flag(code)
|
26
|
+
FlagIcon::Countries::LANGUAGE_FLAGS[code.to_sym] || 'xx'
|
27
|
+
end
|
28
|
+
|
29
|
+
# It returns an array that can be used in the select tag
|
30
|
+
#
|
31
|
+
# @example select_language
|
32
|
+
# @return Array
|
33
|
+
def select_language
|
34
|
+
available_languages.map { |lang| [language_name(lang), lang] }
|
35
|
+
end
|
36
|
+
|
37
|
+
# It returns an hash of arrays that can be used in the select tag
|
38
|
+
#
|
39
|
+
# @param popular -> title of the popular group
|
40
|
+
# @param available -> title of the available group
|
41
|
+
# @example grouped_select_language(popular: 'Popular', available: 'Available')
|
42
|
+
# @return Hash
|
43
|
+
def grouped_select_language(popular: 'Popular', available: 'Available')
|
44
|
+
{
|
45
|
+
popular => popular_languages,
|
46
|
+
available => available_languages.map { |lang| [language_name(lang), lang] }
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# It returns HTML element with country icon and title
|
51
|
+
#
|
52
|
+
# @param code -> language locale
|
53
|
+
# @example language_icon('el')
|
54
|
+
# @return String
|
55
|
+
def language_icon(code, title: "Audio language - #{language_name(code)}")
|
56
|
+
"<span class='flag-icon flag-icon-#{language_flag(code)}' title='#{title}'></span>"
|
57
|
+
end
|
58
|
+
|
59
|
+
# It returns HTML element with country icon and title
|
60
|
+
#
|
61
|
+
# @param code -> country iso code
|
62
|
+
# @example country_icon('gr')
|
63
|
+
# @return String
|
64
|
+
def country_icon(code, title: "Available in #{country_name(code)}")
|
65
|
+
"<span class='flag-icon flag-icon-#{code}' title='#{title}'></span>"
|
66
|
+
end
|
67
|
+
|
68
|
+
# Define in your application_helper to override the popular languages
|
69
|
+
# Default: [['English', :en], ['Spanish', :es]]
|
70
|
+
#
|
71
|
+
# @example
|
72
|
+
# def popular_languages
|
73
|
+
# [['English', :en], ['Spanish', :es]]
|
74
|
+
# end
|
75
|
+
# @return Array
|
76
|
+
def popular_languages
|
77
|
+
[['English', :en], ['Spanish', :es]]
|
78
|
+
end
|
79
|
+
|
80
|
+
# Define in your application_helper to override the available languages
|
81
|
+
# @example [['English', :en], ['Spanish', :es]] #default
|
82
|
+
# @example
|
83
|
+
# def available_languages
|
84
|
+
# Language.all.order(:language_locale).pluck(:language_locale)
|
85
|
+
# end
|
86
|
+
# @return Array
|
87
|
+
def available_languages
|
88
|
+
@languages ||= FlagIcon::Countries::LANGUAGES.keys
|
89
|
+
end
|
90
|
+
|
91
|
+
# exposed methods for testing
|
92
|
+
module_function :language_name
|
93
|
+
module_function :country_name
|
94
|
+
module_function :language_flag
|
95
|
+
module_function :select_language
|
96
|
+
module_function :grouped_select_language
|
97
|
+
module_function :language_icon
|
98
|
+
module_function :country_icon
|
99
|
+
module_function :popular_languages
|
100
|
+
module_function :available_languages
|
101
|
+
end
|
data/lib/flag_icon/railtie.rb
CHANGED
data/lib/flag_icon.rb
CHANGED
@@ -0,0 +1,109 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="225" height="150" version="1.1" id="svg36" sodipodi:docname="Alaska.svg" inkscape:version="0.92.3 (2405546, 2018-03-11)">
|
3
|
+
<metadata id="metadata40">
|
4
|
+
<rdf:RDF>
|
5
|
+
<cc:Work rdf:about="">
|
6
|
+
<dc:format>image/svg+xml</dc:format>
|
7
|
+
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
8
|
+
<dc:title>Flag of Alaska</dc:title>
|
9
|
+
</cc:Work>
|
10
|
+
</rdf:RDF>
|
11
|
+
</metadata>
|
12
|
+
<sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1920" inkscape:window-height="1015" id="namedview38" showgrid="false" inkscape:zoom="0.39124294" inkscape:cx="152.32568" inkscape:cy="103.21031" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="svg36"/>
|
13
|
+
<title id="title2">Flag of Alaska</title>
|
14
|
+
<defs id="defs17">
|
15
|
+
<g id="star5" style="fill:#ffb612">
|
16
|
+
<g id="cone">
|
17
|
+
<polygon id="triangle" points="0.5,1 0,0 0,1 " transform="rotate(18,3.1568758,-0.5)"/>
|
18
|
+
<use xlink:href="#triangle" transform="scale(-1,1)" id="use5" x="0" y="0" width="100%" height="100%"/>
|
19
|
+
</g>
|
20
|
+
<use xlink:href="#cone" transform="rotate(72)" id="use8" x="0" y="0" width="100%" height="100%"/>
|
21
|
+
<use xlink:href="#cone" transform="rotate(-72)" id="use10" x="0" y="0" width="100%" height="100%"/>
|
22
|
+
<use xlink:href="#cone" transform="rotate(144)" id="use12" x="0" y="0" width="100%" height="100%"/>
|
23
|
+
<use xlink:href="#cone" transform="rotate(-144)" id="use14" x="0" y="0" width="100%" height="100%"/>
|
24
|
+
</g>
|
25
|
+
</defs>
|
26
|
+
<g id="g3954" transform="translate(6.3000031,-850)">
|
27
|
+
<rect style="fill:#0f204b;stroke-width:0.15438506" y="850" x="-6.3000031" id="rect19" height="150" width="225"/>
|
28
|
+
<g transform="matrix(7.8,0,0,7.8,173.7,877.3)" style="fill:#ffb612" id="use21">
|
29
|
+
<g id="g174">
|
30
|
+
<polygon id="polygon170" points="0.5,1 0,0 0,1 " transform="rotate(18,3.1568758,-0.5)"/>
|
31
|
+
<use height="100%" width="100%" y="0" x="0" xlink:href="#triangle" transform="scale(-1,1)" id="use172"/>
|
32
|
+
</g>
|
33
|
+
<use height="100%" width="100%" y="0" x="0" xlink:href="#cone" transform="rotate(72)" id="use176"/>
|
34
|
+
<use height="100%" width="100%" y="0" x="0" xlink:href="#cone" transform="rotate(-72)" id="use178"/>
|
35
|
+
<use height="100%" width="100%" y="0" x="0" xlink:href="#cone" transform="rotate(144)" id="use180"/>
|
36
|
+
<use height="100%" width="100%" y="0" x="0" xlink:href="#cone" transform="rotate(-144)" id="use182"/>
|
37
|
+
</g>
|
38
|
+
<g transform="matrix(4.65,0,0,4.65,34.35,909.4)" style="fill:#ffb612" id="star">
|
39
|
+
<g id="g46">
|
40
|
+
<polygon id="polygon42" points="0.5,1 0,0 0,1 " transform="rotate(18,3.1568758,-0.5)"/>
|
41
|
+
<use height="100%" width="100%" y="0" x="0" xlink:href="#triangle" transform="scale(-1,1)" id="use44"/>
|
42
|
+
</g>
|
43
|
+
<use height="100%" width="100%" y="0" x="0" xlink:href="#cone" transform="rotate(72)" id="use48"/>
|
44
|
+
<use height="100%" width="100%" y="0" x="0" xlink:href="#cone" transform="rotate(-72)" id="use50"/>
|
45
|
+
<use height="100%" width="100%" y="0" x="0" xlink:href="#cone" transform="rotate(144)" id="use52"/>
|
46
|
+
<use height="100%" width="100%" y="0" x="0" xlink:href="#cone" transform="rotate(-144)" id="use54"/>
|
47
|
+
</g>
|
48
|
+
<g id="use24" style="fill:#ffb612" transform="matrix(4.65,0,0,4.65,59.4,918.7)">
|
49
|
+
<g id="g62">
|
50
|
+
<polygon transform="rotate(18,3.1568758,-0.5)" points="0,1 0.5,1 0,0 " id="polygon58"/>
|
51
|
+
<use id="use60" transform="scale(-1,1)" xlink:href="#triangle" x="0" y="0" width="100%" height="100%"/>
|
52
|
+
</g>
|
53
|
+
<use id="use64" transform="rotate(72)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
54
|
+
<use id="use66" transform="rotate(-72)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
55
|
+
<use id="use68" transform="rotate(144)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
56
|
+
<use id="use70" transform="rotate(-144)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
57
|
+
</g>
|
58
|
+
<g id="use26" style="fill:#ffb612" transform="matrix(4.65,0,0,4.65,71.85,932.05)">
|
59
|
+
<g id="g78">
|
60
|
+
<polygon transform="rotate(18,3.1568758,-0.5)" points="0,1 0.5,1 0,0 " id="polygon74"/>
|
61
|
+
<use id="use76" transform="scale(-1,1)" xlink:href="#triangle" x="0" y="0" width="100%" height="100%"/>
|
62
|
+
</g>
|
63
|
+
<use id="use80" transform="rotate(72)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
64
|
+
<use id="use82" transform="rotate(-72)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
65
|
+
<use id="use84" transform="rotate(144)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
66
|
+
<use id="use86" transform="rotate(-144)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
67
|
+
</g>
|
68
|
+
<g id="use28" style="fill:#ffb612" transform="matrix(4.65,0,0,4.65,84.45,946)">
|
69
|
+
<g id="g94">
|
70
|
+
<polygon transform="rotate(18,3.1568758,-0.5)" points="0,1 0.5,1 0,0 " id="polygon90"/>
|
71
|
+
<use id="use92" transform="scale(-1,1)" xlink:href="#triangle" x="0" y="0" width="100%" height="100%"/>
|
72
|
+
</g>
|
73
|
+
<use id="use96" transform="rotate(72)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
74
|
+
<use id="use98" transform="rotate(-72)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
75
|
+
<use id="use100" transform="rotate(144)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
76
|
+
<use id="use102" transform="rotate(-144)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
77
|
+
</g>
|
78
|
+
<g id="use30" style="fill:#ffb612" transform="matrix(4.65,0,0,4.65,121.95,959.35)">
|
79
|
+
<g id="g110">
|
80
|
+
<polygon transform="rotate(18,3.1568758,-0.5)" points="0,1 0.5,1 0,0 " id="polygon106"/>
|
81
|
+
<use id="use108" transform="scale(-1,1)" xlink:href="#triangle" x="0" y="0" width="100%" height="100%"/>
|
82
|
+
</g>
|
83
|
+
<use id="use112" transform="rotate(72)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
84
|
+
<use id="use114" transform="rotate(-72)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
85
|
+
<use id="use116" transform="rotate(144)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
86
|
+
<use id="use118" transform="rotate(-144)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
87
|
+
</g>
|
88
|
+
<g id="use32" style="fill:#ffb612" transform="matrix(4.65,0,0,4.65,82.8,965.65)">
|
89
|
+
<g id="g126">
|
90
|
+
<polygon transform="rotate(18,3.1568758,-0.5)" points="0,1 0.5,1 0,0 " id="polygon122"/>
|
91
|
+
<use id="use124" transform="scale(-1,1)" xlink:href="#triangle" x="0" y="0" width="100%" height="100%"/>
|
92
|
+
</g>
|
93
|
+
<use id="use128" transform="rotate(72)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
94
|
+
<use id="use130" transform="rotate(-72)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
95
|
+
<use id="use132" transform="rotate(144)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
96
|
+
<use id="use134" transform="rotate(-144)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
97
|
+
</g>
|
98
|
+
<g id="use34" style="fill:#ffb612" transform="matrix(4.65,0,0,4.65,111,974.95)">
|
99
|
+
<g id="g142">
|
100
|
+
<polygon transform="rotate(18,3.1568758,-0.5)" points="0,1 0.5,1 0,0 " id="polygon138"/>
|
101
|
+
<use id="use140" transform="scale(-1,1)" xlink:href="#triangle" x="0" y="0" width="100%" height="100%"/>
|
102
|
+
</g>
|
103
|
+
<use id="use144" transform="rotate(72)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
104
|
+
<use id="use146" transform="rotate(-72)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
105
|
+
<use id="use148" transform="rotate(144)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
106
|
+
<use id="use150" transform="rotate(-144)" xlink:href="#cone" x="0" y="0" width="100%" height="100%"/>
|
107
|
+
</g>
|
108
|
+
</g>
|
109
|
+
</svg>
|
@@ -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>
|
@@ -4,8 +4,9 @@
|
|
4
4
|
}
|
5
5
|
} @else {
|
6
6
|
@include flag-icon(ad);
|
7
|
+
@include flag-icon(ak);
|
7
8
|
@include flag-icon(ae);
|
8
|
-
@include flag-icon(ab);
|
9
|
+
@include flag-icon(ab);
|
9
10
|
@include flag-icon(af);
|
10
11
|
@include flag-icon(ag);
|
11
12
|
@include flag-icon(ai);
|
@@ -112,7 +113,6 @@
|
|
112
113
|
@include flag-icon(il);
|
113
114
|
@include flag-icon(im);
|
114
115
|
@include flag-icon(in);
|
115
|
-
@include flag-icon(hi); // from in
|
116
116
|
@include flag-icon(io);
|
117
117
|
@include flag-icon(iq);
|
118
118
|
@include flag-icon(ir);
|
@@ -122,7 +122,6 @@
|
|
122
122
|
@include flag-icon(jm);
|
123
123
|
@include flag-icon(jo);
|
124
124
|
@include flag-icon(jp);
|
125
|
-
@include flag-icon(ja); // from jp
|
126
125
|
@include flag-icon(ke);
|
127
126
|
@include flag-icon(kg);
|
128
127
|
@include flag-icon(kh);
|
@@ -269,6 +268,7 @@
|
|
269
268
|
@include flag-icon(ea);
|
270
269
|
@include flag-icon(es-ct);
|
271
270
|
@include flag-icon(es-ga);
|
271
|
+
@include flag-icon(es-eu);
|
272
272
|
@include flag-icon(eu);
|
273
273
|
@include flag-icon(gb-eng);
|
274
274
|
@include flag-icon(gb-nir);
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flag_icon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alexwebgr
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '6.1'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '6.1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rake
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,16 +56,16 @@ dependencies:
|
|
42
56
|
name: simplecov
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
61
|
+
version: '0.21'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
68
|
+
version: '0.21'
|
55
69
|
description: A gem that contains view helpers for language names, country names and
|
56
70
|
language to flags
|
57
71
|
email:
|
@@ -61,8 +75,10 @@ extensions: []
|
|
61
75
|
extra_rdoc_files: []
|
62
76
|
files:
|
63
77
|
- ".github/workflows/main.yml"
|
78
|
+
- ".github/workflows/publish.yml"
|
64
79
|
- ".gitignore"
|
65
80
|
- ".rspec"
|
81
|
+
- ".ruby-version"
|
66
82
|
- CODE_OF_CONDUCT.md
|
67
83
|
- Gemfile
|
68
84
|
- Gemfile.lock
|
@@ -72,7 +88,7 @@ files:
|
|
72
88
|
- flag_icon.gemspec
|
73
89
|
- lib/flag_icon.rb
|
74
90
|
- lib/flag_icon/countries.rb
|
75
|
-
- lib/flag_icon/
|
91
|
+
- lib/flag_icon/helpers.rb
|
76
92
|
- lib/flag_icon/rails.rb
|
77
93
|
- lib/flag_icon/rails/engine.rb
|
78
94
|
- lib/flag_icon/rails/version.rb
|
@@ -84,6 +100,7 @@ files:
|
|
84
100
|
- vendor/assets/images/flags/4x3/af.svg
|
85
101
|
- vendor/assets/images/flags/4x3/ag.svg
|
86
102
|
- vendor/assets/images/flags/4x3/ai.svg
|
103
|
+
- vendor/assets/images/flags/4x3/ak.svg
|
87
104
|
- vendor/assets/images/flags/4x3/al.svg
|
88
105
|
- vendor/assets/images/flags/4x3/am.svg
|
89
106
|
- vendor/assets/images/flags/4x3/ao.svg
|
@@ -151,6 +168,7 @@ files:
|
|
151
168
|
- vendor/assets/images/flags/4x3/en.svg
|
152
169
|
- vendor/assets/images/flags/4x3/er.svg
|
153
170
|
- vendor/assets/images/flags/4x3/es-ct.svg
|
171
|
+
- vendor/assets/images/flags/4x3/es-eu.svg
|
154
172
|
- vendor/assets/images/flags/4x3/es-ga.svg
|
155
173
|
- vendor/assets/images/flags/4x3/es.svg
|
156
174
|
- vendor/assets/images/flags/4x3/et.svg
|
@@ -184,7 +202,6 @@ files:
|
|
184
202
|
- vendor/assets/images/flags/4x3/gu.svg
|
185
203
|
- vendor/assets/images/flags/4x3/gw.svg
|
186
204
|
- vendor/assets/images/flags/4x3/gy.svg
|
187
|
-
- vendor/assets/images/flags/4x3/hi.svg
|
188
205
|
- vendor/assets/images/flags/4x3/hk.svg
|
189
206
|
- vendor/assets/images/flags/4x3/hm.svg
|
190
207
|
- vendor/assets/images/flags/4x3/hn.svg
|
@@ -360,7 +377,7 @@ licenses:
|
|
360
377
|
metadata:
|
361
378
|
homepage_uri: https://github.com/alexwebgr/flag_icon
|
362
379
|
source_code_uri: https://github.com/alexwebgr/flag_icon
|
363
|
-
post_install_message:
|
380
|
+
post_install_message:
|
364
381
|
rdoc_options: []
|
365
382
|
require_paths:
|
366
383
|
- lib
|
@@ -376,8 +393,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
376
393
|
- !ruby/object:Gem::Version
|
377
394
|
version: '0'
|
378
395
|
requirements: []
|
379
|
-
rubygems_version: 3.2.
|
380
|
-
signing_key:
|
396
|
+
rubygems_version: 3.2.32
|
397
|
+
signing_key:
|
381
398
|
specification_version: 4
|
382
399
|
summary: An attempt to map languages to country flags
|
383
400
|
test_files: []
|
data/lib/flag_icon/helper.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
module FlagIcon
|
2
|
-
private
|
3
|
-
|
4
|
-
def language_name(code)
|
5
|
-
FlagIcon::Countries::LANGUAGES[code.to_sym]
|
6
|
-
end
|
7
|
-
|
8
|
-
def country_name(code)
|
9
|
-
FlagIcon::Countries::NAMES[code.to_sym]
|
10
|
-
end
|
11
|
-
|
12
|
-
def language_flag(code)
|
13
|
-
FlagIcon::Countries::LANGUAGE_FLAGS[code.to_sym]
|
14
|
-
end
|
15
|
-
|
16
|
-
def select_language
|
17
|
-
{
|
18
|
-
'Popular' => popular_languages,
|
19
|
-
'Available' => available_languages.map { |lang| [language_name(lang), lang] }
|
20
|
-
}
|
21
|
-
end
|
22
|
-
|
23
|
-
def language_icon(code)
|
24
|
-
"<span class='flag-icon flag-icon-#{language_flag(code)}' title='Audio language - #{language_name(code)}'></span>"
|
25
|
-
end
|
26
|
-
|
27
|
-
def flag_icon(code)
|
28
|
-
"<span class='flag-icon flag-icon-#{code}' title='Available in #{country_name(code)}'></span>"
|
29
|
-
end
|
30
|
-
|
31
|
-
public
|
32
|
-
|
33
|
-
def popular_languages
|
34
|
-
[['English', :en], ['Spanish', :es]]
|
35
|
-
end
|
36
|
-
|
37
|
-
def available_languages
|
38
|
-
@languages ||= FlagIcon::Countries::LANGUAGES.keys
|
39
|
-
end
|
40
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="flag-icons-in" viewBox="0 0 640 480">
|
2
|
-
<path fill="#f93" d="M0 0h640v160H0z"/>
|
3
|
-
<path fill="#fff" d="M0 160h640v160H0z"/>
|
4
|
-
<path fill="#128807" d="M0 320h640v160H0z"/>
|
5
|
-
<g transform="matrix(3.2 0 0 3.2 320 240)">
|
6
|
-
<circle r="20" fill="#008"/>
|
7
|
-
<circle r="17.5" fill="#fff"/>
|
8
|
-
<circle r="3.5" fill="#008"/>
|
9
|
-
<g id="d">
|
10
|
-
<g id="c">
|
11
|
-
<g id="b">
|
12
|
-
<g id="a" fill="#008">
|
13
|
-
<circle r=".9" transform="rotate(7.5 -8.8 133.5)"/>
|
14
|
-
<path d="M0 17.5.6 7 0 2l-.6 5L0 17.5z"/>
|
15
|
-
</g>
|
16
|
-
<use xlink:href="#a" width="100%" height="100%" transform="rotate(15)"/>
|
17
|
-
</g>
|
18
|
-
<use xlink:href="#b" width="100%" height="100%" transform="rotate(30)"/>
|
19
|
-
</g>
|
20
|
-
<use xlink:href="#c" width="100%" height="100%" transform="rotate(60)"/>
|
21
|
-
</g>
|
22
|
-
<use xlink:href="#d" width="100%" height="100%" transform="rotate(120)"/>
|
23
|
-
<use xlink:href="#d" width="100%" height="100%" transform="rotate(-120)"/>
|
24
|
-
</g>
|
25
|
-
</svg>
|