Sha256: 1f51bf52fea51cda82183f2320c132a734c41d065b035fec1a34936fbc41d6da

Contents?: true

Size: 1022 Bytes

Versions: 51

Compression:

Stored size: 1022 Bytes

Contents

# -*- coding: utf-8 -*-

include GetText

bindtextdomain("test1", :path => "locale")
module TopLevelModule
  module_function
  def module_function
    _("language")
  end
end

class TopLevelClass
  def instance_method
    _("language")
  end
  def self.class_method
    _("language")
  end
end

def toplevel_method
  _("language")
end

class TestTextDomainToplevel < Test::Unit::TestCase
  include GetText

  def teardown
    GetText.locale = nil
  end

  def test_toplevel
    GetText.locale = "ja"
    assert_equal("japanese", toplevel_method)
    assert_equal("japanese", TopLevelModule.module_function)
    assert_equal("japanese", TopLevelClass.class_method)
    assert_equal("japanese", TopLevelClass.new.instance_method)

    GetText.bindtextdomain("test1", :path => "locale")
    assert_equal("japanese", toplevel_method)
    assert_equal("japanese", TopLevelModule.module_function)
    assert_equal("japanese", TopLevelClass.class_method)
    assert_equal("japanese", TopLevelClass.new.instance_method)
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
gettext-3.5.0 test/test_text_domain_toplevel.rb
gettext-3.4.9 test/test_text_domain_toplevel.rb
gettext-3.4.8 test/test_text_domain_toplevel.rb
gettext-3.4.7 test/test_text_domain_toplevel.rb
gettext-3.4.6 test/test_text_domain_toplevel.rb
gettext-3.4.5 test/test_text_domain_toplevel.rb
gettext-3.4.4 test/test_text_domain_toplevel.rb
gettext-3.4.3 test/test_text_domain_toplevel.rb
gettext-3.4.2 test/test_text_domain_toplevel.rb
gettext-3.4.1 test/test_text_domain_toplevel.rb
gettext-3.4.0 test/test_text_domain_toplevel.rb
gettext-3.3.9 test/test_text_domain_toplevel.rb
gettext-3.3.8 test/test_text_domain_toplevel.rb
gettext-3.3.7 test/test_text_domain_toplevel.rb
gettext-3.3.6 test/test_text_domain_toplevel.rb
gettext-3.3.5 test/test_text_domain_toplevel.rb
gettext-3.3.4 test/test_text_domain_toplevel.rb
gettext-3.3.3 test/test_text_domain_toplevel.rb
gettext-3.3.2 test/test_text_domain_toplevel.rb
gettext-3.3.1 test/test_text_domain_toplevel.rb