File: hello_gtk2.rb

package info (click to toggle)
ruby-gettext 3.4.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,084 kB
  • sloc: ruby: 10,461; makefile: 8
file content (30 lines) | stat: -rwxr-xr-x 626 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/ruby
# hello_gtk2.rb - sample for Ruby/GTK2
#
# Copyright (C) 2001-2006 Masao Mutoh
# This file is distributed under the same license as gettext.

require 'rubygems'
require 'gettext'
require 'gtk2'

class LocalizedWindow < Gtk::Window
  include GetText

  base_dir = File.dirname(__FILE__)
  bindtextdomain("hello_gtk2",
                 :path => File.join(base_dir, "locale"),
                 :output_charset => "utf-8")

  def initialize
    super
    signal_connect('delete-event') do
      Gtk.main_quit
    end

    add(Gtk::Label.new(_("hello, gtk world")))
  end
end

LocalizedWindow.new.show_all
Gtk.main