diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2003-02-20 14:56:11 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2003-02-20 14:56:11 +0000 |
commit | 8db819b3d3be978b4bc884836158e8aa113452a8 (patch) | |
tree | 9c7b847ac6be87df0f9dd6863a5607f64d4f122c | |
parent | e155150a5b3d55eeb5b869113dc887092be2b9aa (diff) | |
download | drakx-backup-do-not-use-8db819b3d3be978b4bc884836158e8aa113452a8.tar drakx-backup-do-not-use-8db819b3d3be978b4bc884836158e8aa113452a8.tar.gz drakx-backup-do-not-use-8db819b3d3be978b4bc884836158e8aa113452a8.tar.bz2 drakx-backup-do-not-use-8db819b3d3be978b4bc884836158e8aa113452a8.tar.xz drakx-backup-do-not-use-8db819b3d3be978b4bc884836158e8aa113452a8.zip |
- 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)
-rwxr-xr-x | perl-install/standalone/harddrake2 | 32 |
1 files changed, 23 insertions, 9 deletions
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 => '<Branch>' }, { path => N("/_File").N("/_Quit"), accelerator => N("<control>Q"), callback => \&quit_global }, - { path => N("/_Options").N("/Autodetect _printers"), type => '<CheckItem>', + { path => join('', @{$menu_options{PRINTERS_DETECTION}}), type => '<CheckItem>', callback => sub { $options{PRINTERS_DETECTION} = $check_boxes{PRINTERS_DETECTION}->active } }, - { path => N("/_Options").N("/Autodetect _modems"), type => '<CheckItem>', + { path => join('', @{$menu_options{MODEMS_DETECTION}}), type => '<CheckItem>', callback => sub { $options{MODEMS_DETECTION} = $check_boxes{MODEMS_DETECTION}->active } }, - { path => N("/_Options").N("/Autodetect _jazz drives"), type => '<CheckItem>', + { path => join('', @{$menu_options{JAZZ_DETECTION}}), type => '<CheckItem>', callback => sub { $options{JAZZ_DETECTION} = $check_boxes{JAZZ_DETECTION}->active } }, { path => N("/_Help"), type => '<Branch>' }, { 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("<main>".N("/Options").$_->[1]); - $check_boxes{$_->[0]}->set_active($options{$_->[0]}); # restore saved values + $check_boxes{$_} = $factory->get_widget("<main>" . $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/; $_ } @_; +} |