I18n::Backend::ActiveRecord::Missing

Public Instance Methods

store_default_translation(locale, key, interpolations) click to toggle source
    # File lib/i18n/backend/active_record/missing.rb, line 50
50:         def store_default_translation(locale, key, interpolations)
51:           translation = ActiveRecord::Translation.new :locale => locale.to_s, :key => key
52:           translation.interpolations = interpolations
53:           translation.save
54:         end
store_default_translations(locale, key, options = {}) click to toggle source
    # File lib/i18n/backend/active_record/missing.rb, line 36
36:         def store_default_translations(locale, key, options = {})
37:           count, scope, default, separator = options.values_at(:count, *Base::RESERVED_KEYS)
38:           separator ||= I18n.default_separator
39: 
40:           keys = I18n.normalize_keys(locale, key, scope, separator)[1..1]
41:           key = keys.join(separator || I18n.default_separator)
42: 
43:           unless ActiveRecord::Translation.locale(locale).lookup(key).exists?
44:             interpolations = options.reject { |name, value| Base::RESERVED_KEYS.include?(name) }.keys
45:             keys = count ? I18n.t('i18n.plural.keys', :locale => locale).map { |k| [key, k].join(separator) } : [key]
46:             keys.each { |key| store_default_translation(locale, key, interpolations) }
47:           end
48:         end
translate(locale, key, options = {}) click to toggle source
    # File lib/i18n/backend/active_record/missing.rb, line 56
56:         def translate(locale, key, options = {})
57:           super
58:         rescue I18n::MissingTranslationData => e
59:           self.store_default_translations(locale, key, options)
60:           raise e
61:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.