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