world-flags 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.4
|
@@ -1,12 +1,13 @@
|
|
1
|
-
WorldFlags.
|
1
|
+
WorldFlags.config do |c|
|
2
|
+
c.auto_select!
|
2
3
|
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# country_codes_en = JSON.parse File.read(cc_path)
|
4
|
+
# c.available_locales = [:en, :da]
|
5
|
+
# c.locale_source_priority = [:param, :domain, :browser, :ip]
|
6
6
|
|
7
|
-
#
|
8
|
-
#
|
7
|
+
# c.languages = languages_hash # fx loaded from a yaml file
|
8
|
+
# c.countries = countries_hash # fx loaded from a yaml file
|
9
|
+
# c.locale_flag_map = hash
|
10
|
+
end
|
11
|
+
|
9
12
|
|
10
|
-
# WorldFlags.active_locales = [:en, :da]
|
11
13
|
|
12
|
-
# WorldFlags.locale_flag_map = some hash
|
data/lib/world-flags.rb
CHANGED
@@ -15,6 +15,10 @@ module WorldFlags
|
|
15
15
|
attr_writer :active_locales
|
16
16
|
attr_writer :locale_flag_map
|
17
17
|
|
18
|
+
def config &block
|
19
|
+
(block_given? && block.arity == 1) ? yield(self) : instance_eval(&block)
|
20
|
+
end
|
21
|
+
|
18
22
|
def label code = :us, options = {:language => :en}
|
19
23
|
locale = extract_locale!(options) || default_locale_used || :en
|
20
24
|
options[:country] ? country_label(code, locale) : language_label(code, locale)
|
@@ -5,11 +5,14 @@ describe WorldFlags::Helper::View do
|
|
5
5
|
WorldFlags::Helper::View
|
6
6
|
|
7
7
|
before do
|
8
|
-
WorldFlags.auto_select!
|
9
8
|
I18n.locale = 'ar'
|
10
|
-
|
11
|
-
WorldFlags.
|
12
|
-
|
9
|
+
|
10
|
+
WorldFlags.config do |c|
|
11
|
+
c.auto_select!
|
12
|
+
c.available_locales = [:da, :sv, :nb, :en]
|
13
|
+
c.reset!
|
14
|
+
c.raise_error!
|
15
|
+
end
|
13
16
|
end
|
14
17
|
|
15
18
|
it 'should translate flag code to locale' do
|
data/world-flags.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "world-flags"
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
12
|
-
s.date = "2012-05-
|
12
|
+
s.date = "2012-05-15"
|
13
13
|
s.description = "Use world flag icons in your Rails app"
|
14
14
|
s.email = "kmandrup@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: world-flags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|
@@ -194,7 +194,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
194
194
|
version: '0'
|
195
195
|
segments:
|
196
196
|
- 0
|
197
|
-
hash:
|
197
|
+
hash: -3562672022854432421
|
198
198
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
199
|
none: false
|
200
200
|
requirements:
|