module Mova::I18nConfig
Attributes
interpolator[W]
translator[W]
Public Class Methods
interpolator()
click to toggle source
# File lib/mova-i18n/config.rb, line 25 def interpolator @interpolator ||= I18nInterpolator.new end
pluralizer(locale)
click to toggle source
# File lib/mova-i18n/config.rb, line 29 def pluralizer(locale) @pluralizers ||= {} @pluralizers[locale] ||= translator.storage.read("#{locale}.i18n.plural.rule") || ->(count){ count == 1 ? :one : :other } end
transfer_translations!()
click to toggle source
Transfer translations from ‘I18n::Backend::Simple`, since we can have enumerate all keys here. Other key-value storages should be passed to `I18n.mova.translator` directly.
@note Clears all current translations in ‘I18n.mova.translator.storage`. Use
{Mova::Storage::Readonly} to protect certain storages if you have a chain of them.
# File lib/mova-i18n/config.rb, line 11 def transfer_translations! # calling protected methods I18n.backend.send(:init_translations) if I18n.backend.respond_to?(:init_translations, true) if I18n.backend.respond_to?(:translations, true) translations = I18n.backend.send(:translations) translator.storage.clear translator.put(translations) end end
translator()
click to toggle source
# File lib/mova-i18n/config.rb, line 21 def translator @translator ||= I18nTranslator.new end