If no language environment variable is defined, use "C" locale instead of "en_US".

[INTERPRETER]
* NEW: Add process id in warning messages.
* BUG: If no language environment variable is defined, use "C" locale instead of "en_US".
This commit is contained in:
gambas 2020-09-17 09:52:38 +02:00
parent f0606b61c3
commit 2d1d307455
2 changed files with 7 additions and 3 deletions

View file

@ -721,7 +721,7 @@ void ERROR_warning(const char *warning, ...)
fflush(NULL);
fprintf(stderr, "gbx" GAMBAS_VERSION_STRING ": warning: ");
fprintf(stderr, "gbx" GAMBAS_VERSION_STRING " [%d]: warning: ", getpid());
vfprintf(stderr, warning, args);
va_end(args);

View file

@ -593,7 +593,7 @@ const char *LOCAL_get_lang(void)
if (!lang || !*lang)
lang = getenv("LANG");
if (!lang || !*lang)
lang = "en_US";
lang = "C";
_lang = STRING_new_zero(lang);
}
@ -610,7 +610,7 @@ void LOCAL_set_lang(const char *lang)
THROW(E_ARG);
#ifdef DEBUG_LANG
fprintf(stderr, "******** LOCAL_set_lang: %s ********\n", lang);
fprintf(stderr, "******** LOCAL_set_lang: %s\n", lang ? lang : "(null)");
#endif
if (lang && *lang)
@ -622,6 +622,10 @@ void LOCAL_set_lang(const char *lang)
STRING_free(&_lang);
lang = LOCAL_get_lang();
#ifdef DEBUG_LANG
fprintf(stderr, "lang = %s\n", lang);
#endif
my_setenv("LANG", lang, env_LANG);
my_setenv("LC_ALL", lang, env_LC_ALL);