Blob Blame History Raw
From aab29f9951a1276c666c1b6d2f2f923c083706ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 21 Sep 2020 15:20:04 +0200
Subject: [PATCH] Use LC_MESSAGES locale category instead of LANGUAGE
 environment variable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The LANGUAGE environment variable is a Gettext extension (in contrast
to POSIX locale) to supply a list of languages in order of
a descending preference. POSIX locale defines one language.

While LANGUAGE is a more versatile approach, it is seldom used. POSIX
locale seems more prevalent.

Signed-off-by: Petr Písař <ppisar@redhat.com>
---
 bin/gscan2pdf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/gscan2pdf b/bin/gscan2pdf
index 8a07e21c..91825154 100755
--- a/bin/gscan2pdf
+++ b/bin/gscan2pdf
@@ -93,7 +93,7 @@ use English qw( -no_match_vars )
   ;    # for $PERL_VERSION, $PROGRAM_NAME, $EVAL_ERROR, $ERRNO
 
 # To sort out LC_NUMERIC and $SIG{CHLD}
-use POSIX qw(locale_h :signal_h :errno_h :sys_wait_h);
+use POSIX qw(LC_MESSAGES locale_h setlocale :signal_h :errno_h :sys_wait_h);
 use Date::Calc
   qw(Delta_DHMS Add_Delta_DHMS Today_and_Now Timezone Date_to_Time);
 use Locale::gettext;
@@ -1543,7 +1543,7 @@ EOS
         $msg .= __("OCR requires gocr, tesseract, ocropus, or cuneiform\n");
     }
     if ( $dependencies{tesseract} ) {
-        my $lang_msg = Gscan2pdf::Tesseract->locale_installed( $ENV{LANGUAGE} );
+        my $lang_msg = Gscan2pdf::Tesseract->locale_installed(setlocale(LC_MESSAGES));
         if ( $lang_msg ne '1' ) { $msg .= $lang_msg }
         else {
             $logger->info(
-- 
2.25.4