kernelbase: Reimplement ConvertDefaultLocale() using the locale.nls data.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-03-24 16:51:11 +01:00
parent 0263494bec
commit 17c353a3bb
1 changed files with 1 additions and 38 deletions

View File

@ -3318,44 +3318,7 @@ INT WINAPI DECLSPEC_HOTPATCH CompareStringOrdinal( const WCHAR *str1, INT len1,
*/
LCID WINAPI DECLSPEC_HOTPATCH ConvertDefaultLocale( LCID lcid )
{
switch (lcid)
{
case LOCALE_INVARIANT:
return lcid; /* keep as-is */
case LOCALE_SYSTEM_DEFAULT:
return GetSystemDefaultLCID();
case LOCALE_USER_DEFAULT:
case LOCALE_NEUTRAL:
return GetUserDefaultLCID();
case MAKELANGID( LANG_CHINESE, SUBLANG_NEUTRAL ):
case MAKELANGID( LANG_CHINESE, 0x1e ):
return MAKELANGID( LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED );
case MAKELANGID( LANG_CHINESE, 0x1f ):
return MAKELANGID( LANG_CHINESE, SUBLANG_CHINESE_HONGKONG );
case LANG_SERBIAN_NEUTRAL:
return MAKELANGID( LANG_SERBIAN, SUBLANG_SERBIAN_SERBIA_LATIN );
case MAKELANGID( LANG_SPANISH, SUBLANG_NEUTRAL ):
return MAKELANGID( LANG_SPANISH, SUBLANG_SPANISH_MODERN );
case MAKELANGID( LANG_IRISH, SUBLANG_NEUTRAL ):
return MAKELANGID( LANG_IRISH, SUBLANG_IRISH_IRELAND );
case MAKELANGID( LANG_BENGALI, SUBLANG_NEUTRAL ):
return MAKELANGID( LANG_BENGALI, SUBLANG_BENGALI_BANGLADESH );
case MAKELANGID( LANG_SINDHI, SUBLANG_NEUTRAL ):
return MAKELANGID( LANG_SINDHI, SUBLANG_SINDHI_AFGHANISTAN );
case MAKELANGID( LANG_INUKTITUT, SUBLANG_NEUTRAL ):
return MAKELANGID( LANG_INUKTITUT, SUBLANG_INUKTITUT_CANADA_LATIN );
case MAKELANGID( LANG_TAMAZIGHT, SUBLANG_NEUTRAL ):
return MAKELANGID( LANG_TAMAZIGHT, SUBLANG_TAMAZIGHT_ALGERIA_LATIN );
case MAKELANGID( LANG_FULAH, SUBLANG_NEUTRAL ):
return MAKELANGID( LANG_FULAH, SUBLANG_FULAH_SENEGAL );
case MAKELANGID( LANG_TIGRINYA, SUBLANG_NEUTRAL ):
return MAKELANGID( LANG_TIGRINYA, SUBLANG_TIGRINYA_ERITREA );
default:
/* Replace SUBLANG_NEUTRAL with SUBLANG_DEFAULT */
if (SUBLANGID(lcid) == SUBLANG_NEUTRAL && SORTIDFROMLCID(lcid) == SORT_DEFAULT)
lcid = MAKELANGID( PRIMARYLANGID(lcid), SUBLANG_DEFAULT );
break;
}
get_locale_by_id( &lcid, 0 );
return lcid;
}