Skip to content

Instantly share code, notes, and snippets.

@itspriddle
Created November 2, 2012 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itspriddle/4001903 to your computer and use it in GitHub Desktop.
Save itspriddle/4001903 to your computer and use it in GitHub Desktop.
# Always raise errors when I18n translations are missing. To override this
# behavior:
#
# I18n.t :some_key, allow_missing: false
I18n.exception_handler = -> exception, locale, key, options do
if options.delete(:allow_missing)
I18n::ExceptionHandler.new.call(exception, locale, key, options)
else
raise I18n::MissingTranslationData.new(locale, key, options)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment