Class: Faalis::I18n::MissingKeyHandler
- Inherits:
-
I18n::ExceptionHandler
- Object
- I18n::ExceptionHandler
- Faalis::I18n::MissingKeyHandler
- Defined in:
- lib/faalis/i18n.rb
Instance Method Summary collapse
Instance Method Details
#call(exception, locale, key, options) ⇒ Object
109 110 111 112 113 114 115 116 |
# File 'lib/faalis/i18n.rb', line 109 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
101 102 103 104 105 106 107 |
# File 'lib/faalis/i18n.rb', line 101 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 |