diff options
| author | JosJuice <josjuice@gmail.com> | 2016-08-12 14:01:09 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2016-08-12 14:52:01 +0200 |
| commit | ed9007cab7d46e8fb271cfb5536c1936097dbf6c (patch) | |
| tree | 116b3dbca9ec1bf427a3fd4639f9f8e95aef12bb /Source/Core/DolphinWX/Main.cpp | |
| parent | cef71afc2758702ed9bc03daac27b7e811ca9a50 (diff) | |
Save GUI language as string instead of wxLanguage enum
When 5.0-211 updated wxWidgets to 3.1.0, some entries in the
wxLanguage enum were moved and added, changing the wxLanguage
values. Because we save Dolphin's interface language to disk
as a wxLanguage, the language you have set will mean something
different depending on whether you have the updated wx version
or not. For instance, setting the language to English with the
updated version and then using an older version will make
Dolphin use Dutch. Because we can't rely on the enum anymore,
I'm replacing the "Language" setting with a "LanguageCode"
setting that uses standard ISO 639 codes.
Diffstat (limited to 'Source/Core/DolphinWX/Main.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/Main.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/Source/Core/DolphinWX/Main.cpp b/Source/Core/DolphinWX/Main.cpp index 20460e258c..12938544d6 100644 --- a/Source/Core/DolphinWX/Main.cpp +++ b/Source/Core/DolphinWX/Main.cpp @@ -295,11 +295,23 @@ void DolphinApp::AfterInit() void DolphinApp::InitLanguageSupport() { - unsigned int language = 0; - - IniFile ini; - ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); - ini.GetOrCreateSection("Interface")->Get("Language", &language, wxLANGUAGE_DEFAULT); + std::string language_code; + { + IniFile ini; + ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); + ini.GetOrCreateSection("Interface")->Get("LanguageCode", &language_code, ""); + } + int language = wxLANGUAGE_UNKNOWN; + if (language_code.empty()) + { + language = wxLANGUAGE_DEFAULT; + } + else + { + const wxLanguageInfo* language_info = wxLocale::FindLanguageInfo(StrToWxStr(language_code)); + if (language_info) + language = language_info->Language; + } // Load language if possible, fall back to system default otherwise if (wxLocale::IsAvailable(language)) |
