Sha256: d7a3c68452c2fdb5f30d9638e97e5e8a616f37b786089b3d5d4188f5a947bbec

Contents?: true

Size: 1013 Bytes

Versions: 27

Compression:

Stored size: 1013 Bytes

Contents

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

module FastGettext
  include FastGettext::Storage
  extend self

  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

27 entries across 27 versions & 1 rubygems

Version Path
fast_gettext-1.8.0 lib/fast_gettext.rb
fast_gettext-1.7.0 lib/fast_gettext.rb
fast_gettext-1.1.2 lib/fast_gettext.rb
fast_gettext-1.1.1 lib/fast_gettext.rb
fast_gettext-1.6.0 lib/fast_gettext.rb
fast_gettext-1.5.1 lib/fast_gettext.rb
fast_gettext-1.5.0 lib/fast_gettext.rb
fast_gettext-1.4.1 lib/fast_gettext.rb
fast_gettext-1.4.0 lib/fast_gettext.rb
fast_gettext-1.3.0 lib/fast_gettext.rb
fast_gettext-1.2.0 lib/fast_gettext.rb
fast_gettext-1.1.0 lib/fast_gettext.rb
fast_gettext-1.0.0 lib/fast_gettext.rb
fast_gettext-0.9.2 lib/fast_gettext.rb
fast_gettext-0.9.1 lib/fast_gettext.rb
fast_gettext-0.9.0 lib/fast_gettext.rb
fast_gettext-0.8.1 lib/fast_gettext.rb
fast_gettext-0.8.0 lib/fast_gettext.rb
fast_gettext-0.7.1 lib/fast_gettext.rb
fast_gettext-0.7.0 lib/fast_gettext.rb