Module: ActiveTranslateSelf::Missing
- Defined in:
- lib/active_translate_self/missing.rb
Instance Method Summary collapse
Instance Method Details
#store_default_translation(locale, key, interpolations) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/active_translate_self/missing.rb', line 3 def store_default_translation(locale, key, interpolations) translation = I18n::Backend::ActiveRecord::Translation.new locale: locale.to_s, key: key default = I18n.t(key, locale: I18n.default_locale) translation.value = default.public_send "to_#{locale}" if default.respond_to?("to_#{locale}") translation.interpolations = interpolations translation.save end |