aboutsummaryrefslogtreecommitdiffstats
path: root/config/initializers/locale.rb
blob: c7262b8a05f511825750b8ef41ec621bdf60e785 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
require 'i18n/backend/active_record'
Translation  = I18n::Backend::ActiveRecord::Translation

if Translation.table_exists?
  I18n.backend = I18n::Backend::ActiveRecord.new

  I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Memoize)
  I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Flatten)
  I18n::Backend::Simple.send(:include, I18n::Backend::Memoize)
  I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)

  I18n.backend = I18n::Backend::Chain.new(I18n::Backend::Simple.new, I18n.backend)
end