Class: I18n::Backend::ActiveRecord

Inherits:
Base
  • Object
show all
Defined in:
lib/i18n/backend/active_record.rb

Constant Summary

Constants inherited from Base

Base::INTERPOLATION_SYNTAX_PATTERN, Base::RESERVED_KEYS

Instance Method Summary collapse

Methods inherited from Base

#initialized?, #load_translations, #localize, #translate

Instance Method Details

#available_localesObject



18
19
20
# File 'lib/i18n/backend/active_record.rb', line 18

def available_locales
  Translation.find(:all, :select => 'DISTINCT locale').map{|t| t.locale}
end

#reload!Object



9
10
# File 'lib/i18n/backend/active_record.rb', line 9

def reload!
end

#store_translations(locale, data) ⇒ Object



12
13
14
15
16
# File 'lib/i18n/backend/active_record.rb', line 12

def store_translations(locale, data)
  data.unwind.each{|key,v|
    Translation.create(:locale => locale.to_s, :key => key, :value => v)
  }        
end