summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2018-07-28 04:08:58 +0200
committerGuillem Jover <guillem@debian.org>2018-07-30 06:30:04 +0200
commite3c32720167a6c23fc19471d3e3273965c3dc9e5 (patch)
tree575cf7e6dc0cdb3fc73a2f8b9acd861e07688fa4 /scripts
parent967373bc25ed6d7e816e13190a5281c057048292 (diff)
downloaddpkg-e3c32720167a6c23fc19471d3e3273965c3dc9e5.tar.gz
Dpkg::Gettext: Fix fallback textdomain() to honor its expected interface
Even though we will not use the domain value set by this function, we should honor its original interface and return a domain string, and update it when requested.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Dpkg/Gettext.pm7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/Dpkg/Gettext.pm b/scripts/Dpkg/Gettext.pm
index 33ef1c48d..89a4d154f 100644
--- a/scripts/Dpkg/Gettext.pm
+++ b/scripts/Dpkg/Gettext.pm
@@ -28,6 +28,7 @@ package Dpkg::Gettext;
use strict;
use warnings;
+use feature qw(state);
our $VERSION = '1.03';
our @EXPORT = qw(
@@ -122,6 +123,12 @@ BEGIN {
return shift;
};
*textdomain = sub {
+ my $new_domain = shift;
+ state $domain = $DEFAULT_TEXT_DOMAIN;
+
+ $domain = $new_domain if defined $new_domain;
+
+ return $domain;
};
*ngettext = sub {
my ($msgid, $msgid_plural, $n) = @_;