Last active
December 31, 2015 12:19
-
-
Save jacobat/7985892 to your computer and use it in GitHub Desktop.
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
module I18n | |
module Backend | |
class Error | |
include Base | |
def lookup(locale, key, scope = [], options = {}) | |
case key | |
when /missing/ | |
nil | |
when /count/ | |
{ :one => "one" } | |
end | |
end | |
end | |
end | |
end | |
I18n.backend = I18n::Backend::Error.new | |
I18n.exception_handler = ->(*args) { p args } | |
I18n.t('missing.something') # Outputs args from handler as excepted | |
I18n.t('count.something', :count => 2) # Raises exception |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment