##// END OF EJS Templates
Adds fallback to 'en' locale for untranslated strings (#5518)....
Jean-Philippe Lang -
r4559:88727bf070ed
parent child
Show More
@@ -1,3 +1,5
1 I18n.default_locale = 'en'
1 I18n.default_locale = 'en'
2 # Adds fallback to default locale for untranslated strings
3 I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
2
4
3 require 'redmine'
5 require 'redmine'
@@ -109,4 +109,18 class Redmine::I18nTest < ActiveSupport::TestCase
109
109
110 to_test.each {|lang, expected| assert_equal expected, find_language(lang)}
110 to_test.each {|lang, expected| assert_equal expected, find_language(lang)}
111 end
111 end
112
113 def test_fallback
114 ::I18n.backend.store_translations(:en, {:untranslated => "Untranslated string"})
115 ::I18n.locale = 'en'
116 assert_equal "Untranslated string", l(:untranslated)
117 ::I18n.locale = 'fr'
118 assert_equal "Untranslated string", l(:untranslated)
119
120 ::I18n.backend.store_translations(:fr, {:untranslated => "Pas de traduction"})
121 ::I18n.locale = 'en'
122 assert_equal "Untranslated string", l(:untranslated)
123 ::I18n.locale = 'fr'
124 assert_equal "Pas de traduction", l(:untranslated)
125 end
112 end
126 end
General Comments 0
You need to be logged in to leave comments. Login now