From 324ea5723986955a0f2d9c5aaa41d30ef4d8f032 Mon Sep 17 00:00:00 2001 From: Juergen Schmied Date: Sun, 22 Nov 1998 17:43:30 +0000 Subject: [PATCH] Small fixes to get the default language to a sensible value. Thanks to Pablo. --- include/options.h | 2 +- misc/main.c | 5 ++++- ole/ole2nls.c | 27 +++++++++++++-------------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/include/options.h b/include/options.h index 8f047aba1d..ec09f0262f 100644 --- a/include/options.h +++ b/include/options.h @@ -15,7 +15,7 @@ * the proper case line */ typedef enum -{ +{ LANG_Xx, /* Just to ensure value 0 is not used */ LANG_En, /* English */ LANG_Es, /* Spanish */ LANG_De, /* German */ diff --git a/misc/main.c b/misc/main.c index 2ac1f6e3ee..f469d49192 100644 --- a/misc/main.c +++ b/misc/main.c @@ -669,7 +669,7 @@ int MAIN_GetLanguageID(LPCSTR Lang,LPCSTR Country,LPCSTR Charset,LPCSTR Dialect) LANG_ENTRY_BEGIN( "eo", ESPERANTO ) /* not official */ LANG_ENTRY_END( ESPERANTO ) - ret = LANG_NEUTRAL; + ret = LANG_ENGLISH; end_MAIN_GetLanguageID: if (Charset) free(charset); @@ -737,6 +737,9 @@ static void MAIN_ParseOptions( int *argc, char *argv[] ) Options.programName = MAIN_GetProgramName( *argc, argv ); Options.argv0 = argv[0]; + /* initialise Options.language to 0 to tell "no language choosen yet" */ + Options.language = 0; + /* Get display name from command line */ for (i = 1; i < *argc; i++) { diff --git a/ole/ole2nls.c b/ole/ole2nls.c index 1a5f8dd7d2..08238fd8b3 100644 --- a/ole/ole2nls.c +++ b/ole/ole2nls.c @@ -590,10 +590,11 @@ LANGID WINAPI GetUserDefaultLangID() if (!buf) buf=getenv("LANG"); if (!buf) buf=getenv("LC_ALL"); if (!buf) buf=getenv("LC_MESSAGES"); - if (!buf) return userLCID = MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ); + if (!buf) buf=getenv("LC_CTYPE"); + if (!buf) return userLCID = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ); if (!strcmp(buf,"POSIX") || !strcmp(buf,"C")) { - return MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ); + return MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ); } lang=buf; @@ -635,6 +636,9 @@ INT16 WINAPI GetLocaleInfo16(LCID lcid,LCTYPE LCType,LPSTR buf,INT16 len) /****************************************************************************** * GetLocaleInfo32A [KERNEL32.342] + * + * NOTES + * LANG_NEUTRAL is equal to LOCALE_SYSTEM_DEFAULT */ INT32 WINAPI GetLocaleInfo32A(LCID lcid,LCTYPE LCType,LPSTR buf,INT32 len) { @@ -649,12 +653,14 @@ INT32 WINAPI GetLocaleInfo32A(LCID lcid,LCTYPE LCType,LPSTR buf,INT32 len) return 0; } - if (lcid == LOCALE_SYSTEM_DEFAULT || (LCType & LOCALE_NOUSEROVERRIDE) ) { - lcid = GetSystemDefaultLCID(); - } else - if (lcid == LOCALE_USER_DEFAULT) { - lcid = GetUserDefaultLCID(); + if (lcid ==0 || lcid == LANG_SYSTEM_DEFAULT || (LCType & LOCALE_NOUSEROVERRIDE) ) /* 0x00, 0x400 */ + { + lcid = GetSystemDefaultLCID(); } + else if (lcid == LANG_USER_DEFAULT) /*0x800*/ + { + lcid = GetUserDefaultLCID(); + } LCType &= ~(LOCALE_NOUSEROVERRIDE|LOCALE_USE_CP_ACP); /* As an option, we could obtain the value from win.ini. @@ -676,13 +682,6 @@ INT32 WINAPI GetLocaleInfo32A(LCID lcid,LCTYPE LCType,LPSTR buf,INT32 len) return 0; } - - if ((lang & 0x3ff) == 0x000) /*LANG_NEUTRAL ==> US English*/ { - lang = 0x0409; - WARN(ole,"no language set, assume LANG_ENGLISH_US \n"); - } - - found=0;lang=lcid; for (i=0;i<3;i++) { int j; -- 2.32.0.93.g670b81a890