The localization properties are now functional. Only 16 languages are currently reported on Windows.

This commit is contained in:
JET 2010-10-05 17:53:17 -06:00
parent 1fdc016e58
commit 45e6cd5a60
2 changed files with 9 additions and 8 deletions

View File

@ -231,8 +231,9 @@ Java_java_lang_Runtime_waitFor(JNIEnv* e, jclass, jlong pid)
}
void getLocale(char* language, char* region) {
const char* lang = 0;
const char* reg = 0;
const char dummy = '\0';
const char* lang = &dummy;
const char* reg = &dummy;
unsigned locale = GetUserDefaultUILanguage();
unsigned prilang = locale & 0x3ff;
@ -266,7 +267,7 @@ void getLocale(char* language, char* region) {
case 0x00a: {
lang = "es";
switch (sublang) {
case 0x01: case: 0x03: reg = "ES"; break;
case 0x01: case 0x03: reg = "ES"; break;
case 0x02: reg = "MX"; break;
}
} break;
@ -302,8 +303,8 @@ void getLocale(char* language, char* region) {
case 0x01d: lang = "sv"; reg = "SE"; break;
}
if (language) memcpy(language, lang, strlen(lang) * sizeof(char));
if (region) memcpy(region, reg, strlen(reg) * sizeof(char));
if (language) memcpy(language, lang, (strlen(lang) + 1) * sizeof(char));
if (region) memcpy(region, reg, (strlen(reg) + 1) * sizeof(char));
}
#else
extern "C" JNIEXPORT void JNICALL
@ -451,8 +452,8 @@ void getLocale(char* language, char* region) {
lang[underscore] = reg[reglen] = '\0';
}
if (language) memcpy(language, lang, strlen(lang) * sizeof(char));
if (region) memcpy(region, reg, strlen(reg) * sizeof(char));
if (language) memcpy(language, lang, (strlen(lang) + 1) * sizeof(char));
if (region) memcpy(region, reg, (strlen(reg) + 1) * sizeof(char));
}
#endif

View File

@ -190,7 +190,7 @@ ifeq ($(platform),windows)
exe-suffix = .exe
lflags = -L$(lib) $(common-lflags) -lws2_32 -mwindows -mconsole
cflags = -I$(inc) $(common-cflags)
cflags = -I$(inc) $(common-cflags) -DWINVER=0x0500
ifeq (,$(filter mingw32 cygwin,$(build-platform)))
cxx = i586-mingw32msvc-g++