refinerycms-i18n 0.9.8.11 → 0.9.8.12
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.
- data/config/locales/{sv-SE.yml → sv.yml} +1 -1
- data/lib/gemspec.rb +1 -1
- data/lib/refinery/i18n.rb +28 -23
- metadata +4 -9
data/lib/gemspec.rb
CHANGED
data/lib/refinery/i18n.rb
CHANGED
|
@@ -12,7 +12,7 @@ module Refinery
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
config.to_prepare do
|
|
15
|
-
::ApplicationController.class_eval
|
|
15
|
+
::ApplicationController.class_eval do
|
|
16
16
|
def default_url_options(options={})
|
|
17
17
|
::Refinery::I18n.enabled? ? { :locale => ::I18n.locale } : {}
|
|
18
18
|
end
|
|
@@ -25,7 +25,7 @@ module Refinery
|
|
|
25
25
|
::I18n.locale = locale
|
|
26
26
|
elsif locale.present? and locale != ::Refinery::I18n.default_frontend_locale
|
|
27
27
|
params[:locale] = I18n.locale = ::Refinery::I18n.default_frontend_locale
|
|
28
|
-
redirect_to(params, :notice => "The locale '
|
|
28
|
+
redirect_to(params, :notice => "The locale '#{locale.to_s}' is not supported.") and return
|
|
29
29
|
else
|
|
30
30
|
::I18n.locale = ::Refinery::I18n.default_frontend_locale
|
|
31
31
|
end
|
|
@@ -33,9 +33,11 @@ module Refinery
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
protected :default_url_options, :find_or_set_locale
|
|
36
|
-
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
::Admin::BaseController.class_eval do
|
|
39
|
+
prepend_before_filter :find_or_set_locale
|
|
37
40
|
|
|
38
|
-
::Refinery::AdminBaseController.class_eval %{
|
|
39
41
|
def find_or_set_locale
|
|
40
42
|
if (params[:set_locale].present? and ::Refinery::I18n.locales.include?(params[:set_locale].to_sym))
|
|
41
43
|
::Refinery::I18n.current_locale = params[:set_locale].to_sym
|
|
@@ -46,7 +48,7 @@ module Refinery
|
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
protected :find_or_set_locale
|
|
49
|
-
|
|
51
|
+
end
|
|
50
52
|
end
|
|
51
53
|
|
|
52
54
|
config.after_initialize do
|
|
@@ -57,7 +59,7 @@ module Refinery
|
|
|
57
59
|
|
|
58
60
|
class << self
|
|
59
61
|
|
|
60
|
-
attr_accessor :enabled, :current_locale, :locales, :default_locale, :default_frontend_locale
|
|
62
|
+
attr_accessor :enabled, :current_locale, :locales, :default_locale, :default_frontend_locale, :built_in_locales
|
|
61
63
|
|
|
62
64
|
def enabled?
|
|
63
65
|
# cache this lookup as it gets very expensive.
|
|
@@ -117,22 +119,7 @@ module Refinery
|
|
|
117
119
|
end
|
|
118
120
|
|
|
119
121
|
def locales
|
|
120
|
-
@locales ||= RefinerySetting.find_or_set(:i18n_translation_locales,
|
|
121
|
-
:en => 'English',
|
|
122
|
-
:fr => 'Français',
|
|
123
|
-
:nl => 'Nederlands',
|
|
124
|
-
:'pt-BR' => 'Português',
|
|
125
|
-
:da => 'Dansk',
|
|
126
|
-
:nb => 'Norsk Bokmål',
|
|
127
|
-
:sl => 'Slovenian',
|
|
128
|
-
:es => 'Español',
|
|
129
|
-
:it => 'Italiano',
|
|
130
|
-
:'zh-CN' => 'Simple Chinese',
|
|
131
|
-
:de => 'Deutsch',
|
|
132
|
-
:lv => 'Latviski',
|
|
133
|
-
:ru => 'Русский',
|
|
134
|
-
:sv => 'Svenska'
|
|
135
|
-
},
|
|
122
|
+
@locales ||= RefinerySetting.find_or_set(:i18n_translation_locales, self.built_in_locales,
|
|
136
123
|
{
|
|
137
124
|
:scoping => 'refinery',
|
|
138
125
|
:callback_proc_as_string => %q{::Refinery::I18n.setup!}
|
|
@@ -167,7 +154,7 @@ module Refinery
|
|
|
167
154
|
RefinerySetting.find_by_name_and_scoping('i18n_translation_locales', 'refinery').try(:value)
|
|
168
155
|
end
|
|
169
156
|
|
|
170
|
-
if locales.present? and locales.is_a?(Hash) and locales.keys.exclude?(
|
|
157
|
+
if locales.present? and locales.is_a?(Hash) and locales.keys.exclude?(self.built_in_locales.keys.last)
|
|
171
158
|
value = {:value => nil, :scoping => 'refinery'}
|
|
172
159
|
if RefinerySetting.respond_to?(:set)
|
|
173
160
|
RefinerySetting.set(:i18n_translation_locales, value)
|
|
@@ -202,5 +189,23 @@ module Refinery
|
|
|
202
189
|
end
|
|
203
190
|
|
|
204
191
|
end
|
|
192
|
+
|
|
193
|
+
@built_in_locales = {
|
|
194
|
+
:en => 'English',
|
|
195
|
+
:fr => 'Français',
|
|
196
|
+
:nl => 'Nederlands',
|
|
197
|
+
:'pt-BR' => 'Português',
|
|
198
|
+
:da => 'Dansk',
|
|
199
|
+
:nb => 'Norsk Bokmål',
|
|
200
|
+
:sl => 'Slovenian',
|
|
201
|
+
:es => 'Español',
|
|
202
|
+
:it => 'Italiano',
|
|
203
|
+
:'zh-CN' => 'Simple Chinese',
|
|
204
|
+
:de => 'Deutsch',
|
|
205
|
+
:lv => 'Latviski',
|
|
206
|
+
:ru => 'Русский',
|
|
207
|
+
:sv => 'Svenska',
|
|
208
|
+
:pl => 'Polski'
|
|
209
|
+
}
|
|
205
210
|
end
|
|
206
211
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: refinerycms-i18n
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash: 49
|
|
5
4
|
prerelease: false
|
|
6
5
|
segments:
|
|
7
6
|
- 0
|
|
8
7
|
- 9
|
|
9
8
|
- 8
|
|
10
|
-
-
|
|
11
|
-
version: 0.9.8.
|
|
9
|
+
- 12
|
|
10
|
+
version: 0.9.8.12
|
|
12
11
|
platform: ruby
|
|
13
12
|
authors:
|
|
14
13
|
- Resolve Digital
|
|
@@ -16,7 +15,7 @@ autorequire:
|
|
|
16
15
|
bindir: bin
|
|
17
16
|
cert_chain: []
|
|
18
17
|
|
|
19
|
-
date: 2010-
|
|
18
|
+
date: 2010-12-02 00:00:00 +13:00
|
|
20
19
|
default_executable:
|
|
21
20
|
dependencies:
|
|
22
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -27,7 +26,6 @@ dependencies:
|
|
|
27
26
|
requirements:
|
|
28
27
|
- - ">="
|
|
29
28
|
- !ruby/object:Gem::Version
|
|
30
|
-
hash: 43
|
|
31
29
|
segments:
|
|
32
30
|
- 0
|
|
33
31
|
- 9
|
|
@@ -43,7 +41,6 @@ dependencies:
|
|
|
43
41
|
requirements:
|
|
44
42
|
- - ~>
|
|
45
43
|
- !ruby/object:Gem::Version
|
|
46
|
-
hash: 23
|
|
47
44
|
segments:
|
|
48
45
|
- 0
|
|
49
46
|
- 1
|
|
@@ -110,7 +107,7 @@ files:
|
|
|
110
107
|
- config/locales/sl.yml
|
|
111
108
|
- config/locales/sr-Latn.yml
|
|
112
109
|
- config/locales/sr.yml
|
|
113
|
-
- config/locales/sv
|
|
110
|
+
- config/locales/sv.yml
|
|
114
111
|
- config/locales/sw.yml
|
|
115
112
|
- config/locales/th.rb
|
|
116
113
|
- config/locales/tr.yml
|
|
@@ -161,7 +158,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
161
158
|
requirements:
|
|
162
159
|
- - ">="
|
|
163
160
|
- !ruby/object:Gem::Version
|
|
164
|
-
hash: 3
|
|
165
161
|
segments:
|
|
166
162
|
- 0
|
|
167
163
|
version: "0"
|
|
@@ -170,7 +166,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
170
166
|
requirements:
|
|
171
167
|
- - ">="
|
|
172
168
|
- !ruby/object:Gem::Version
|
|
173
|
-
hash: 3
|
|
174
169
|
segments:
|
|
175
170
|
- 0
|
|
176
171
|
version: "0"
|