Return wxLANGUAGE_UNKNOWN from GetSystemLocale() in mixed locales
After the changes of the previous commit, GetSystemLocale() started returning the language, found as due to the fallback logic implemented in FindLanguageInfo(), for mixed locales, e.g. it would return English for en_FR which is wrong as the actual locale is rather the French one, using decimal comma and not period in this case. Make it always return wxLANGUAGE_UNKNOWN for the mixed locales for now.
This commit is contained in:
parent
c13b3645a8
commit
9f2a416f81
1 changed files with 14 additions and 2 deletions
|
|
@ -679,10 +679,22 @@ int wxUILocale::GetSystemLocale()
|
|||
{
|
||||
// Create default wxUILocale
|
||||
wxUILocale defaultLocale(wxUILocaleImpl::CreateUserDefault());
|
||||
const wxLocaleIdent locId = defaultLocale.GetLocaleId();
|
||||
|
||||
// Find corresponding wxLanguageInfo
|
||||
const wxLanguageInfo* defaultLanguage = wxUILocale::FindLanguageInfo(defaultLocale.GetLocaleId());
|
||||
return defaultLanguage ? defaultLanguage->Language : wxLANGUAGE_UNKNOWN;
|
||||
const wxLanguageInfo* defaultLanguage = wxUILocale::FindLanguageInfo(locId);
|
||||
|
||||
// Check if it really corresponds to this locale: we could find it via the
|
||||
// fallback on the language, which is something that it generally makes
|
||||
// sense for FindLanguageInfo() to do, but in this case we really need the
|
||||
// locale.
|
||||
if ( defaultLanguage &&
|
||||
locId.GetTag(wxLOCALE_TAGTYPE_BCP47) == defaultLanguage->LocaleTag )
|
||||
{
|
||||
return defaultLanguage->Language;
|
||||
}
|
||||
|
||||
return wxLANGUAGE_UNKNOWN;
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue