kernel32: Use different default sublangs for Spanish and Chinese.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
77f78ddbf9
commit
7737693693
|
@ -359,6 +359,18 @@ static UINT find_charset( const WCHAR *name )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static WORD get_default_sublang(LCID lang)
|
||||||
|
{
|
||||||
|
switch (PRIMARYLANGID(lang))
|
||||||
|
{
|
||||||
|
case LANG_SPANISH:
|
||||||
|
return SUBLANG_SPANISH_MODERN;
|
||||||
|
case LANG_CHINESE:
|
||||||
|
return SUBLANG_CHINESE_SIMPLIFIED;
|
||||||
|
default:
|
||||||
|
return SUBLANG_DEFAULT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* find_locale_id_callback
|
* find_locale_id_callback
|
||||||
|
@ -402,7 +414,7 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type,
|
||||||
}
|
}
|
||||||
else /* match default language */
|
else /* match default language */
|
||||||
{
|
{
|
||||||
if (SUBLANGID(LangID) == SUBLANG_DEFAULT) matches++;
|
if (SUBLANGID(LangID) == get_default_sublang( LangID )) matches++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->codepage)
|
if (data->codepage)
|
||||||
|
@ -1671,7 +1683,7 @@ INT WINAPI GetLocaleInfoW( LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len )
|
||||||
|
|
||||||
/* replace SUBLANG_NEUTRAL by SUBLANG_DEFAULT */
|
/* replace SUBLANG_NEUTRAL by SUBLANG_DEFAULT */
|
||||||
if (SUBLANGID(lang_id) == SUBLANG_NEUTRAL)
|
if (SUBLANGID(lang_id) == SUBLANG_NEUTRAL)
|
||||||
lang_id = MAKELANGID(PRIMARYLANGID(lang_id), SUBLANG_DEFAULT);
|
lang_id = MAKELANGID(PRIMARYLANGID(lang_id), get_default_sublang( lang_id ));
|
||||||
|
|
||||||
if (!(hrsrc = FindResourceExW( kernel32_handle, (LPWSTR)RT_STRING,
|
if (!(hrsrc = FindResourceExW( kernel32_handle, (LPWSTR)RT_STRING,
|
||||||
ULongToPtr((lctype >> 4) + 1), lang_id )))
|
ULongToPtr((lctype >> 4) + 1), lang_id )))
|
||||||
|
@ -2776,7 +2788,7 @@ LCID WINAPI ConvertDefaultLocale( LCID lcid )
|
||||||
langid = LANGIDFROMLCID(lcid);
|
langid = LANGIDFROMLCID(lcid);
|
||||||
if (SUBLANGID(langid) == SUBLANG_NEUTRAL)
|
if (SUBLANGID(langid) == SUBLANG_NEUTRAL)
|
||||||
{
|
{
|
||||||
langid = MAKELANGID(PRIMARYLANGID(langid), SUBLANG_DEFAULT);
|
langid = MAKELANGID(PRIMARYLANGID(langid), get_default_sublang( langid ));
|
||||||
lcid = MAKELCID(langid, SORTIDFROMLCID(lcid));
|
lcid = MAKELCID(langid, SORTIDFROMLCID(lcid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4212,7 +4224,7 @@ static BOOL NLS_GetLanguageGroupName(LGRPID lgrpid, LPWSTR szName, ULONG nameSiz
|
||||||
langId = GetSystemDefaultLangID();
|
langId = GetSystemDefaultLangID();
|
||||||
|
|
||||||
if (SUBLANGID(langId) == SUBLANG_NEUTRAL)
|
if (SUBLANGID(langId) == SUBLANG_NEUTRAL)
|
||||||
langId = MAKELANGID( PRIMARYLANGID(langId), SUBLANG_DEFAULT );
|
langId = MAKELANGID(PRIMARYLANGID(langId), get_default_sublang( langId ));
|
||||||
|
|
||||||
hResource = FindResourceExW( kernel32_handle, (LPWSTR)RT_STRING, szResourceName, langId );
|
hResource = FindResourceExW( kernel32_handle, (LPWSTR)RT_STRING, szResourceName, langId );
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN
|
||||||
LOCALE_SMONTHNAME12 "diciembre"
|
LOCALE_SMONTHNAME12 "diciembre"
|
||||||
LOCALE_SMONTHNAME13 ""
|
LOCALE_SMONTHNAME13 ""
|
||||||
LOCALE_SMONTHOUSANDSEP "."
|
LOCALE_SMONTHOUSANDSEP "."
|
||||||
LOCALE_SNAME "es-ES_modern"
|
LOCALE_SNAME "es-ES"
|
||||||
LOCALE_SNATIVECTRYNAME "España"
|
LOCALE_SNATIVECTRYNAME "España"
|
||||||
LOCALE_SNATIVECURRNAME "euro"
|
LOCALE_SNATIVECURRNAME "euro"
|
||||||
LOCALE_SNATIVEDIGITS "0123456789"
|
LOCALE_SNATIVEDIGITS "0123456789"
|
||||||
|
|
|
@ -123,7 +123,7 @@ STRINGTABLE LANGUAGE LANG_SPANISH, SUBLANG_SPANISH
|
||||||
LOCALE_SMONTHNAME12 "diciembre"
|
LOCALE_SMONTHNAME12 "diciembre"
|
||||||
LOCALE_SMONTHNAME13 ""
|
LOCALE_SMONTHNAME13 ""
|
||||||
LOCALE_SMONTHOUSANDSEP "."
|
LOCALE_SMONTHOUSANDSEP "."
|
||||||
LOCALE_SNAME "es-ES"
|
LOCALE_SNAME "es-ES_tradnl"
|
||||||
LOCALE_SNATIVECTRYNAME "España"
|
LOCALE_SNATIVECTRYNAME "España"
|
||||||
LOCALE_SNATIVECURRNAME "euro"
|
LOCALE_SNATIVECURRNAME "euro"
|
||||||
LOCALE_SNATIVEDIGITS "0123456789"
|
LOCALE_SNATIVEDIGITS "0123456789"
|
||||||
|
|
|
@ -255,7 +255,7 @@ static const struct neutralsublang_name2_t neutralsublang_names2[] = {
|
||||||
{ {'e','s',0}, {'e','s','-','E','S',0},
|
{ {'e','s',0}, {'e','s','-','E','S',0},
|
||||||
MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), SORT_DEFAULT),
|
MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), SORT_DEFAULT),
|
||||||
MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH), SORT_DEFAULT) /* vista */,
|
MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH), SORT_DEFAULT) /* vista */,
|
||||||
{'e','s','-','E','S','_','t','r','a','d','n','l',0}, 0x1 },
|
{'e','s','-','E','S','_','t','r','a','d','n','l',0} },
|
||||||
{ {'g','a',0}, {'g','a','-','I','E',0},
|
{ {'g','a',0}, {'g','a','-','I','E',0},
|
||||||
MAKELCID(MAKELANGID(LANG_IRISH, SUBLANG_IRISH_IRELAND), SORT_DEFAULT), 0, {0}, 0x3 },
|
MAKELCID(MAKELANGID(LANG_IRISH, SUBLANG_IRISH_IRELAND), SORT_DEFAULT), 0, {0}, 0x3 },
|
||||||
{ {'i','t',0}, {'i','t','-','I','T',0},
|
{ {'i','t',0}, {'i','t','-','I','T',0},
|
||||||
|
@ -273,7 +273,7 @@ static const struct neutralsublang_name2_t neutralsublang_names2[] = {
|
||||||
{ {'u','z',0}, {'u','z','-','L','a','t','n','-','U','Z',0},
|
{ {'u','z',0}, {'u','z','-','L','a','t','n','-','U','Z',0},
|
||||||
MAKELCID(MAKELANGID(LANG_UZBEK, SUBLANG_UZBEK_LATIN), SORT_DEFAULT) },
|
MAKELCID(MAKELANGID(LANG_UZBEK, SUBLANG_UZBEK_LATIN), SORT_DEFAULT) },
|
||||||
{ {'z','h',0}, {'z','h','-','C','N',0},
|
{ {'z','h',0}, {'z','h','-','C','N',0},
|
||||||
MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT), 0, {0}, 0x3 },
|
MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT) },
|
||||||
{ {0} }
|
{ {0} }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2684,7 +2684,7 @@ static const struct neutralsublang_name_t neutralsublang_names[] = {
|
||||||
{ {'a','z',0}, MAKELCID(MAKELANGID(LANG_AZERI, SUBLANG_AZERI_LATIN), SORT_DEFAULT) },
|
{ {'a','z',0}, MAKELCID(MAKELANGID(LANG_AZERI, SUBLANG_AZERI_LATIN), SORT_DEFAULT) },
|
||||||
{ {'d','e',0}, MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) },
|
{ {'d','e',0}, MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) },
|
||||||
{ {'e','n',0}, MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) },
|
{ {'e','n',0}, MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) },
|
||||||
{ {'e','s',0}, MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), SORT_DEFAULT), 1 },
|
{ {'e','s',0}, MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), SORT_DEFAULT) },
|
||||||
{ {'g','a',0}, MAKELCID(MAKELANGID(LANG_IRISH, SUBLANG_IRISH_IRELAND), SORT_DEFAULT) },
|
{ {'g','a',0}, MAKELCID(MAKELANGID(LANG_IRISH, SUBLANG_IRISH_IRELAND), SORT_DEFAULT) },
|
||||||
{ {'i','t',0}, MAKELCID(MAKELANGID(LANG_ITALIAN, SUBLANG_ITALIAN), SORT_DEFAULT) },
|
{ {'i','t',0}, MAKELCID(MAKELANGID(LANG_ITALIAN, SUBLANG_ITALIAN), SORT_DEFAULT) },
|
||||||
{ {'m','s',0}, MAKELCID(MAKELANGID(LANG_MALAY, SUBLANG_MALAY_MALAYSIA), SORT_DEFAULT) },
|
{ {'m','s',0}, MAKELCID(MAKELANGID(LANG_MALAY, SUBLANG_MALAY_MALAYSIA), SORT_DEFAULT) },
|
||||||
|
@ -2693,7 +2693,7 @@ static const struct neutralsublang_name_t neutralsublang_names[] = {
|
||||||
{ {'s','r',0}, MAKELCID(MAKELANGID(LANG_SERBIAN, SUBLANG_SERBIAN_SERBIA_LATIN), SORT_DEFAULT), 1 },
|
{ {'s','r',0}, MAKELCID(MAKELANGID(LANG_SERBIAN, SUBLANG_SERBIAN_SERBIA_LATIN), SORT_DEFAULT), 1 },
|
||||||
{ {'s','v',0}, MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) },
|
{ {'s','v',0}, MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) },
|
||||||
{ {'u','z',0}, MAKELCID(MAKELANGID(LANG_UZBEK, SUBLANG_UZBEK_LATIN), SORT_DEFAULT) },
|
{ {'u','z',0}, MAKELCID(MAKELANGID(LANG_UZBEK, SUBLANG_UZBEK_LATIN), SORT_DEFAULT) },
|
||||||
{ {'z','h',0}, MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT), 1 },
|
{ {'z','h',0}, MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT) },
|
||||||
{ {0} }
|
{ {0} }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -453,11 +453,10 @@ static void test____lc_locale_name_func(void)
|
||||||
const char *locale;
|
const char *locale;
|
||||||
const WCHAR name[10];
|
const WCHAR name[10];
|
||||||
const WCHAR broken_name[10];
|
const WCHAR broken_name[10];
|
||||||
BOOL todo;
|
|
||||||
} tests[] = {
|
} tests[] = {
|
||||||
{ "American", {'e','n',0}, {'e','n','-','U','S',0} },
|
{ "American", {'e','n',0}, {'e','n','-','U','S',0} },
|
||||||
{ "Belgian", {'n','l','-','B','E',0} },
|
{ "Belgian", {'n','l','-','B','E',0} },
|
||||||
{ "Chinese", {'z','h',0}, {'z','h','-','C','N',0}, TRUE },
|
{ "Chinese", {'z','h',0}, {'z','h','-','C','N',0} },
|
||||||
{ "Dutch", {'n','l',0}, {'n','l','-','N','L',0} },
|
{ "Dutch", {'n','l',0}, {'n','l','-','N','L',0} },
|
||||||
{ "English", {'e','n',0}, {'e','n','-','U','S',0} },
|
{ "English", {'e','n',0}, {'e','n','-','U','S',0} },
|
||||||
{ "French", {'f','r',0}, {'f','r','-','F','R',0} },
|
{ "French", {'f','r',0}, {'f','r','-','F','R',0} },
|
||||||
|
@ -476,7 +475,6 @@ static void test____lc_locale_name_func(void)
|
||||||
|
|
||||||
lc_names = p____lc_locale_name_func();
|
lc_names = p____lc_locale_name_func();
|
||||||
ok(lc_names[0] == NULL, "%d - lc_names[0] = %s\n", i, wine_dbgstr_w(lc_names[0]));
|
ok(lc_names[0] == NULL, "%d - lc_names[0] = %s\n", i, wine_dbgstr_w(lc_names[0]));
|
||||||
todo_wine_if(tests[i].todo)
|
|
||||||
ok(!lstrcmpW(lc_names[1], tests[i].name) || broken(!lstrcmpW(lc_names[1], tests[i].broken_name)),
|
ok(!lstrcmpW(lc_names[1], tests[i].name) || broken(!lstrcmpW(lc_names[1], tests[i].broken_name)),
|
||||||
"%d - lc_names[1] = %s\n", i, wine_dbgstr_w(lc_names[1]));
|
"%d - lc_names[1] = %s\n", i, wine_dbgstr_w(lc_names[1]));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue