summaryrefslogtreecommitdiffstats
path: root/urpm/msg.pm
diff options
context:
space:
mode:
Diffstat (limited to 'urpm/msg.pm')
-rw-r--r--urpm/msg.pm17
1 files changed, 15 insertions, 2 deletions
diff --git a/urpm/msg.pm b/urpm/msg.pm
index d5e618b3..c61a9187 100644
--- a/urpm/msg.pm
+++ b/urpm/msg.pm
@@ -7,9 +7,10 @@ no warnings;
use Exporter;
use URPM;
+my $encoding;
BEGIN {
- eval { require encoding };
- eval "use open ':locale'" if eval { encoding::_get_locale_encoding() ne 'ANSI_X3.4-1968' };
+ eval { require encoding; $encoding = encoding::_get_locale_encoding() };
+ eval "use open ':locale'" if $encoding && $encoding ne 'ANSI_X3.4-1968';
}
(our $VERSION) = q($Revision$) =~ /(\d+)/;
@@ -29,6 +30,18 @@ URPM::bind_rpm_textdomain_codeset();
our $no_translation;
+sub from_locale_encoding {
+ my ($s) = @_;
+ $encoding && eval {
+ require Encode;
+ Encode::decode($encoding, $s);
+ } || do {
+ require utf8;
+ utf8::decode($s);
+ $s;
+ } || $s;
+}
+
sub translate {
my ($s, $o_plural, $o_nb) = @_;
my $res;