Adds fallback to 'en' locale for untranslated strings (#5518).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4679 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
bebde1596c
commit
88727bf070
|
@ -1,3 +1,5 @@
|
|||
I18n.default_locale = 'en'
|
||||
# Adds fallback to default locale for untranslated strings
|
||||
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
|
||||
|
||||
require 'redmine'
|
||||
|
|
|
@ -109,4 +109,18 @@ class Redmine::I18nTest < ActiveSupport::TestCase
|
|||
|
||||
to_test.each {|lang, expected| assert_equal expected, find_language(lang)}
|
||||
end
|
||||
|
||||
def test_fallback
|
||||
::I18n.backend.store_translations(:en, {:untranslated => "Untranslated string"})
|
||||
::I18n.locale = 'en'
|
||||
assert_equal "Untranslated string", l(:untranslated)
|
||||
::I18n.locale = 'fr'
|
||||
assert_equal "Untranslated string", l(:untranslated)
|
||||
|
||||
::I18n.backend.store_translations(:fr, {:untranslated => "Pas de traduction"})
|
||||
::I18n.locale = 'en'
|
||||
assert_equal "Untranslated string", l(:untranslated)
|
||||
::I18n.locale = 'fr'
|
||||
assert_equal "Pas de traduction", l(:untranslated)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue