Improve wxLocale backwards compatibility and enhance wxUILocale

Restore the old behaviour of wxLocale, which is supposed to use the
default locale and not the preferred language, which may not be the same
(see #22281).

Also apply the following fixes and improvements to wxUILocale:

- Add new GetSystemLocale() method.
- Change the MSW implementation to use the default locale instead of the
  preferred UI language for Windows versions below Windows 10.
- Change the Unix implementation to respect LANGUAGE environment
  variable and use it for determining the preferred UI languages.
- Use wxUILocale in wxTranslations to determine the preferred UI
  languages.
- Use wxUILocale during initialization of internat sample.

Closes #22281.

Closes #22318.
This commit is contained in:
utelle
2022-04-16 13:52:20 +02:00
committed by Vadim Zeitlin
parent 4a3098aebb
commit 8ab635b451
8 changed files with 171 additions and 187 deletions

View File

@@ -207,10 +207,10 @@ bool MyApp::OnInit()
// it unconditionally for localized programs -- or never do it at all for
// the other ones.
const wxLanguageInfo* const
langInfo = wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT);
langInfo = wxUILocale::GetLanguageInfo(wxLANGUAGE_DEFAULT);
const wxString
langDesc = langInfo ? langInfo->Description
: wxString("the default system locale");
: wxString("the default system language");
if ( m_setLocale == Locale_Ask )
{