Created
November 13, 2013 12:23
-
-
Save knoopx/7448220 to your computer and use it in GitHub Desktop.
I18n.exception_handler = SimpleExceptionHandler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SimpleExceptionHandler < I18n::ExceptionHandler | |
def self.call(exception, locale, key, options) | |
if exception.is_a?(I18n::MissingTranslation) | |
exception.keys.last.to_s.gsub('_', ' ').gsub(/\b('?[a-z])/) { $1.capitalize } | |
else | |
super | |
end | |
end | |
end | |
I18n.exception_handler = SimpleExceptionHandler |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment