air18n 0.3.0 → 0.4.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.
- data/lib/air18n/class_methods.rb +9 -0
- data/lib/air18n/version.rb +1 -1
- data/spec/lib/air18n/air18n_spec.rb +6 -0
- metadata +1 -1
data/lib/air18n/class_methods.rb
CHANGED
@@ -226,6 +226,15 @@ module Air18n
|
|
226
226
|
self.backend = Air18n::LessSillyChain.new(@air18n_backend, I18n::Backend::Simple.new)
|
227
227
|
end
|
228
228
|
|
229
|
+
# Call after reset() to override fallbacks. For example,
|
230
|
+
#
|
231
|
+
# override_fallbacks(:es, [:es, :"es-419", :en])
|
232
|
+
#
|
233
|
+
# to make :es's fallbacks include :"es-419".
|
234
|
+
def override_fallbacks(fully_specified_locale, fallbacks)
|
235
|
+
@fallbacks[fully_specified_locale] = fallbacks
|
236
|
+
end
|
237
|
+
|
229
238
|
# Return the fallback locales for the_locale.
|
230
239
|
# If opts[:exclude_default] is set, the default locale, which is otherwise
|
231
240
|
# always the last one in the returned list, will be excluded.
|
data/lib/air18n/version.rb
CHANGED
@@ -14,6 +14,12 @@ describe Air18n do
|
|
14
14
|
I18n.fallbacks_for(:fr, :exclude_default => true).should == [:fr]
|
15
15
|
I18n.fallbacks_for(:fr).should == [:fr, :en]
|
16
16
|
end
|
17
|
+
|
18
|
+
it 'should be able to override fallbacks' do
|
19
|
+
I18n.fallbacks_for(:zz).should == [:zz, :en]
|
20
|
+
I18n.override_fallbacks(:zz, [:zz, :"zz-419", :en])
|
21
|
+
I18n.fallbacks_for(:zz).should == [:zz, :"zz-419", :en]
|
22
|
+
end
|
17
23
|
end
|
18
24
|
|
19
25
|
context 'language_from_locale' do
|