From e3c32720167a6c23fc19471d3e3273965c3dc9e5 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sat, 28 Jul 2018 04:08:58 +0200 Subject: 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. --- scripts/Dpkg/Gettext.pm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'scripts') 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) = @_; -- cgit v1.2.3