From 8db819b3d3be978b4bc884836158e8aa113452a8 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 20 Feb 2003 14:56:11 +0000 Subject: - prevent any l10n problem by having only one path string when both creating the menu and acessing a menu widget (aka translate menu paths only once), which also nicely cut down the translators job. - decrease diagnostics pragma verbosity (aka remove big fat warning messages) --- perl-install/standalone/harddrake2 | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'perl-install/standalone') diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2 index d4600d9b6..7029894fe 100755 --- a/perl-install/standalone/harddrake2 +++ b/perl-install/standalone/harddrake2 @@ -8,7 +8,7 @@ use common; use ugtk2 qw(:create :helpers :wrappers); use interactive; -use harddrake::data; #- needs to stay after use-ugtk2 as long as this module defines globals containing some N() +use harddrake::data qw(tree); #- needs to stay after use-ugtk2 as long as this module defines globals containing some N() # { field => [ short_translation, full_description] } @@ -75,15 +75,23 @@ my $conffile = "/etc/sysconfig/harddrake2/ui.conf"; my ($modem_check_box, $printer_check_box, $current_device, $current_configurator); + +#-PO Translators, please keep all "/" charaters !!! +my %menu_options = ( + 'PRINTERS_DETECTION' => [ N("/_Options"), N("/Autodetect _printers") ], + 'MODEMS_DETECTION' => [ N("/_Options"), N("/Autodetect _modems") ], + 'JAZZ_DETECTION' => [ N("/_Options"), N("/Autodetect _jazz drives") ], +); + my @menu_items = ( { path => N("/_File"), type => '' }, { path => N("/_File").N("/_Quit"), accelerator => N("Q"), callback => \&quit_global }, - { path => N("/_Options").N("/Autodetect _printers"), type => '', + { path => join('', @{$menu_options{PRINTERS_DETECTION}}), type => '', callback => sub { $options{PRINTERS_DETECTION} = $check_boxes{PRINTERS_DETECTION}->active } }, - { path => N("/_Options").N("/Autodetect _modems"), type => '', + { path => join('', @{$menu_options{MODEMS_DETECTION}}), type => '', callback => sub { $options{MODEMS_DETECTION} = $check_boxes{MODEMS_DETECTION}->active } }, - { path => N("/_Options").N("/Autodetect _jazz drives"), type => '', + { path => join('', @{$menu_options{JAZZ_DETECTION}}), type => '', callback => sub { $options{JAZZ_DETECTION} = $check_boxes{JAZZ_DETECTION}->active } }, { path => N("/_Help"), type => '' }, { path => N("/_Help").N("/_Help"), callback => sub { unless (fork()) { exec("drakhelp Drakxtools-Guide.html/harddrake.html") } } }, @@ -125,6 +133,7 @@ $in = 'interactive'->vnew('su', 'default'); add_icon_path('/usr/share/pixmaps/harddrake2/'); $::noBorder = 1; $w = ugtk2->new(N("Harddrake2 version ") . $harddrake::data::version); +local $::main_window; # fake diagnostics pragma $::main_window = $w->{rwindow} unless $::isEmbedded; my ($menubar, $factory); unless ($::isEmbedded) { @@ -271,12 +280,12 @@ $SIG{CHLD} = sub { undef $pid; $statusbar->pop($sig_id) }; $w->{rwindow}->signal_connect(delete_event => \&quit_global); $w->{rwindow}->set_position('center') unless $::isEmbedded; -foreach (['PRINTERS_DETECTION', N("/Autodetect printers")], ['MODEMS_DETECTION', N("/Autodetect modems")], - ['JAZZ_DETECTION', N("/Autodetect jazz drives")],) { - $options{$_->[0]} = 0 unless defined($options{$_->[0]}); # force detection by default +foreach (keys %menu_options) { + my $title = strip_first_underscore(@{$menu_options{$_}}); + $options{$_} = 0 unless defined($options{$_}); # force detection by default unless ($::isEmbedded) { - $check_boxes{$_->[0]} = $factory->get_widget("
".N("/Options").$_->[1]); - $check_boxes{$_->[0]}->set_active($options{$_->[0]}); # restore saved values + $check_boxes{$_} = $factory->get_widget("
" . $title); + $check_boxes{$_}->set_active($options{$_}); # restore saved values } } @@ -301,3 +310,8 @@ sub show_hide { my ($bool, $button) = @_; if ($bool) { $button->show } else { $button->hide } } + + +sub strip_first_underscore { + join '', map { s/([^_]*)_(.*)/$1$2/; $_ } @_; +} -- cgit v1.2.1