diff options
-rwxr-xr-x | grpmi/grpmi.pl | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/grpmi/grpmi.pl b/grpmi/grpmi.pl index bcb3ebe4..2ed77e85 100755 --- a/grpmi/grpmi.pl +++ b/grpmi/grpmi.pl @@ -43,7 +43,7 @@ sub sprintf_fixutf8 { if ($need_upgrade == 3) { c::upgrade_utf8($_) foreach @_ }; sprintf shift, @_; } -sub _ { +sub N { my $s = shift @_; my $t = translate($s); sprintf_fixutf8 $t, @_; } @@ -62,26 +62,26 @@ sub interactive_msg { my $label = $_; gtksignal_connect(Gtk2::Button->new($label), clicked => sub { $d->{retval} = $label; Gtk2->main_quit }) } @$yesno - : $yesno ? (gtksignal_connect(Gtk2::Button->new(_("Yes")), clicked => sub { $d->{retval} = 1; Gtk2->main_quit }), - gtksignal_connect(Gtk2::Button->new(_("No")), clicked => sub { $d->{retval} = 0; Gtk2->main_quit })) - : gtksignal_connect(Gtk2::Button->new(_("Ok")), clicked => sub { Gtk2->main_quit }) + : $yesno ? (gtksignal_connect(Gtk2::Button->new(N("Yes")), clicked => sub { $d->{retval} = 1; Gtk2->main_quit }), + gtksignal_connect(Gtk2::Button->new(N("No")), clicked => sub { $d->{retval} = 0; Gtk2->main_quit })) + : gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub { Gtk2->main_quit }) ))); $l->set_justify('left'); $d->main; return $d->{retval}; } -$> and interactive_msg(_("Error..."), - _("You need to be root to install packages, sorry.")), mexit -1; +$> and interactive_msg(N("Error..."), + N("You need to be root to install packages, sorry.")), mexit -1; -grpmi_rpm::init_rcstuff() and interactive_msg(_("RPM initialization error"), - _("The initialization of config files of RPM was not possible, sorry.")), mexit -1; +grpmi_rpm::init_rcstuff() and interactive_msg(N("RPM initialization error"), + N("The initialization of config files of RPM was not possible, sorry.")), mexit -1; $ENV{HOME} ||= '/root'; my @grpmi_config = map { chomp_($_) } cat_("$ENV{HOME}/.grpmi"); my $mainw = ugtk2->new('grpmi'); -my $label = Gtk2::Label->new(_("Initializing...")); +my $label = Gtk2::Label->new(N("Initializing...")); my $progressbar = gtkset_size_request(Gtk2::ProgressBar->new, 400, 0); gtkadd($mainw->{window}, gtkpack(gtkadd(create_vbox(), $label, $progressbar))); $mainw->{rwindow}->set_position('center'); @@ -104,21 +104,21 @@ foreach my $arg (@ARGV) { my $url = $arg; $arg = "$cache_location/" . basename($url); retry_download: - $label->set(_("Downloading package `%s' (%s/%s)...", basename($url), $download_progress, $nb_downloads)); + $label->set(N("Downloading package `%s' (%s/%s)...", basename($url), $download_progress, $nb_downloads)); select(undef, undef, undef, 0.1); $mainw->flush; #- hackish :-( my $res = curl_download::download($url, $cache_location, sub { $_[0] and $progressbar->set_fraction($_[1]/$_[0]); $mainw->flush }); if ($res) { - my $results = interactive_msg(_("Error during download"), -_("There was an error downloading package: + my $results = interactive_msg(N("Error during download"), +N("There was an error downloading package: %s Error: %s Do you want to continue (skipping this package)?", $url, $res), - [ _("Yes"), _("No"), _("Retry download") ]); - $results eq _("No") and goto cleanup; - $results eq _("Retry download") and goto retry_download; + [ N("Yes"), N("No"), N("Retry download") ]); + $results eq N("No") and goto cleanup; + $results eq N("Retry download") and goto retry_download; $arg = "-skipped&$arg&"; } } @@ -134,21 +134,21 @@ if (!member('--no-verify-rpm', @ARGV)) { if ($arg !~ /^-/) { if (-f $arg) { $yes_to_all and next; - $label->set(_("Verifying signature of `%s'...", basename($arg))); $mainw->flush; + $label->set(N("Verifying signature of `%s'...", basename($arg))); $mainw->flush; if (my $res = grpmi_rpm::verify_sig($arg)) { - my $results = interactive_msg(_("Signature verification error"), -_("The signature of the package `%s' is not correct: + my $results = interactive_msg(N("Signature verification error"), +N("The signature of the package `%s' is not correct: %s Do you want to install it anyway?", basename($arg), $res), - [ _("Yes"), _("Yes to all"), _("No") ]); - $results eq _("No") and $arg = "-skipped&$arg&"; - $results eq _("Yes to all") and $yes_to_all = 1; + [ N("Yes"), N("Yes to all"), N("No") ]); + $results eq N("No") and $arg = "-skipped&$arg&"; + $results eq N("Yes to all") and $yes_to_all = 1; } } else { - interactive_msg(_("File error"), -_("The following file is not valid: + interactive_msg(N("File error"), +N("The following file is not valid: %s @@ -164,7 +164,7 @@ Do you want to continue anyway (skipping this package)?", # -=-=-=---=-=-=---=-=-=-- install packages -=-=-=---=-=-=---=-=-=- if (grep { /^[^-]/ } @ARGV) { - $label->set(_("Preparing packages for installation...")); $mainw->flush; + $label->set(N("Preparing packages for installation...")); $mainw->flush; my $nb_installs = int(grep { /^[^-]/ } @ARGV); my $install_progress; @@ -172,8 +172,8 @@ if (grep { /^[^-]/ } @ARGV) { my ($msg) = @_; my $retval; my %actions = ( 'conflicts' => sub { - interactive_msg(_("Conflicts detected"), -_("Conflicts were detected: + interactive_msg(N("Conflicts detected"), +N("Conflicts were detected: %s Install aborted.", @@ -182,7 +182,7 @@ Install aborted.", return 1; }, 'inst-start' => sub { $install_progress++; - $label->set(_("Installing package `%s' (%s/%s)...", $1, $install_progress, $nb_installs)); + $label->set(N("Installing package `%s' (%s/%s)...", $1, $install_progress, $nb_installs)); $mainw->flush }, 'inst-progress' => sub { $1 =~ /(\d+) (\d+)/; @@ -196,7 +196,7 @@ Install aborted.", my $res = chomp_(grpmi_rpm::install_packages(\&install_packages_callback, @ARGV)); if ($res) { - interactive_msg(_("Problems occurred during installation"), _("There was an error during packages installation:\n\n%s", $res)); + interactive_msg(N("Problems occurred during installation"), N("There was an error during packages installation:\n\n%s", $res)); goto cleanup; } } @@ -207,8 +207,8 @@ cleanup: if (!member('noclearcache', @grpmi_config)) { my @toclean = map { s/^-skipped&([^&]+)&$/$1/; if_(/^\Q$cache_location/, $_) } @ARGV; if ($forced_exitstatus || $exitstatus && @toclean) { - interactive_msg(_("Cleanup"), -_("Cleanup question: there was an error during installation, do you want to + interactive_msg(N("Cleanup"), +N("Cleanup question: there was an error during installation, do you want to remove the %d downloaded package(s)? (they are located in %s)", scalar(@toclean), $cache_location), 1) or goto exiting; } |