Restores system locale detection for Windows. --lang=thai now works, still problem with e.g. French and German.
This commit is contained in:
parent
8a4ee68fe5
commit
7c14bd2e8d
1 changed files with 19 additions and 4 deletions
|
|
@ -701,9 +701,6 @@ static const char * lang_prefix;
|
||||||
static void set_current_language(void)
|
static void set_current_language(void)
|
||||||
{
|
{
|
||||||
char * loc;
|
char * loc;
|
||||||
#ifdef WIN32
|
|
||||||
char str[128];
|
|
||||||
#endif
|
|
||||||
int lang, i, found;
|
int lang, i, found;
|
||||||
|
|
||||||
bindtextdomain("tuxpaint", LOCALEDIR);
|
bindtextdomain("tuxpaint", LOCALEDIR);
|
||||||
|
|
@ -718,12 +715,29 @@ static void set_current_language(void)
|
||||||
lang = LANG_EN;
|
lang = LANG_EN;
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
loc = setlocale(LC_MESSAGES, NULL);
|
loc = setlocale(LC_MESSAGES, NULL);
|
||||||
if (loc != NULL)
|
if (loc != NULL)
|
||||||
{
|
{
|
||||||
if (strstr(loc, "LC_MESSAGES") != NULL)
|
if (strstr(loc, "LC_MESSAGES") != NULL)
|
||||||
loc = getenv("LANG");
|
loc = getenv("LANG");
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
loc = getenv("LANGUAGE");
|
||||||
|
if (!loc)
|
||||||
|
{
|
||||||
|
loc = _nl_locale_name(LC_MESSAGES, "");
|
||||||
|
if (loc)
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
int len;
|
||||||
|
len = strlen("LANGUAGE=")+strlen(loc)+1;
|
||||||
|
s = malloc(len);
|
||||||
|
snprintf(s, len, "LANGUAGE=%s", loc);
|
||||||
|
putenv(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
debug(loc);
|
debug(loc);
|
||||||
|
|
||||||
|
|
@ -749,7 +763,8 @@ static void set_current_language(void)
|
||||||
need_right_to_left = search_int_array(lang,lang_use_right_to_left);
|
need_right_to_left = search_int_array(lang,lang_use_right_to_left);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("DEBUG: Language is %s (%d)\n", lang_prefix, lang);
|
fprintf(stderr,"DEBUG: Language is %s (%d)\n", lang_prefix, lang);
|
||||||
|
fflush(stderr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue