Support creating Unix wxUILocale for languages without region
Unlike MSW and macOS, creating wxUILocale for e.g. "en" doesn't necessarily succeed under Linux even if "en_US" is available, so try to find a working language+region combination if just language doesn't work. This requires access to the languages database, so add a private wxGetLanguageInfos() to avoid having to depend on wxLocale just for this.
This commit is contained in:
@@ -51,7 +51,8 @@
|
||||
#include "wx/stdpaths.h"
|
||||
#include "wx/hashset.h"
|
||||
#include "wx/uilocale.h"
|
||||
#include "wx/vector.h"
|
||||
|
||||
#include "wx/private/uilocale.h"
|
||||
|
||||
#ifdef __WIN32__
|
||||
#include "wx/msw/private/uilocale.h"
|
||||
@@ -193,9 +194,16 @@ wxString wxLanguageInfo::GetLocaleName() const
|
||||
// wxLocale
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static wxVector<wxLanguageInfo> gs_languagesDB;
|
||||
static wxLanguageInfos gs_languagesDB;
|
||||
static bool gs_languagesDBInitialized = false;
|
||||
|
||||
const wxLanguageInfos& wxGetLanguageInfos()
|
||||
{
|
||||
wxLocale::CreateLanguagesDB();
|
||||
|
||||
return gs_languagesDB;
|
||||
}
|
||||
|
||||
/*static*/ void wxLocale::CreateLanguagesDB()
|
||||
{
|
||||
if (!gs_languagesDBInitialized)
|
||||
|
||||
Reference in New Issue
Block a user