From 6e0908fc5918ffd8b1a5b00e1c31e5056fb99af1 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Wed, 28 Apr 2004 08:57:58 +0000 Subject: Fix locale handling and the --no-locales command-line argument --- urpm/args.pm | 10 +++++++--- urpm/msg.pm | 7 +++++-- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'urpm') diff --git a/urpm/args.pm b/urpm/args.pm index 947f7193..d5de4bdc 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -37,9 +37,13 @@ my %options_spec = ( if (defined &::usage) { ::usage() } else { die "No help defined\n" } }, "no-locales" => sub { - require urpm; # make sure it has been loaded - undef *::N; undef *urpm::N; - *::N = *urpm::N = sub { sprintf(@_) }; + require urpm::msg; # make sure it has been loaded + undef *::N; + undef *urpm::N; + undef *urpm::msg::N; + undef *urpm::args::N; + *::N = *urpm::N = *urpm::msg::N = *urpm::args::N + = sub { my ($f, @p) = @_; sprintf($f, @p) }; }, update => \$::update, 'media|mediums=s' => \$::media, diff --git a/urpm/msg.pm b/urpm/msg.pm index fb5264c7..d913b233 100644 --- a/urpm/msg.pm +++ b/urpm/msg.pm @@ -12,13 +12,16 @@ my $yesexpr = N("Yy"); eval { require Locale::gettext; use POSIX qw(LC_ALL); - setlocale(LC_ALL, ""); + POSIX::setlocale(LC_ALL, ""); Locale::gettext::textdomain("urpmi"); }; sub N { my ($format, @params) = @_; - sprintf(eval { Locale::gettext::gettext($format || '') } || $format, @params); + sprintf( + eval { Locale::gettext::gettext($format || '') } || $format, + @params, + ); } sub log_it { -- cgit v1.2.1