Sha256: 4fcad417aa4680573fdbeff5eb668be932cd94358904fe5ee8951a3b6662f71f

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

require 'fast_gettext/mo_file'
require 'fast_gettext/storage'
require 'fast_gettext/translation'
require 'fast_gettext/translation_repository'
require 'fast_gettext/vendor/string'

module FastGettext
  include FastGettext::Storage
  extend self

  VERSION = File.read( File.join(File.dirname(__FILE__), 'fast_gettext', 'VERSION') ).strip
  LOCALE_REX =  /^[a-z]{2,3}$|^[a-z]{2,3}_[A-Z]{2,3}$/
  NAMESPACE_SEPARATOR = '|'

  # users should not include FastGettext, since this would contaminate their namespace
  # rather use
  # FastGettext.locale = ..
  # FastGettext.text_domain = ..
  # and
  # include FastGettext::Translation
  FastGettext::Translation.public_instance_methods.each do |method|
    define_method method do |*args|
      Translation.send(method,*args)
    end
  end

  def add_text_domain(name,options)
    translation_repositories[name] = TranslationRepository.build(name,options)
  end

  # some repositories know where to store their locales
  def locale_path
    translation_repositories[text_domain].instance_variable_get(:@options)[:path]
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fast_gettext-0.6.4 lib/fast_gettext.rb
fast_gettext-0.6.3 lib/fast_gettext.rb
fast_gettext-0.6.2 lib/fast_gettext.rb
fast_gettext-0.6.1 lib/fast_gettext.rb
fast_gettext-0.6.0 lib/fast_gettext.rb
fast_gettext-0.5.13 lib/fast_gettext.rb
fast_gettext-0.5.12 lib/fast_gettext.rb