Imported Upstream version 1.07 upstream upstream/1.07
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 19 Jul 2022 06:40:33 +0000 (15:40 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 19 Jul 2022 06:40:33 +0000 (15:40 +0900)
META.json
META.yml
README
gettext.pm
t/frconvert.t
test_data/gen_test_data.pl

index fd26a1f..1ed5a5b 100644 (file)
--- a/META.json
+++ b/META.json
@@ -43,5 +43,5 @@
          "url" : "https://github.com/vandry/Perl-Locale-gettext"
       }
    },
-   "version" : "1.06"
+   "version" : "1.07"
 }
index 1ef332e..45f62ab 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -21,4 +21,4 @@ requires: {}
 resources:
   license: http://dev.perl.org/licenses/
   repository: https://github.com/vandry/Perl-Locale-gettext
-version: 1.06
+version: 1.07
diff --git a/README b/README
index cd06a9d..d269e6a 100644 (file)
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
 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
@@ -18,6 +18,8 @@ specified in the Perl README file.
 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)
index d0a5af0..63bfb1f 100644 (file)
@@ -46,7 +46,7 @@ BEGIN {
        import Encode if ($encode_available);
 }
 
-$VERSION = "1.06" ;
+$VERSION = "1.07" ;
 
 %EXPORT_TAGS = (
 
@@ -268,7 +268,7 @@ not provide it.
 
 =head1 VERSION
 
-1.06.
+1.07.
 
 =head1 SEE ALSO
 
index d33dc11..2bca28b 100644 (file)
@@ -19,9 +19,6 @@ if ($@ =~ /Encode module not available/) {
        if ($d->get("No problem") eq "Pas de probl\x{e8}me") {
                ok(1);
        } else {
-use Data::Dumper;
-print Dumper($d);
-print "[", $d->get("No problem"), "]\n";
                ok(0);
        }
 }
index 8763f31..3e5fd06 100644 (file)
@@ -4,15 +4,19 @@ sub gen {
        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;
@@ -20,6 +24,10 @@ sub gen {
                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;
@@ -28,6 +36,15 @@ sub gen {
                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