Sha256: d1dc69d5ab349ea2869012b3151cc21844167c2aace9ef28f10c7702b520896d

Contents?: true

Size: 601 Bytes

Versions: 14

Compression:

Stored size: 601 Bytes

Contents

#!/usr/bin/ruby
# hello_noop.rb - sample for N_() and class.
#
# Copyright (C) 2002-2006 Masao Mutoh
# This file is distributed under the same license as Ruby-GetText-Package.

require 'gettext'

class HelloNoop
  include GetText

  MSGS = [N_("Hello World"), N_("Hello World2")]

  def initialize
    # You can call bindtextdomain as instance methods.
    # In this case, it initializes(decided the locale lazily) 
    # in a instance.
    bindtextdomain("hello_noop", "locale")
  end

  def hello
    MSGS.each do |msg|
      print _(msg), "\n"
    end
  end
end

hello = HelloNoop.new

hello.hello

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
gettext-1.10.0-mswin32 samples/hello_noop.rb
gettext-1.9.0-mswin32 samples/hello_noop.rb
gettext-1.8.0-mswin32 samples/hello_noop.rb
gettext-1.7.0-mswin32 samples/hello_noop.rb
gettext-1.6.0-mswin32 samples/hello_noop.rb
gettext-1.10.0 samples/hello_noop.rb
gettext-1.8.0 samples/hello_noop.rb
gettext-1.7.0 samples/hello_noop.rb
gettext-1.6.0 samples/hello_noop.rb
gettext-1.92.0 samples/hello_noop.rb
gettext-1.90.0 samples/hello_noop.rb
gettext-1.91.0 samples/hello_noop.rb
gettext-1.9.0 samples/hello_noop.rb
gettext-1.93.0 samples/hello_noop.rb