config/initializers/i18n.rb in activeadmin-selleo-cms-0.0.24 vs config/initializers/i18n.rb in activeadmin-selleo-cms-0.0.25
- old
+ new
@@ -5,6 +5,27 @@
if ActiveRecord::Base.connection.table_exists?('translations') and !Rails.env.development?
require 'i18n/backend/active_record'
I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Fallbacks)
I18n.backend = I18n::Backend::Chain.new(I18n::Backend::ActiveRecord.new, I18n.backend)
-end
\ No newline at end of file
+end
+
+module I18n
+ module Backend
+ class ActiveRecord
+
+ module Implementation
+
+ def store_translations(locale, data, options = {})
+ escape = options.fetch(:escape, true)
+ flatten_translations(locale, data, escape, false).each do |key, value|
+ unless Translation.locale(locale).lookup(key).any?
+ Translation.create(:locale => locale.to_s, :key => key.to_s, :value => value)
+ end
+ end
+ end
+
+ end
+
+ end
+ end
+end