Sha256: 0d112ae7a5773c397630608e6e01b836338e7c9485fea009dbab50662eefe58d

Contents?: true

Size: 450 Bytes

Versions: 1

Compression:

Stored size: 450 Bytes

Contents

module ActiveTranslateSelf
  module Missing
    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_translate_self-1.0.0 lib/active_translate_self/missing.rb