i18n_country_select 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +2 -0
- data/lib/i18n_country_select/instance_tag.rb +12 -7
- data/lib/i18n_country_select/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8a026a41da14e56bad8b0786f4aef709bc23641
|
4
|
+
data.tar.gz: 78dd51ce4c65223a2945bd91485ba5c2a47a8e46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1158751db20c917c1f0c2367fcffaf6b1697a5a70d426c6eac04a84459596638bfa1f7e588e7c445d23400dfd2941dcc0287d2bf81bd9035f46879837729e14e
|
7
|
+
data.tar.gz: ceaf9b792be40478da5812e5a5feaf597fa3227f5fb390da754a3f806c5468a73f35f7bb19b00a813eb1414297a5d9a78ae02dddbf32e5fb172b3da59e0436ce
|
data/README.rdoc
CHANGED
@@ -37,10 +37,12 @@ Supplying priority countries to be placed at the top of the list:
|
|
37
37
|
* Victor D. (https://github.com/V1c70r)
|
38
38
|
* Alexey Degtyarev (https://github.com/alexhifer)
|
39
39
|
* Björn Wilmsmann (https://github.com/BjoernKW)
|
40
|
+
* https://github.com/durandom
|
40
41
|
|
41
42
|
Based on the deprecated country_code_select by: Russ Smith (russ@bashme.org) and Frank Wambutt (frank@mo-stud.io)
|
42
43
|
|
43
44
|
== Version History
|
45
|
+
* 1.1.2 - Adding Thread variable to speed up rendering
|
44
46
|
* 1.1.1 - Bumping required version of country translations
|
45
47
|
* 1.1.0 - Rails 4 support
|
46
48
|
* 1.0.19 - Added Macedonia
|
@@ -10,13 +10,6 @@ module I18nCountrySelect
|
|
10
10
|
def country_code_select(priority_countries, options, html_options)
|
11
11
|
selected = object.send(@method_name) if object.respond_to?(@method_name)
|
12
12
|
|
13
|
-
country_translations = country_translations = COUNTRY_CODES.map do |code|
|
14
|
-
translation = I18n.t(code, :scope => :countries, :default => 'missing')
|
15
|
-
translation == 'missing' ? nil : [translation, code]
|
16
|
-
end.compact.sort_by do |translation, code|
|
17
|
-
normalize_translation(translation)
|
18
|
-
end
|
19
|
-
|
20
13
|
countries = ""
|
21
14
|
|
22
15
|
if options.present? and options[:include_blank]
|
@@ -37,6 +30,18 @@ module I18nCountrySelect
|
|
37
30
|
content_tag(:select, countries.html_safe, html_options)
|
38
31
|
end
|
39
32
|
|
33
|
+
def country_translations
|
34
|
+
Thread.current[:country_translations] ||= {}
|
35
|
+
Thread.current[:country_translations][I18n.locale] ||= begin
|
36
|
+
COUNTRY_CODES.map do |code|
|
37
|
+
translation = I18n.t(code, :scope => :countries, :default => 'missing')
|
38
|
+
translation == 'missing' ? nil : [translation, code]
|
39
|
+
end.compact.sort_by do |translation, code|
|
40
|
+
normalize_translation(translation)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
40
45
|
private
|
41
46
|
def normalize_translation(translation)
|
42
47
|
UnicodeUtils.canonical_decomposition(translation).split('').select do |c|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n_country_select
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian McQuay (brian@onomojo.com)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|