From b8a47a11290584254c9a1a370b98c3cc3cbf633e Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 9 Dec 2015 17:10:51 +1100 Subject: [PATCH] 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 --- lib/freedom_patches/translate_accelerator.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/freedom_patches/translate_accelerator.rb b/lib/freedom_patches/translate_accelerator.rb index 0cabd15c7d9..570b4c24230 100644 --- a/lib/freedom_patches/translate_accelerator.rb +++ b/lib/freedom_patches/translate_accelerator.rb @@ -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)