air18n 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.
@@ -1,3 +1,3 @@
1
1
  module Air18n
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: air18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: