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.3.0 test/test_text_domain_toplevel.rb
gettext-3.2.9 test/test_text_domain_toplevel.rb
gettext-3.2.8 test/test_text_domain_toplevel.rb
gettext-3.2.7 test/test_text_domain_toplevel.rb
gettext-3.2.6 test/test_text_domain_toplevel.rb
gettext-3.2.5 test/test_text_domain_toplevel.rb
gettext-3.2.4 test/test_text_domain_toplevel.rb
gettext-3.2.3 test/test_text_domain_toplevel.rb
gettext-3.2.2 test/test_text_domain_toplevel.rb
gettext-3.2.1 test/test_text_domain_toplevel.rb
gettext-3.2.0 test/test_text_domain_toplevel.rb
gettext-3.1.9 test/test_text_domain_toplevel.rb
gettext-3.1.8 test/test_text_domain_toplevel.rb
gettext-3.1.7 test/test_text_domain_toplevel.rb
gettext-3.1.6 test/test_text_domain_toplevel.rb
gettext-3.1.5 test/test_text_domain_toplevel.rb
gettext-3.1.4 test/test_text_domain_toplevel.rb
gettext-3.1.3 test/test_text_domain_toplevel.rb
gettext-3.1.2 test/test_text_domain_toplevel.rb
gettext-3.1.1 test/test_text_domain_toplevel.rb