Sha256: cc2b9fd2b4123b677490e7470f7381429ba1abde6c9565c9eb3bc82319c4bf06
Contents?: true
Size: 680 Bytes
Versions: 4
Compression:
Stored size: 680 Bytes
Contents
#!/usr/bin/ruby # hello.rb - sample for _() and class. # # Copyright (C) 2001-2009 Masao Mutoh # This file is distributed under the same license as Ruby-GetText-Package. require 'rubygems' require 'gettext' class HelloWorld include GetText bindtextdomain("hello", :path => "locale") def hello print _("Hello World\n") end end if __FILE__ == $0 a = HelloWorld.new a.hello # Show in your locale old = GetText.locale p old.to_s # Show current locale # Change the locale to "en". GetText.set_locale_all("en") p GetText.locale.to_s a.hello # Show in English # Retrive original locale GetText.set_locale(old) a.hello # Show in your locale end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
gettext-2.2.1 | samples/hello.rb |
gettext-2.2.0 | samples/hello.rb |
ofm_gettext-2.0.1 | samples/hello.rb |
ofm_gettext-2.0.0 | samples/hello.rb |