diff options
author | Pablo Saratxaga <pablo@mandriva.com> | 2001-02-16 15:01:11 +0000 |
---|---|---|
committer | Pablo Saratxaga <pablo@mandriva.com> | 2001-02-16 15:01:11 +0000 |
commit | 1a6c067bfd5d6d1537f4c2ffd02fc5d04188bafa (patch) | |
tree | a04a7e7f437713dc6260aa4d9e0de10496bb6a3a /control-center2 | |
parent | 08576b987c0f6177d3e1522a2a59d598299ed5d1 (diff) | |
download | control-center-1a6c067bfd5d6d1537f4c2ffd02fc5d04188bafa.tar control-center-1a6c067bfd5d6d1537f4c2ffd02fc5d04188bafa.tar.gz control-center-1a6c067bfd5d6d1537f4c2ffd02fc5d04188bafa.tar.bz2 control-center-1a6c067bfd5d6d1537f4c2ffd02fc5d04188bafa.tar.xz control-center-1a6c067bfd5d6d1537f4c2ffd02fc5d04188bafa.zip |
added i18n support
Diffstat (limited to 'control-center2')
-rwxr-xr-x | control-center2 | 81 |
1 files changed, 45 insertions, 36 deletions
diff --git a/control-center2 b/control-center2 index 9e55e108..be4d5b83 100755 --- a/control-center2 +++ b/control-center2 @@ -24,6 +24,14 @@ use Gtk; use Config; use POSIX; +# for i18n +use Locale::GetText; + +setlocale (LC_ALL, ""); +Locale::GetText::textdomain ("DrakConf"); + +import Locale::GetText I_; +*_ = *I_; init Gtk; use Data::Dumper; @@ -35,7 +43,7 @@ my $window_global = new Gtk::Window -toplevel; $window_global->set_usize(640, 480); $window_global->signal_connect ( delete_event => sub { Gtk->exit(0); }); $window_global->set_position(1); -$window_global->set_title("Mandrake Control Center"); +$window_global->set_title(_("Mandrake Control Center")); $window_global->border_width(0); $vbox_global = new Gtk::VBox(0, 0); @@ -43,19 +51,19 @@ $window_global->add($vbox_global); ######### menus my @item_factory_entries = ( - ["/_File", undef, 0, "<Branch>"], - ["/File/tearoff1", undef, 0, "<Tearoff>"], - #["/File/_Quit", "<control>Q", 5], + [_("/_File"), undef, 0, "<Branch>"], + [_("/File/tearoff1"), undef, 0, "<Tearoff>"], + #[_("/File/_Quit"), _("<control>Q"), 5], { - 'path' => "/File/_Quit", - 'accelerator' => "<control>Q", + 'path' => _("/File/_Quit"), + 'accelerator' => _("<control>Q"), 'action' => 1, 'type' => '<Item>' }, - ["/_Help", undef, 0, "<Branch>"], - ["/Help/_Mandrake Control Center", undef, 30], - ["/Help/_Report Bug", undef, 30], - ["/Help/_About", undef, 30] + [_("/_Help"), undef, 0, "<Branch>"], + [_("/Help/_Mandrake Control Center"), undef, 30], + [_("/Help/_Report Bug"), undef, 30], + [_("/Help/_About..."), undef, 30] ); my ($accel_group, $item_factory, $box1, $label, $box2); @@ -100,14 +108,14 @@ my $pix_about = new Gtk::Pixmap ($pix_about_map, $pix_about_mask); $pix_about->set_alignment(10,0); $hbox1->pack_start($pix_about, 0, 1, 0); my $style = new Gtk::Style; -$style->font(Gtk::Gdk::Font->load('-adobe-times-bold-r-normal--25-180-100-100-p-132-iso8859-1')); -my $label_about2 = new Gtk::Label ("Mandrake Control Center"); +$style->font(Gtk::Gdk::Font->load(_("-adobe-times-bold-r-normal--*-180-100-100-p-*-iso8859-*,*-r-*"))); +my $label_about2 = new Gtk::Label (_("Mandrake Control Center")); $label_about2->set_alignment(0,0); $label_about2->set_style($style); $hbox1->pack_start($label_about2, 0, 1, 0); my $vbox_about = new Gtk::VBox(0,10); $vbox_about->pack_start($hbox1, 0, 1, 0); -my $label_about3 = new Gtk::Label ("This is the Mandrake Control Center, The place where you can configure your Mandrake Box"); +my $label_about3 = new Gtk::Label (_("This is the Mandrake Control Center, The place where you can configure your Mandrake Box")); $vbox_about->pack_start($label_about3, 0, 0, 0); my $table_info1 = new Gtk::Table(6,2,1); @@ -116,7 +124,7 @@ $table_info1->set_col_spacings(10); my @revtree; my @infotree; -open VERS, "/etc/redhat-release" or die "cannot open this file for read :$!"; +open VERS, "/etc/redhat-release" or die( sprintf _("cannot open this file for read:$!") ); while (<VERS>) { push (@revtree,$_); } @@ -126,11 +134,11 @@ my ($sysname, $nodename, $release, $version, $machine ) = POSIX::uname(); my $username= POSIX::cuserid(); my $style1 = new Gtk::Style; -$style1->font(Gtk::Gdk::Font->load('-adobe-times-bold-r-normal--14-100-100-100-p-76-iso8859-1')); +$style1->font(Gtk::Gdk::Font->load(_("-adobe-times-bold-r-normal--*-100-100-100-p-*-iso8859-*,*-r-*"))); my $ld = new Gtk::Label("$username"); $table_info1->attach($ld, 1, 2, 0, 1, 0, 0, 0, 0); -my $label_user = new Gtk::Label("User: "); +my $label_user = new Gtk::Label(_("User: ")); $label_user->set_style($style1); $label_user->set_justify('right'); $table_info1->attach($label_user, 0, 1, 0, 1, 0, 0, 0, 0); @@ -142,17 +150,17 @@ my $ld3 = new Gtk::Label("$release $version"); $table_info1->attach($ld3, 1, 2, 3, 4, 0, 0, 0, 0); my $ld3 = new Gtk::Label("$machine"); $table_info1->attach($ld3, 1, 2, 4, 5, 0, 0, 0, 0); -my $label_os = new Gtk::Label("System: "); +my $label_os = new Gtk::Label(_("System: ")); $label_os->set_style($style1); $label_os->set_justify('right'); $table_info1->attach($label_os, 0, 1, 1, 2, 0, 0, 0, 0); -my $label_host = new Gtk::Label("Hostname: "); +my $label_host = new Gtk::Label(_("Hostname: ")); $label_host->set_style($style1); $table_info1->attach_defaults($label_host, 0, 1, 2, 3); -my $label_kernel = new Gtk::Label("Kernel Version : "); +my $label_kernel = new Gtk::Label(_("Kernel Version: ")); $label_kernel->set_style($style1); $table_info1->attach_defaults($label_kernel, 0, 1, 3, 4); -my $label_box = new Gtk::Label("Machine: "); +my $label_box = new Gtk::Label(_("Machine: ")); $label_box->set_style($style1); $table_info1->attach_defaults($label_box, 0, 1, 4, 5); @@ -174,27 +182,27 @@ map { my %tree; $tree{nb_groups}=2; -$tree[0]{name}="Boot Configuration"; +$tree[0]{name}=_("Boot Configuration"); $tree[0]{nb_applis}=2; -$tree[0]{applis}[0]{name}='draknet'; +$tree[0]{applis}[0]{name}=_("draknet"); $tree[0]{applis}[0]{exec}='drakfont'; -$tree[0]{applis}[1]{name}='DrakeLogo'; +$tree[0]{applis}[1]{name}=_("DrakeLogo"); $tree[0]{applis}[1]{exec}='DrakeLogo'; $tree[1]{name}="groupe2"; $tree[1]{nb_applis}=1; -$tree[1]{applis}[0]{name}='DrakFont';#'drakxservices'; +$tree[1]{applis}[0]{name}=_("DrakFont");#'drakxservices'; $tree[1]{applis}[0]{exec}='drakfont';#'drakxservices'; -$tree[1]{applis}[1]{name}='DrakFloppy';#'drakboot'; +$tree[1]{applis}[1]{name}=_("DrakFloppy");#'drakboot'; $tree[1]{applis}[1]{exec}='drakfloppy';#'drakboot'; #print Data::Dumper->Dump([%tree], ['tree']) . "\n"; -print "nb gr : " . $tree{nb_groups} . "\n"; +print _("nb gr: ") . $tree{nb_groups} . "\n"; my $num=0; my $group; for ( $group=0; $group<$tree{nb_groups}; $group++) { - print "group : $group\n"; + print _("group: ") . "$group\n"; draw_icon(56, 36, 'item', 0, "", $tree[$group]{name}, $group); for ($item=0; $item<$tree[$group]{nb_applis}; $item++) { - print "item : $item\n"; + print _("item: ") . "$item\n"; draw_icon(56, 36, 'item', 1, $tree[$group]{applis}[$item]{exec}, $tree[$group]{applis}[$item]{name}, $num); $num++; } @@ -215,7 +223,7 @@ for (my $i=0; $i<$tree{nb_groups}; $i++) { $tree[$i]{applis}[$j]{label}->hide; } } -print "num : " . $notebook_global->page_num($vbox_about) . "\n"; +print _("num: ") . $notebook_global->page_num($vbox_about) . "\n"; $notebook_global->set_page(0); $SIG{USR1} = sub { $notebook_global->set_page(0); }; # embedded applications will send me that signal in order to "hide" them @@ -230,7 +238,8 @@ sub draw_icon { $socket->show; $notebook_global->append_page($socket, ""); $socket->realize; - print ("The XID of the sockets window n°$arg is [" . $socket->window->XWINDOW . "]\nMy PID is [" . $$ . "]\n"); + printf (_("The XID of the sockets window nr. %s is [%s]\n"), $arg, $socket->window->XWINDOW ); + printf (_("My PID is [%s]\n"), $$ ); my $a = $exec_string . " --embedded " . $socket->window->XWINDOW . " " . $$ . "&"; print "$a\n"; system ($a); @@ -306,16 +315,16 @@ sub draw_icon { $hash{darea}->signal_connect(button_release_event => sub { $notebook_global->set_page($number+1); }); } else { $hash{darea}->signal_connect(button_release_event => sub { - print "group : $number\n"; + print _("group: ") . "$number\n"; for (my $i=0; $i<$tree{nb_groups}; $i++) { for (my $j=0; $j<$tree[$i]{nb_applis}; $j++) { if ($i==$number) { - #print "yep i : $i ; j : $j\n"; + #print "yep i: $i ; j: $j\n"; #print Data::Dumper->Dump([$tree[$i]{applis}[$j]{darea}], ['darea-->']) . "\n"; $tree[$i]{applis}[$j]{darea}->show; $tree[$i]{applis}[$j]{label}->show; } else { - #print "nope i : $i ; j : $j\n"; + #print "nope i: $i ; j: $j\n"; $tree[$i]{applis}[$j]{darea}->hide; $tree[$i]{applis}[$j]{label}->hide; } @@ -355,14 +364,14 @@ sub create_item_factory { $item_factory->create_item($_, \&item_factory_cb); } - $item_factory_window->set_title("Item Factory"); + $item_factory_window->set_title(_("Item Factory")); $item_factory_window->set_border_width(0); $box1 = new Gtk::VBox(0, 0); $item_factory_window->add($box1); $box1->pack_start($item_factory->get_widget('<main>'), 0, 0, 0); - $label = new Gtk::Label "Type\n<alt>\nto start"; + $label = new Gtk::Label _("Type\n<alt>\nto start"); $label->set_usize(200, 200); $label->set_alignment(0.5, 0.5); @@ -375,7 +384,7 @@ sub create_item_factory { $box2->set_border_width(10); $box1->pack_start($box2, 0, 1, 0); - $button = new Gtk::Button("close"); + $button = new Gtk::Button(_("Close")); $button->signal_connect('clicked', sub {$item_factory_window->destroy;}); $box2->pack_start($button, 1, 1, 0); $button->can_default(1); |