diff options
Diffstat (limited to 'urpmq')
-rwxr-xr-x | urpmq | 39 |
1 files changed, 24 insertions, 15 deletions
@@ -20,6 +20,15 @@ #use strict qw(subs vars refs); use urpm; +# for i18n +use POSIX; +use Locale::GetText; + +setlocale (LC_ALL, ""); +Locale::GetText::textdomain ("urpmi"); + +import Locale::GetText I_; +*_ = *I_; #- default options. my $query = {}; @@ -27,12 +36,12 @@ my $query = {}; my @files; my @names; -my %I18N; -load_po(); +#my %I18N; +#load_po(); sub usage { #die(_("usage: urpmq [-h] [-d] [-u] [-c] [-g] [-v] [-r] package_name|rpm_file [package_names|rpm_files...]\n")); - die(_("urpmq version %s + die( sprintf( _("urpmq version %s Copyright (C) 2000 MandrakeSoft. This is free software and may be redistributed under the terms of the GNU GPL. @@ -50,7 +59,7 @@ usage: stdout (root only). names or rpm files given on command line are queried. -", $urpm::VERSION)); +", $urpm::VERSION))); } #- parse arguments list. @@ -67,9 +76,9 @@ for (@ARGV) { /g/ and do { $query->{group} = 1; next }; /v/ and do { $query->{version} = 1; next }; /r/ and do { $query->{release} = 1; next }; - die "urpmq: unknown option \"-$1\", check usage with --help\n"; } next }; + die( sprintf _("urpmq: unknown option \"-$1\", check usage with --help\n")); } next }; @nextargv and do { my $r = shift @nextargv; $r and $$r = $_; next }; - /\.rpm$/ and do { -r $_ or print STDERR "urpmq: cannot read rpm file \"$_\"\n", next; + /\.rpm$/ and do { -r $_ or print STDERR _("urpmq: cannot read rpm file \"$_\"\n"), next; push @files, $_; next }; push @names, $_; } @@ -110,7 +119,7 @@ if ($query->{auto_select}) { $urpm->select_packages_to_upgrade('', \%packages, \%to_remove, \%keep_files); if (keys(%to_remove) > 0) { - print STDERR "some package have to be removed for being upgraded, this is not supported yet\n"; + print STDERR _("some package have to be removed for being upgraded, this is not supported yet\n"); } } @@ -123,7 +132,7 @@ if ($query->{headers}) { my ($local_sources, $list) = $urpm->get_source_packages(\%packages); unless ($local_sources || $list) { - die("unable to get source packages, aborting"); + die( sprintf _("unable to get source packages, aborting")); exit 1; } @@ -171,13 +180,13 @@ foreach my $id (keys %packages) { } } -sub _ { - my $s = shift @_; my $t = translate($s); - $t && ref $t or return sprintf $t, @_; - my ($T, @p) = @$t; - sprintf $T, @_[@p]; -} -sub translate { $I18N{$_[0]} || $_[0]; } +#sub _ { +# my $s = shift @_; my $t = translate($s); +# $t && ref $t or return sprintf $t, @_; +# my ($T, @p) = @$t; +# sprintf $T, @_[@p]; +#} +#sub translate { $I18N{$_[0]} || $_[0]; } sub load_po { my ($from, $to, $state, $fuzzy); |