Class: Underworld::I18n::MissingKeyHandler
- Inherits:
-
I18n::ExceptionHandler
- Object
- I18n::ExceptionHandler
- Underworld::I18n::MissingKeyHandler
- Defined in:
- lib/underworld/i18n.rb
Instance Method Summary collapse
Instance Method Details
#call(exception, locale, key, options) ⇒ Object
91 92 93 94 95 96 97 98 |
# File 'lib/underworld/i18n.rb', line 91 def call(exception, locale, key, ) if exception.is_a?(::I18n::MissingTranslation) create_key_cache(locale, key) super else super end end |
#create_key_cache(locale, key) ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/underworld/i18n.rb', line 83 def create_key_cache(locale, key) locale_dir = "#{Rails.root}/tmp/i18n/#{locale}" key_file = "#{locale_dir}/#{key}" FileUtils.mkdir_p locale_dir FileUtils.touch [key_file] end |