Fix Cannot set locale to "" (#366)

* Add en resource and change language selection for macos user that don't have US as their system region
* default to English if the system language is unavailable
This commit is contained in:
Tillsunset 2022-10-15 00:20:20 -05:00 committed by GitHub
parent ada8bbb3b4
commit df0e2f7881
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 9 deletions

BIN
bin/resources/en/cemu.mo Normal file

Binary file not shown.

View File

@ -115,8 +115,6 @@ bool CemuApp::OnInit()
m_languages = GetAvailableLanguages();
const sint32 language = GetConfig().language;
if (language != wxLANGUAGE_ENGLISH)
{
const auto it = std::find_if(m_languages.begin(), m_languages.end(), [language](const wxLanguageInfo* info) { return info->Language == language; });
if (it != m_languages.end() && wxLocale::IsAvailable(language))
{
@ -126,11 +124,15 @@ bool CemuApp::OnInit()
m_locale.AddCatalog("cemu");
}
}
}
if (!m_locale.IsOk())
{
m_locale.Init(wxLANGUAGE_DEFAULT);
if (!wxLocale::IsAvailable(wxLANGUAGE_DEFAULT) || !m_locale.Init(wxLANGUAGE_DEFAULT))
{
m_locale.Init(wxLANGUAGE_ENGLISH);
m_locale.AddCatalogLookupPathPrefix(ActiveSettings::GetDataPath("resources").generic_string());
m_locale.AddCatalog("cemu");
}
}
// fill colour db