i18n_plus 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/lib/i18n_plus/country.rb +3 -1
- data/lib/i18n_plus/currency.rb +3 -1
- data/lib/i18n_plus/language.rb +3 -1
- data/lib/i18n_plus/locale.rb +3 -1
- data/lib/i18n_plus/state.rb +3 -1
- data/lib/i18n_plus/version.rb +1 -1
- data/test/state_test.rb +4 -4
- metadata +21 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfe521e9da818def80a2e4ee4161ff31b8c17c6e
|
4
|
+
data.tar.gz: a702755030ac27e0231b471a705c500da3c28eee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4973ac195f0de5848838712a0f68195a00102468563cee8b7ba358094f98119464110aba445a7602049aa255a84cb4f3ab2f3d92e67b9af099e5d98c466ec637
|
7
|
+
data.tar.gz: 3eede5bf87259a4cb577c9162d0a456a7ab8085969bdf204710127622167486283aa332498238ac7d065ac3bca25f8e5ca0c773a7d8e3a56232aa048b19ca050
|
data/LICENSE
CHANGED
data/lib/i18n_plus/country.rb
CHANGED
@@ -6,7 +6,9 @@ module I18nPlus
|
|
6
6
|
|
7
7
|
def self.countries(*args)
|
8
8
|
options = args.extract_options!
|
9
|
-
locale = (options[:locale] || I18n.locale || I18n.default_locale).to_s.downcase
|
9
|
+
locale = (options[:locale] || I18n.locale || I18n.default_locale || :en).to_s[0..1].downcase
|
10
|
+
# Fallback to English if we don't use English or German
|
11
|
+
locale = 'en' unless ['de', 'en'].include?(locale)
|
10
12
|
COUNTRIES[locale]
|
11
13
|
end
|
12
14
|
|
data/lib/i18n_plus/currency.rb
CHANGED
@@ -6,7 +6,9 @@ module I18nPlus
|
|
6
6
|
|
7
7
|
def self.currencies(*args)
|
8
8
|
options = args.extract_options!
|
9
|
-
locale = (options[:locale] || I18n.locale || I18n.default_locale).to_s.downcase
|
9
|
+
locale = (options[:locale] || I18n.locale || I18n.default_locale || :en).to_s[0..1].downcase
|
10
|
+
# Fallback to English if we don't use English or German
|
11
|
+
locale = 'en' unless ['de', 'en'].include?(locale)
|
10
12
|
CURRENCIES[locale]
|
11
13
|
end
|
12
14
|
|
data/lib/i18n_plus/language.rb
CHANGED
@@ -6,7 +6,9 @@ module I18nPlus
|
|
6
6
|
|
7
7
|
def self.languages(*args)
|
8
8
|
options = args.extract_options!
|
9
|
-
locale = (options[:locale] || I18n.locale || I18n.default_locale).to_s.downcase
|
9
|
+
locale = (options[:locale] || I18n.locale || I18n.default_locale || :en).to_s[0..1].downcase
|
10
|
+
# Fallback to English if we don't use English or German
|
11
|
+
locale = 'en' unless ['de', 'en'].include?(locale)
|
10
12
|
LANGUAGES[locale]
|
11
13
|
end
|
12
14
|
|
data/lib/i18n_plus/locale.rb
CHANGED
@@ -6,7 +6,9 @@ module I18nPlus
|
|
6
6
|
|
7
7
|
def self.locales(*args)
|
8
8
|
options = args.extract_options!
|
9
|
-
locale = (options[:locale] || I18n.locale || I18n.default_locale).to_s.downcase
|
9
|
+
locale = (options[:locale] || I18n.locale || I18n.default_locale || :en).to_s[0..1].downcase
|
10
|
+
# Fallback to English if we don't use English or German
|
11
|
+
locale = 'en' unless ['de', 'en'].include?(locale)
|
10
12
|
LOCALES[locale]
|
11
13
|
end
|
12
14
|
|
data/lib/i18n_plus/state.rb
CHANGED
@@ -6,7 +6,9 @@ module I18nPlus
|
|
6
6
|
|
7
7
|
def self.states(country_code, *args)
|
8
8
|
options = args.extract_options!
|
9
|
-
locale = (options[:locale] || I18n.locale || I18n.default_locale).to_s.downcase
|
9
|
+
locale = (options[:locale] || I18n.locale || I18n.default_locale || :en).to_s[0..1].downcase
|
10
|
+
# Fallback to English if we don't use English or German
|
11
|
+
locale = 'en' unless ['de', 'en'].include?(locale)
|
10
12
|
STATES[locale][country_code.to_s.upcase]
|
11
13
|
end
|
12
14
|
|
data/lib/i18n_plus/version.rb
CHANGED
data/test/state_test.rb
CHANGED
@@ -38,11 +38,11 @@ class StateTest < ActiveSupport::TestCase
|
|
38
38
|
assert_not_nil results = state_select(@account, :state, 'DE').gsub(/\n/, '')
|
39
39
|
|
40
40
|
if ActiveSupport::VERSION::STRING < '4.0'
|
41
|
-
assert_match
|
42
|
-
assert_match
|
41
|
+
assert_match(/<select id="account_state" name="account\[state\]">/, results)
|
42
|
+
assert_match(/<option value="BY" selected="selected">Bavaria<\/option>/, results)
|
43
43
|
else
|
44
|
-
assert_match
|
45
|
-
assert_match
|
44
|
+
assert_match(/<select name="account\[state\]" id="account_state">/, results)
|
45
|
+
assert_match(/<option selected="selected" value="BY">Bavaria<\/option>/, results)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Eilhard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -76,70 +76,70 @@ dependencies:
|
|
76
76
|
requirements:
|
77
77
|
- - "~>"
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: 1.
|
79
|
+
version: '1.13'
|
80
80
|
type: :development
|
81
81
|
prerelease: false
|
82
82
|
version_requirements: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
84
|
- - "~>"
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version: 1.
|
86
|
+
version: '1.13'
|
87
87
|
- !ruby/object:Gem::Dependency
|
88
88
|
name: rdoc
|
89
89
|
requirement: !ruby/object:Gem::Requirement
|
90
90
|
requirements:
|
91
91
|
- - "~>"
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 2
|
93
|
+
version: '4.2'
|
94
94
|
type: :development
|
95
95
|
prerelease: false
|
96
96
|
version_requirements: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
98
|
- - "~>"
|
99
99
|
- !ruby/object:Gem::Version
|
100
|
-
version: 2
|
100
|
+
version: '4.2'
|
101
101
|
- !ruby/object:Gem::Dependency
|
102
102
|
name: mocha
|
103
103
|
requirement: !ruby/object:Gem::Requirement
|
104
104
|
requirements:
|
105
105
|
- - "~>"
|
106
106
|
- !ruby/object:Gem::Version
|
107
|
-
version: 1.1
|
107
|
+
version: '1.1'
|
108
108
|
type: :development
|
109
109
|
prerelease: false
|
110
110
|
version_requirements: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|
112
112
|
- - "~>"
|
113
113
|
- !ruby/object:Gem::Version
|
114
|
-
version: 1.1
|
114
|
+
version: '1.1'
|
115
115
|
- !ruby/object:Gem::Dependency
|
116
116
|
name: rake
|
117
117
|
requirement: !ruby/object:Gem::Requirement
|
118
118
|
requirements:
|
119
|
-
- - "
|
119
|
+
- - "~>"
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version: '0'
|
121
|
+
version: '12.0'
|
122
122
|
type: :development
|
123
123
|
prerelease: false
|
124
124
|
version_requirements: !ruby/object:Gem::Requirement
|
125
125
|
requirements:
|
126
|
-
- - "
|
126
|
+
- - "~>"
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version: '0'
|
128
|
+
version: '12.0'
|
129
129
|
- !ruby/object:Gem::Dependency
|
130
130
|
name: minitest
|
131
131
|
requirement: !ruby/object:Gem::Requirement
|
132
132
|
requirements:
|
133
|
-
- - "
|
133
|
+
- - "~>"
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version: '
|
135
|
+
version: '5.10'
|
136
136
|
type: :development
|
137
137
|
prerelease: false
|
138
138
|
version_requirements: !ruby/object:Gem::Requirement
|
139
139
|
requirements:
|
140
|
-
- - "
|
140
|
+
- - "~>"
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version: '
|
142
|
+
version: '5.10'
|
143
143
|
description: A library for i18n of countries, states, currencies, and locales.
|
144
144
|
email:
|
145
145
|
- oliver.eilhard@gmail.com
|
@@ -171,7 +171,8 @@ files:
|
|
171
171
|
- test/locale_test.rb
|
172
172
|
- test/state_test.rb
|
173
173
|
homepage: http://github.com/olivere/i18n_plus
|
174
|
-
licenses:
|
174
|
+
licenses:
|
175
|
+
- MIT
|
175
176
|
metadata: {}
|
176
177
|
post_install_message:
|
177
178
|
rdoc_options:
|
@@ -190,10 +191,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
191
|
version: 1.3.6
|
191
192
|
requirements: []
|
192
193
|
rubyforge_project:
|
193
|
-
rubygems_version: 2.
|
194
|
+
rubygems_version: 2.5.1
|
194
195
|
signing_key:
|
195
196
|
specification_version: 4
|
196
|
-
summary:
|
197
|
+
summary: Internally used for working with countries, currencies, and locales. Only
|
198
|
+
supports English and German.
|
197
199
|
test_files:
|
198
200
|
- test/country_test.rb
|
199
201
|
- test/currency_test.rb
|