i18n
https://github.com/svenfuchs/i18n
Ruby
Internationalization (i18n) library for Ruby
I18n::Base#handle_exception
Any exceptions thrown in translate will be sent to the @@exception_handler
which can be a Symbol, a Proc or any other Object unless they're forced to
be raised or thrown (MissingTranslation).
If exception_handler is a Symbol then it will simply be sent to I18n as
a method call. A Proc will simply be called. In any other case the
method #call will be called on the exception_handler object.
Examples:
I18n.exception_handler = :custom_exception_handler # this is the default
I18n.custom_exception_handler(exception, locale, key, options) # will be called like this
I18n.exception_handler = lambda { |*args| ... } # a lambda
I18n.exception_handler.call(exception, locale, key, options) # will be called like this
I18n.exception_handler = I18nExceptionHandler.new # an object
I18n.exception_handler.call(exception, locale, key, options) # will be called like thisEdit
git clone [email protected]:svenfuchs/i18n.git
cd i18n
open lib/i18n.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-I18n--Base-handle_exception-for-pr
# Commit to gitgit add lib/i18n.rbgit commit -m "better docs for I18n::Base#handle_exception"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-I18n--Base-handle_exception-for-pr
hub pull-request
# Celebrate!