Locale::gettext
-version 1.06
+version 1.07
This is a perl5 module quickly written to gain access to
the C library functions for internatialization. They
Changes
-------
+1.07 Fix test failures caused by $LANGUAGE being set
+
1.06 Bugfix: #104667 Makefile.PL libaries need to be listed after .o files
Bugfix: #104668 ensure availability of locale API, correct typo in documentation
Add META.yml (Fixes #91921)
my ($domain) = @_;
my $messages;
+ my $language;
unless (open(LOCALE, "locale|")) {
doskip();
}
while (<LOCALE>) {
if (/^LC_MESSAGES=\"(.*)\"$/) {
$messages = $1;
- last;
} elsif (/^LC_MESSAGES=(.*)$/) {
$messages = $1;
+ } elsif (/^LANGUAGE=\"(.*)\"$/) {
+ $language = $1;
+ } elsif (/^LANGUAGE=(.*)$/) {
+ $language = $1;
}
}
close LOCALE;
doskip();
}
+ if (!defined($messages)) {
+ skip("cannot run test without a locale set", 0);
+ exit 0;
+ }
if ($messages eq 'C') {
skip("cannot run test in the C locale", 0);
exit 0;
skip("cannot run test in the POSIX locale", 0);
exit 0;
}
+ if (defined($language) && $language) {
+ # In GNU gettext, $LANGUAGE overrides
+ # all the other environment variables,
+ # for message translations only.
+ # https://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html#The-LANGUAGE-variable
+ # The library will look first for the first entry in
+ # that list, so give it what it wants.
+ $messages = (split(':', $language))[0];
+ }
mkdir "test_data/" . $messages, 0755 unless (-d "test_data/" . $messages);
mkdir "test_data/" . $messages . "/LC_MESSAGES", 0755