bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guess_category_value(LC_MESSAGES...) on windows


From: Jesse Allen
Subject: guess_category_value(LC_MESSAGES...) on windows
Date: Sat, 22 Jul 2023 16:04:45 -0700

Hello,

Why doesn't guess_category_value, when LC_MESSAGES is not available through the Windows CRT, call the locally provided libintl/gnulib setlocale to get the value, which already can store LC_MESSAGES for the user?

For example, I allow the user in my game to select a different message catalog, because their system is in German, and they want the game in English. So the code does the following in summary:

setlocale(LC_ALL, "");  /* at program initialization */
...
/* user wants a different locale */
setlocale(LC_MESSAGES, locale);
setlocale(LC_CTYPE, locale);
#ifndef HAVE_LC_MESSAGES
// Gettext fakes the setlocale for LC_MESSAGES above via a
// wrapper, set the env var as well since the var is
// actually used by gettext when setlocale is not possible.
setenv("LC_MESSAGES", locale, 1);
#endif

This is because when gettext is then called, it only queries environment variables. It never uses the value that was stored but is available. In the case the CRT does not support LC_MESSAGES, we could be querying internally for what was stored.

Can you suggest something about this?

Thanks
-Jesse

reply via email to

[Prev in Thread] Current Thread [Next in Thread]