Sha256: 0c34e06def1d82f4e7c9231696abd362c3adb4ff4b4033f0805eee9e00283900

Contents?: true

Size: 689 Bytes

Versions: 12

Compression:

Stored size: 689 Bytes

Contents

require 'fast_gettext'
require 'locale'
include FastGettext::Translation
FastGettext.add_text_domain('spider', :path => File.join($SPIDER_PATH, 'data', 'locale'))
FastGettext.text_domain = 'spider'
FastGettext.default_text_domain = 'spider'
l = Locale.current[0].to_s
l = $1 if l =~ /(\w\w)_+/
FastGettext.locale = l

module Spider
    
    module GetText
        
        def self.in_domain(domain, &block)
            prev_text_domain = FastGettext.text_domain
            FastGettext.text_domain = domain if FastGettext.translation_repositories.key?(domain)
            v = yield
            FastGettext.text_domain = prev_text_domain
            v
        end
        
    end
    
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
spiderfw-0.6.21 lib/spiderfw/i18n/gettext.rb
spiderfw-0.6.20 lib/spiderfw/i18n/gettext.rb
spiderfw-0.6.19 lib/spiderfw/i18n/gettext.rb
spiderfw-0.6.18 lib/spiderfw/i18n/gettext.rb
spiderfw-0.6.17 lib/spiderfw/i18n/gettext.rb
spiderfw-0.6.16 lib/spiderfw/i18n/gettext.rb
spiderfw-0.6.15 lib/spiderfw/i18n/gettext.rb
spiderfw-0.6.14 lib/spiderfw/i18n/gettext.rb
spiderfw-0.6.13 lib/spiderfw/i18n/gettext.rb
spiderfw-0.6.12 lib/spiderfw/i18n/gettext.rb
spiderfw-0.6.11 lib/spiderfw/i18n/gettext.rb
spiderfw-0.6.10 lib/spiderfw/i18n/gettext.rb