FIX: if a string was missing catch the throw

if overrides were in play and we tried to translate a
missing string we would throw an exception
This commit is contained in:
Sam 2015-12-09 17:10:51 +11:00
parent 77f4461c51
commit b8a47a1129
1 changed files with 8 additions and 4 deletions

View File

@ -125,12 +125,16 @@ module I18n
if by_locale
if args.size > 0 && args[0].is_a?(Hash)
args[0][:overrides] = by_locale
return backend.translate(config.locale, key, args[0])
# I18n likes to use throw...
catch(:exception) do
return backend.translate(config.locale, key, args[0])
end
else
if result = by_locale[key]
return result
end
end
if result = by_locale[key]
return result
end
end
end
translate_no_override(key, *args)