Sha256: 09d0c8c52cd4d71e3c1759cad2256a9ed0316b90a5e0b0fd07a0f7ed9f36395d
Contents?: true
Size: 777 Bytes
Versions: 5
Compression:
Stored size: 777 Bytes
Contents
require 'i18n/backend/active_record' module I18nline class MyBackend < I18n::Backend::ActiveRecord Translation.table_name = "i18nline_translations" include I18n::Backend::ActiveRecord::Missing include I18n::Backend::Memoize def available_locales I18nline::enabled_locales end end end TRANSLATION_STORE = I18nline::MyBackend.new I18n.backend = I18n::Backend::Chain.new(TRANSLATION_STORE, I18n::Backend::Simple.new) module I18n class JustRaiseExceptionHandler < ExceptionHandler def call(exception, locale, key, options) if exception.is_a?(MissingTranslation) TRANSLATION_STORE.store_default_translations(locale, key, options) end super end end end I18n.exception_handler = I18n::JustRaiseExceptionHandler.new
Version data entries
5 entries across 5 versions & 2 rubygems