Sha256: 4046bb77164ccbbf310c86a987ef1e3282313504626546ea5777f94b55c645b3

Contents?: true

Size: 748 Bytes

Versions: 70

Compression:

Stored size: 748 Bytes

Contents

require 'rubygems'
require 'bundler/setup'

require 'r18n-core'

module RubyApp
  require 'ruby_app/application'
  require 'ruby_app/mixins/delegate_mixin'
  require 'ruby_app/request'

  class Language < R18n::I18n
    extend RubyApp::Mixins::DelegateMixin

    def self.get
      R18n.get
    end

    def self.load!
      R18n.thread_set(RubyApp::Language.new(RubyApp::Request.language, RubyApp::Application.options.translations_paths))
      if block_given?
        begin
          yield
        ensure
          self.unload!
        end
      end
    end

    def self.unload!
      R18n.thread_set(nil)
    end

    private

      def initialize(language, translations_paths)
        super(language, translations_paths)
      end

  end

end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
RubyApp-0.0.18 lib/ruby_app/language.rb
RubyApp-0.0.17 lib/ruby_app/language.rb
RubyApp-0.0.16 lib/ruby_app/language.rb
RubyApp-0.0.15 lib/ruby_app/language.rb
RubyApp-0.0.14 lib/ruby_app/language.rb
RubyApp-0.0.13 lib/ruby_app/language.rb
RubyApp-0.0.12 lib/ruby_app/language.rb
RubyApp-0.0.11 lib/ruby_app/language.rb
RubyApp-0.0.10 lib/ruby_app/language.rb
RubyApp-0.0.9 lib/ruby_app/language.rb