[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Set LC_MESSAGES via setenv before setlocale.
From: |
Gavin D. Smith |
Subject: |
branch master updated: Set LC_MESSAGES via setenv before setlocale. |
Date: |
Sun, 01 Dec 2024 05:55:12 -0500 |
This is an automated email from the git hooks/post-receive script.
gavin pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 2e795653f6 Set LC_MESSAGES via setenv before setlocale.
2e795653f6 is described below
commit 2e795653f62c6a054c84cfef5cfb5afbbd442a1c
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Dec 1 10:55:02 2024 +0000
Set LC_MESSAGES via setenv before setlocale.
* tp/Texinfo/XS/main/translations.c (switch_messages_locale):
Set "LC_MESSAGES" via setenv before setlocale (LC_MESSAGES, ""),
rather than giving the locale name as the second argument to
setlocale, as this may not work on some platforms including
macOS, Windows, AIX, and OpenBSD. Info from Bruno Haible.
---
ChangeLog | 10 ++++++++++
tp/Texinfo/XS/main/translations.c | 23 +++++++++++++++--------
2 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b44c09c6b7..9c8e832e53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-12-01 Gavin Smith <gavinsmith0123@gmail.com>
+
+ Set LC_MESSAGES via setenv before setlocale.
+
+ * tp/Texinfo/XS/main/translations.c (switch_messages_locale):
+ Set "LC_MESSAGES" via setenv before setlocale (LC_MESSAGES, ""),
+ rather than giving the locale name as the second argument to
+ setlocale, as this may not work on some platforms including
+ macOS, Windows, AIX, and OpenBSD. Info from Bruno Haible.
+
2024-11-28 Patrice Dumas <pertusus@free.fr>
* tp/t/same_parser_multiple_files.t: set locale to C and LANGUAGE to
diff --git a/tp/Texinfo/XS/main/translations.c
b/tp/Texinfo/XS/main/translations.c
index 6748cdb612..19020bda23 100644
--- a/tp/Texinfo/XS/main/translations.c
+++ b/tp/Texinfo/XS/main/translations.c
@@ -104,18 +104,24 @@ switch_messages_locale (void)
if (working_locale)
{
- setenv_status = setenv ("LANG", working_locale, 1);
- locale = setlocale (LC_MESSAGES, working_locale);
+ setenv_status = setenv ("LC_MESSAGES", working_locale, 1);
+ || setenv ("LANG", working_locale, 1);
+ locale = setlocale (LC_MESSAGES, "");
+
+ /* Note that running "setlocale (LC_MESSAGES, working_locale)" directly
+ may not work depending on platform and/or gettext version. */
}
if (!locale || setenv_status)
{
- setenv_status = setenv ("LANG", "en_US.UTF-8", 1);
- locale = setlocale (LC_MESSAGES, "en_US.UTF-8");
+ setenv_status = setenv ("LC_MESSAGES", "en_US.UTF-8", 1);
+ || setenv ("LANG", "en_US.UTF-8", 1);
+ locale = setlocale (LC_MESSAGES, "");
}
if (!locale || setenv_status)
{
- setenv_status = setenv ("LANG", "en_US", 1);
- locale = setlocale (LC_MESSAGES, "en_US");
+ setenv_status = setenv ("LC_MESSAGES", "en_US", 1);
+ || setenv ("LANG", "en_US", 1);
+ locale = setlocale (LC_MESSAGES, "");
}
if ((!locale || setenv_status) && !locale_command)
{
@@ -143,8 +149,9 @@ switch_messages_locale (void)
free (line);
continue;
}
- setenv_status = setenv ("LANG", line, 1);
- locale = setlocale (LC_MESSAGES, line);
+ setenv_status = setenv ("LC_MESSAGES", line, 1);
+ || setenv ("LANG", line, 1);
+ locale = setlocale (LC_MESSAGES, "");
if (locale && !setenv_status)
{
free (line);
- branch master updated: Set LC_MESSAGES via setenv before setlocale.,
Gavin D. Smith <=