Fixed GetLocaleInfo32A for other languages than en_uk.

Made it recognise LOCALE_SYSTEM_DEFAULT, LOCALE_SYSTEM_DEFAULT and
last but not least the first argument lcid where is all about...
This commit is contained in:
Juergen Schmied 1998-10-17 12:15:19 +00:00 committed by Alexandre Julliard
parent f4f1719ca5
commit 7ae92654a5
1 changed files with 50 additions and 69 deletions

View File

@ -414,11 +414,18 @@ INT32 WINAPI GetLocaleInfo32A(LCID lcid,LCTYPE LCType,LPSTR buf,INT32 len)
{ {
char *retString; char *retString;
int found,i; int found,i;
int lang; int lang=0;
TRACE(ole,"(0x%lx,0x%lx,%p,%x)\n", TRACE(ole,"(lcid=0x%lx,lctype=0x%lx,%p,%x)\n",
lcid,LCType,buf,len); lcid,LCType,buf,len);
if (lcid == LOCALE_SYSTEM_DEFAULT || (LCType & LOCALE_NOUSEROVERRIDE) )
{ lcid = GetSystemDefaultLCID();
}
else if (lcid == LOCALE_USER_DEFAULT)
{ lcid = GetUserDefaultLCID();
}
LCType &= ~(LOCALE_NOUSEROVERRIDE|LOCALE_USE_CP_ACP); LCType &= ~(LOCALE_NOUSEROVERRIDE|LOCALE_USE_CP_ACP);
/* As an option, we could obtain the value from win.ini. /* As an option, we could obtain the value from win.ini.
@ -441,100 +448,71 @@ INT32 WINAPI GetLocaleInfo32A(LCID lcid,LCTYPE LCType,LPSTR buf,INT32 len)
} }
#define LOCVAL(type,value) case type:retString=value;found=1;break; #define LOCVAL(type,value) case type:retString=value;found=1;break;
#define LANG_BEGIN(l,s) case MAKELANGID(l,s): switch (LCType) {
#define LANG_END default: found=0; break; } break;
/* Now, the language specific definitions. They don't have to be /* Now, the language specific definitions. They don't have to be
complete */ complete */
found=0; i=0;
do { found=0; i=0; lang=lcid;
if (i==0) lang=Languages[Options.language].langid;
if (i==1) lang=MAKELANGID( PRIMARYLANGID(lang), SUBLANG_DEFAULT);
i++;
switch(lang) { if (lang ==0x400) /*LANG_NEUTRAL ==> US English*/
case LANG_De: { lang = 0x409;
switch (LCType) { WARN(ole,"no language set, assume LANG_ENGLISH_US \n");
}
do
{ switch(lang)
{
LANG_BEGIN (LANG_GERMAN, SUBLANG_GERMAN) /*0x407*/
#include "nls/deu.nls" #include "nls/deu.nls"
default: found=0; break; LANG_END
}
break; /* LANG(De) */
case LANG_Da: LANG_BEGIN (LANG_DANISH, SUBLANG_DEFAULT) /*0x406*/
switch (LCType) {
#include "nls/dan.nls" #include "nls/dan.nls"
default: found=0;break; LANG_END
}
break; /* LANG(Da) */
case LANG_En: LANG_BEGIN (LANG_ENGLISH, SUBLANG_ENGLISH_US) /*0x409*/
switch (LCType) {
#include "nls/enu.nls" #include "nls/enu.nls"
default: found=0;break; LANG_END
}
break; /* LANG(En) */
case LANG_Eo: LANG_BEGIN (LANG_ESPERANTO, SUBLANG_DEFAULT) /*0x48f*/
switch (LCType) {
#include "nls/esperanto.nls" #include "nls/esperanto.nls"
default: found=0;break; LANG_END
}
break; /* LANG(Eo) */
case LANG_Fi: LANG_BEGIN (LANG_FINNISH, SUBLANG_DEFAULT) /*0x040B*/
switch (LCType) {
#include "nls/fin.nls" #include "nls/fin.nls"
default: found=0;break; LANG_END
}
break; /* LANG(Fi) */
case LANG_It: LANG_BEGIN (LANG_ITALIAN, SUBLANG_ITALIAN) /*0x410*/
switch (LCType) {
#include "nls/ita.nls" #include "nls/ita.nls"
default: found=0;break; LANG_END
}
break; /* LANG(It) */
case 0x0809: LANG_BEGIN (LANG_ENGLISH, SUBLANG_ENGLISH_UK) /*0x809*/
switch (LCType) {
#include "nls/eng.nls" #include "nls/eng.nls"
default: found=0;break; LANG_END
}
break; /* LANG(0x0809) (U.K. English) */
case LANG_Ko: /* string using codepage 949 */ LANG_BEGIN (LANG_KOREAN, SUBLANG_KOREAN) /*0x412*/
switch (LCType) {
#include "nls/kor.nls" #include "nls/kor.nls"
default: found=0;break; LANG_END
}
break; /* LANG(Ko) */
case LANG_Hu: LANG_BEGIN (LANG_HUNGARIAN, SUBLANG_DEFAULT) /*0x40e*/
switch (LCType) {
#include "nls/hun.nls" #include "nls/hun.nls"
default: found=0;break; LANG_END
}
break; /* LANG(En) */
case LANG_Pl: LANG_BEGIN (LANG_POLISH, SUBLANG_DEFAULT) /*0x415*/
switch (LCType) {
#include "nls/plk.nls" #include "nls/plk.nls"
default: found=0;break; LANG_END
}
break; /* LANG(Pl) */
case LANG_Pt: LANG_BEGIN (LANG_PORTUGUESE ,SUBLANG_PORTUGUESE_BRAZILIAN) /*0x416*/
switch (LCType) {
#include "nls/ptb.nls" #include "nls/ptb.nls"
default: found=0;break; LANG_END
}
break; /* LANG(Pt) */
case LANG_Sv: LANG_BEGIN (LANG_SWEDISH, SUBLANG_DEFAULT) /*0x41d*/
switch (LCType) {
#include "nls/sve.nls" #include "nls/sve.nls"
default: found=0;break; LANG_END
}
break; /* LANG(Sv) */
/*Insert other languages here*/ /*Insert other languages here*/
@ -542,13 +520,16 @@ INT32 WINAPI GetLocaleInfo32A(LCID lcid,LCTYPE LCType,LPSTR buf,INT32 len)
found=0; found=0;
break; break;
} /* switch */ } /* switch */
/* language not found, try without a sublanguage*/
lang=MAKELANGID( PRIMARYLANGID(lang), SUBLANG_DEFAULT);
i++;
} while (!found && i<2); } while (!found && i<2);
if(!found) { if(!found) {
ERR(ole,"'%s' not supported for your language.\n", ERR(ole,"'%s' not supported for your language.\n",
retString); retString);
retString = "<WINE-NLS-unknown>"; retString = "<WINE-NLS-unknown>";
/*return 0;*/
} }
if (buf) if (buf)
lstrcpyn32A(buf,retString,len); lstrcpyn32A(buf,retString,len);