Module: I18n::Backend::Weeler::Implementation
Instance Method Summary collapse
Instance Method Details
#reload_cache ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/i18n/backend/weeler.rb', line 49 def reload_cache i18n_cache.clear Translation.all.each do |translation| # Load in cache unless value is nil or it is blank and empty # translation acts like missing if !(translation.value.nil? || (::Weeler.empty_translation_acts_like_missing && translation.value.blank?)) i18n_cache.write [translation.locale, translation.key], translation end end i18n_cache.write('UPDATED_AT', Settings.i18n_updated_at) if ActiveRecord::Base.connection.data_source_exists?('settings') end |
#store_translations(locale, data, options = {}) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/i18n/backend/weeler.rb', line 41 def store_translations(locale, data, = {}) escape = .fetch(:escape, true) flatten_translations(locale, data, escape, false).each do |key, value| Translation.locale(locale).lookup((key)).delete_all Translation.create(locale: locale.to_s, key: key.to_s, value: value) end end |