Sha256: 7e3488c4653aba707ee9f9dd751c3d89c9737837040965be45a15aeb978c0bc5
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
$:<<File.dirname(__FILE__) unless $:.include?(File.dirname(__FILE__)) require 'redis' require 'yajl' require 'lolita' module Lolita # === Uses Redis DB as backend # All translations ar stored with full key like "en.home.index.title" -> Hello world. # In your lolita initializer add this line in setup block. # config.i18n.store = {redis_confguration_goes_here} # # or # config.i18n.store = Redis.new() # default store module I18n autoload :Request, 'lolita-i18n/request' autoload :Exceptions, 'lolita-i18n/exceptions' autoload :Configuration, 'lolita-i18n/configuration' end end module LolitaI18nConfiguration def i18n @i18n ||= Lolita::I18n::Configuration.new end end Lolita.configuration.extend(LolitaI18nConfiguration) Lolita.after_setup do Lolita.i18n.yaml_backend = ::I18n.backend Lolita.i18n.include_modules begin r = Redis.new r.ping ::I18n.backend = Lolita.i18n.initialize_chain rescue Errno::ECONNREFUSED => e warn "Warning: Lolita was unable to connect to Redis DB: #{e}" end true end Lolita.i18n.load_rails! require 'lolita-i18n/module' require 'lolita-i18n/version'
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lolita-i18n-0.4.2 | lib/lolita-i18n.rb |
lolita-i18n-0.4.0 | lib/lolita-i18n.rb |