Sha256: 772138aaf246f4d26bd68126b2647ad87f27b2c649a882c6dc46e38a28e6d962

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

# -*- encoding : utf-8 -*-

require 'active_support/all'

module Phrase
  autoload :Config, 'phrase/config'
  
  CLIENT_VERSION = "0.1"
  
  class << self
    
    def config
      Thread.current[:phrase_config] ||= Phrase::Config.new
    end
    
    def config=(value)
      Thread.current[:phrase_config] = value
    end
    
    %w(enabled backend prefix suffix auth_token client_version js_host js_use_ssl).each do |method|
      module_eval <<-DELEGATORS, __FILE__, __LINE__ + 1
        def #{method}
          config.#{method}
        end
      DELEGATORS
    
      module_eval <<-DELEGATORS, __FILE__, __LINE__ + 1
        def #{method}=(value)
          config.#{method} = (value)
        end
      DELEGATORS
    end
    
    def enabled?
      enabled
    end
  end
  
  autoload :Extensions, 'phrase/extensions'
  autoload :ViewHelpers, 'phrase/view_helpers'
  
  require 'phrase/engine'
  require 'phrase/backend'
end

module I18n
  class << self
    def translate_with_phrase(*args)
      Phrase.backend.translate(*args)
    end
    alias_method_chain :translate, :phrase
    alias_method :t, :translate
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phrase-0.1.3 lib/phrase.rb
phrase-0.1.2 lib/phrase.rb
phrase-0.1.1 lib/phrase.rb
phrase-0.1 lib/phrase.rb