air18n 0.1.50 → 0.1.51
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/backend.rb +3 -1
- data/lib/air18n/version.rb +1 -1
- data/spec/lib/air18n/backend_spec.rb +8 -6
- metadata +1 -1
data/lib/air18n/backend.rb
CHANGED
@@ -185,7 +185,9 @@ module Air18n
|
|
185
185
|
default = options[:default] && options[:default].is_a?(String) && options[:default]
|
186
186
|
overrides_previous_default = !options[:default_is_low_priority]
|
187
187
|
|
188
|
-
|
188
|
+
I18n.fallbacks_for(locale).each do |l|
|
189
|
+
init_translations(l)
|
190
|
+
end
|
189
191
|
|
190
192
|
# Only create new screenshots while using default locale, and ignore keys
|
191
193
|
# that come in hash format or with a wacky namespace
|
data/lib/air18n/version.rb
CHANGED
@@ -79,17 +79,19 @@ describe Air18n::Backend do
|
|
79
79
|
it 'should lazily load all translations on startup' do
|
80
80
|
@backend = Air18n::Backend.new
|
81
81
|
@backend.available_locales.should be_empty
|
82
|
+
|
83
|
+
# Requesting es-419 translation causes loading of both es-419 and
|
84
|
+
# es translations.
|
85
|
+
@backend.lookup(:"es-419", @phrase1.key).should == 'Spanish value 1'
|
82
86
|
@backend.lookup(:es, @phrase1.key).should == 'Spanish value 1'
|
87
|
+
|
83
88
|
@backend.lookup(:fr, @phrase1.key).should == 'French value 1'
|
84
89
|
@backend.lookup(:es, @phrase2.key).should == 'Spanish value 2'
|
85
90
|
|
86
|
-
#
|
87
|
-
#
|
88
|
-
@backend.lookup(:ko, @phrase1.key).should == nil
|
89
|
-
|
90
|
-
@backend.lookup(:en, @phrase1.key).should == 'value 1'
|
91
|
+
# No Korean translation, so falls back to English, which should
|
92
|
+
# have been lazily loaded already.
|
91
93
|
@backend.lookup(:ko, @phrase1.key).should == 'value 1'
|
92
|
-
|
94
|
+
|
93
95
|
@backend.available_locales.size.should == 3
|
94
96
|
end
|
95
97
|
|