Module: I18n::ExtraTranslations::SimpleExtension

Defined in:
lib/i18n/extra_translations/simple_extension.rb

Instance Method Summary collapse

Instance Method Details

#translate(locale, key, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/i18n/extra_translations/simple_extension.rb', line 4

def translate(locale, key, options = {})
  if locale == I18n::ExtraTranslations.locale
    result = catch :exception do
      _val = super
      I18n::ExtraTranslations.extra_translations.use(locale, key, options)
      _val
    end
    if result.kind_of? I18n::MissingTranslation
      I18n::ExtraTranslations.extra_translations.miss(locale, key, options)
      throw :exception, result
    else
      result
    end
  else
    super
  end
end