Sha256: 67905102d3ce8fe2ce5f7765b550f5a97a0f1569adc8635393a0036afd90f2a4

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

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

module Phrase
  class Config
    def enabled?
      ENV['TRANSLATABLE'] == "true" || (defined?(Rails) == true && Rails.env == "staging")
    end
  
    def locale
      I18n.locale
    end
  
    def default_locale
      @@default_locale ||= I18n.default_locale
    end
      
    def backend
      @@backend ||= Backend::PhraseService.new
    end
    
    def backend=(backend)
      @@backend = backend
    end
    
    def available_locales
      @@available_locales ||= nil
      @@available_locales ||= I18n.available_locales
    end
      
    def available_locales=(locales)
      @@available_locales = Array(locales).map { |locale| locale.to_sym }
      @@available_locales = nil if @@available_locales.empty?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
phrase-0.0.6 lib/phrase/config.rb