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)
|
||||
{
|
||||
char * loc;
|
||||
#ifdef WIN32
|
||||
char str[128];
|
||||
#endif
|
||||
int lang, i, found;
|
||||
|
||||
bindtextdomain("tuxpaint", LOCALEDIR);
|
||||
|
|
@ -718,12 +715,29 @@ static void set_current_language(void)
|
|||
lang = LANG_EN;
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
loc = setlocale(LC_MESSAGES, NULL);
|
||||
if (loc != NULL)
|
||||
{
|
||||
if (strstr(loc, "LC_MESSAGES") != NULL)
|
||||
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);
|
||||
|
||||
|
|
@ -749,7 +763,8 @@ static void set_current_language(void)
|
|||
need_right_to_left = search_int_array(lang,lang_use_right_to_left);
|
||||
|
||||
#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
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue