mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
DolphinWX: Loose language matching in interface config
This commit is contained in:
@ -2,6 +2,8 @@
|
|||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
@ -12,6 +14,7 @@
|
|||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
#include <wx/stattext.h>
|
#include <wx/stattext.h>
|
||||||
|
|
||||||
|
#include "Common/CommonFuncs.h"
|
||||||
#include "Common/CommonPaths.h"
|
#include "Common/CommonPaths.h"
|
||||||
#include "Common/FileSearch.h"
|
#include "Common/FileSearch.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
@ -27,7 +30,7 @@
|
|||||||
#include "DolphinWX/X11Utils.h"
|
#include "DolphinWX/X11Utils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const std::string language_ids[] = {
|
static const std::array<std::string, 29> language_ids = {
|
||||||
"",
|
"",
|
||||||
|
|
||||||
"ms", "ca", "cs", "da", "de", "en", "es", "fr", "hr", "it", "hu", "nl",
|
"ms", "ca", "cs", "da", "de", "en", "es", "fr", "hr", "it", "hu", "nl",
|
||||||
@ -146,14 +149,26 @@ void InterfaceConfigPane::LoadGUIValues()
|
|||||||
m_osd_messages_checkbox->SetValue(startup_params.bOnScreenDisplayMessages);
|
m_osd_messages_checkbox->SetValue(startup_params.bOnScreenDisplayMessages);
|
||||||
m_pause_focus_lost_checkbox->SetValue(SConfig::GetInstance().m_PauseOnFocusLost);
|
m_pause_focus_lost_checkbox->SetValue(SConfig::GetInstance().m_PauseOnFocusLost);
|
||||||
|
|
||||||
for (size_t i = 0; i < sizeof(language_ids) / sizeof(wxLanguage); i++)
|
const std::string exact_language = SConfig::GetInstance().m_InterfaceLanguage;
|
||||||
|
const std::string loose_language = exact_language.substr(0, exact_language.find('_'));
|
||||||
|
size_t exact_match_index = std::numeric_limits<size_t>::max();
|
||||||
|
size_t loose_match_index = std::numeric_limits<size_t>::max();
|
||||||
|
for (size_t i = 0; i < language_ids.size(); i++)
|
||||||
{
|
{
|
||||||
if (language_ids[i] == SConfig::GetInstance().m_InterfaceLanguage)
|
if (language_ids[i] == exact_language)
|
||||||
{
|
{
|
||||||
m_interface_lang_choice->SetSelection(i);
|
exact_match_index = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else if (language_ids[i] == loose_language)
|
||||||
|
{
|
||||||
|
loose_match_index = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (exact_match_index != std::numeric_limits<size_t>::max())
|
||||||
|
m_interface_lang_choice->SetSelection(exact_match_index);
|
||||||
|
else if (loose_match_index != std::numeric_limits<size_t>::max())
|
||||||
|
m_interface_lang_choice->SetSelection(loose_match_index);
|
||||||
|
|
||||||
LoadThemes();
|
LoadThemes();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user