summaryrefslogtreecommitdiffstats
path: root/_irpm
diff options
context:
space:
mode:
Diffstat (limited to '_irpm')
-rwxr-xr-x_irpm43
1 files changed, 17 insertions, 26 deletions
diff --git a/_irpm b/_irpm
index 404748e5..974f5c2f 100755
--- a/_irpm
+++ b/_irpm
@@ -1,5 +1,15 @@
#!/usr/bin/perl
+# for i18n
+use POSIX;
+use Locale::GetText;
+
+setlocale (LC_ALL, "");
+Locale::GetText::textdomain ("urpmi");
+
+import Locale::GetText I_;
+*i18n = *I_;
+
$automatic = 0;
$timeout = 15;
@@ -7,11 +17,8 @@ $DIR = "/var/lib/urpmi";
$BASE = "$DIR/autoirpm";
$INSTALL_SCRIPT_REP = "$BASE.scripts";
-($lang) = ($ENV{LC_ALL} || $ENV{LANGUAGE} || $ENV{LC_MESSAGES} || $ENV{LANG}) =~ /(..)/;
-
-
$rpm = shift @ARGV;
-print STDERR "autoirpm: ", i18n("installing"), " $rpm\n";
+print STDERR "autoirpm: ", i18n("installing $rpm\n");
`xtest`;
$X = ($? == 0);
@@ -21,7 +28,7 @@ $SIG{ALRM} = sub { $pid and kill 9, $pid; not_found(); };
alarm $timeout;
if (!$automatic) {
- $interactive_mesg = i18n("Automatic installation of packages...\nYou requested installation of package") . " $rpm\n" . i18n("Is it ok?");
+ $interactive_mesg = i18n("Automatic installation of packages...\nYou requested installation of package $rpm\n") . i18n("Is it ok?");
if ($X) {
my $ok = i18n("Ok");
my $cancel = i18n("Cancel");
@@ -29,10 +36,11 @@ if (!$automatic) {
wait();
$? and not_found();
} else {
- use POSIX;
if (isatty(0)) {
- print $interactive_mesg, " (y/n) ";
- <STDIN> =~ /y/i or not_found();
+ $noexpr = i18n("Nn");
+ $yesexpr = i18n("Yy");
+ print $interactive_mesg, i18n(" (Y/n) ");
+ <STDIN> =~ /[$yesexpr]/ or not_found();
} else {
# Arghhh not in automatic and no way to contact the user... dying
not_found();
@@ -50,24 +58,7 @@ fork or exec $urpmi, "--comment", $ARGV[0], $rpm; wait;
not_found();
sub not_found {
- print STDERR "$rpm: command not found\n";
+ print STDERR i18n("$rpm: command not found\n");
exit 127;
}
-sub i18n { $I18N{$lang}->{$_[0]} || $_[0]; }
-
-BEGIN {
-
-%I18N = (
-
-'fr' => {
-"installing", "installation de",
-"Automatic installation of packages...\nYou requested installation of package" => "Installation automatique des packages...\nVous avez demandé l'installation du package",
-"Is it ok?" => "On continue ?",
-"Ok" => "Continuer",
-"Cancel" => "Annuler",
-},
-
-);
-
-}