diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2003-07-14 19:25:13 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2003-07-14 19:25:13 +0000 |
commit | 17f2c1fa484f92c0bdfa673070314d020e77f922 (patch) | |
tree | ddc575c00b0ce2bb2e57e44c605242076bcb6353 /perl-install/standalone/draksec | |
parent | 64040f7446f658b35d5b891c0b7ae9e623f321c5 (diff) | |
download | drakx-backup-do-not-use-17f2c1fa484f92c0bdfa673070314d020e77f922.tar drakx-backup-do-not-use-17f2c1fa484f92c0bdfa673070314d020e77f922.tar.gz drakx-backup-do-not-use-17f2c1fa484f92c0bdfa673070314d020e77f922.tar.bz2 drakx-backup-do-not-use-17f2c1fa484f92c0bdfa673070314d020e77f922.tar.xz drakx-backup-do-not-use-17f2c1fa484f92c0bdfa673070314d020e77f922.zip |
translate default values qw(yes no all ignore ...) and provide english
(l10n-able) descriptions instead of function names
Diffstat (limited to 'perl-install/standalone/draksec')
-rwxr-xr-x | perl-install/standalone/draksec | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/perl-install/standalone/draksec b/perl-install/standalone/draksec index a3fe96f0e..bbf444fe4 100755 --- a/perl-install/standalone/draksec +++ b/perl-install/standalone/draksec @@ -28,6 +28,7 @@ use run_program; use security::level; use security::msec; use security::help; +use security::l10n; #$MODE = 'basic'; #$0 =~ /draksec-firewall$/ and $MODE = 'firewall'; @@ -36,7 +37,7 @@ use security::help; #/^-?-(\S+)$/ and $options{$1} = 1 foreach @ARGV; -my $w; +my ($w, %fields); # factorize this with rpmdrake and harddrake2 sub wait_msg { @@ -76,8 +77,8 @@ Security Administrator: sub new_editable_combo { my ($string_list, $o_default_value) = @_; my $w = new Gtk2::OptionMenu(); - $w->set_popdown_strings(@$string_list) unless is_empty_array_ref $string_list; - $w->entry->set_text($o_default_value) if $o_default_value; + $w->set_popdown_strings(to_i18n(@$string_list)) unless is_empty_array_ref $string_list; + $w->entry->set_text(to_i18n($o_default_value)) if $o_default_value; $w; } @@ -91,6 +92,15 @@ my $msec = new security::msec; $w = ugtk2->new('draksec'); my $window = $w->{window}; +%fields = security::l10n::fields(); + +############################ I18N ################################### +my %inv_translations = map { translate($_) => $_ } N_("ALL"), N_("LOCAL"), N_("N_ON_E"), N_("default"), N_("default"), N_("ignore"), N_("no"), N_("yes"); +my %translations = reverse %inv_translations; + +sub to_i18n { map { $translations{$_} || $_ } @_ } +sub from_i18n { $inv_translations{$_->[0]} } + ############################ MAIN WINDOW ################################### # Set different options to Gtk2::Window unless ($::isEmbedded) { @@ -162,7 +172,7 @@ foreach ([ 'network', N("Network Options") ], [ 'system', N("System Options") ]) } $entry->set_text($msec->get_function_value($i)); set_help_tip($entry, $default, $i); - [ new Gtk2::Label($i), $values{$i} ]; + [ Gtk2::Label->new($fields{$i} || $i), $values{$i} ]; } sort $msec->list_functions($domain))))), new Gtk2::Label($label)); $options_values{$domain} = \%values; @@ -179,7 +189,7 @@ $notebook->append_page(gtkshow(create_scrolled_window(gtkpack_(new Gtk2::VBox(0, $security_checks_value{$i} = new_editable_combo([ 'yes', 'no', 'default' ], $msec->get_check_value($i)); my $entry = $security_checks_value{$i}->entry; set_help_tip($entry, $msec->get_check_default($i), $i); - [ gtkshow(new Gtk2::Label(translate($i))), $security_checks_value{$i} ]; + [ gtkshow(new Gtk2::Label($fields{$i} || translate($i))), $security_checks_value{$i} ]; } sort $msec->list_checks)))), new Gtk2::Label(N("Periodic Checks"))); @@ -212,7 +222,7 @@ my $bok = gtksignal_connect(Gtk2::Button->new_from_stock('gtk-ok'), log::explanations("Setting security periodic checks"); foreach my $key (keys %security_checks_value) { - $msec->set_check($key, $security_checks_value{$key}->entry->get_text); + $msec->set_check($key, from_i18n($security_checks_value{$key}->entry->get_text)); } $msec->apply_checks; @@ -220,7 +230,7 @@ my $bok = gtksignal_connect(Gtk2::Button->new_from_stock('gtk-ok'), log::explanations("Setting msec functions related to $domain"); foreach my $key (keys %{$options_values{$domain}}) { my $opt = $options_values{$domain}{$key}; - $msec->set_function($key, $opt =~ /Combo/ ? $opt->entry->get_text : $opt->get_text); + $msec->set_function($key, from_i18n($opt =~ /Combo/ ? $opt->entry->get_text : $opt->get_text)); } } $msec->apply_functions; |