diff --git a/Core/Config.cpp b/Core/Config.cpp index 92a4bf66bf..4c5d8533c5 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -77,12 +77,19 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) { if (!File::Exists(currentDirectory)) currentDirectory = ""; + int DefaultLang = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH; std::string defaultLangRegion = "en_US"; if (bFirstRun) { std::string langRegion = System_GetProperty(SYSPROP_LANGREGION); if (i18nrepo.IniExists(langRegion)) defaultLangRegion = langRegion; // TODO: Be smart about same language, different country + langValuesMapping = GetLangValuesMapping(); + if (!defaultLangRegion.empty()) { + if (langValuesMapping.find(defaultLangRegion) != langValuesMapping.end()) { + DefaultLang = langValuesMapping[defaultLangRegion].second; + } + } } general->Get("Language", &sLanguageIni, defaultLangRegion.c_str()); @@ -342,7 +349,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) { pspConfig->Get("NickName", &sNickName, "PPSSPP"); pspConfig->Get("proAdhocServer", &proAdhocServer, "localhost"); pspConfig->Get("MacAddress", &localMacAddress, "01:02:03:04:05:06"); - pspConfig->Get("Language", &iLanguage, PSP_SYSTEMPARAM_LANGUAGE_ENGLISH); + pspConfig->Get("Language", &iLanguage, DefaultLang); pspConfig->Get("TimeFormat", &iTimeFormat, PSP_SYSTEMPARAM_TIME_FORMAT_24HR); pspConfig->Get("DateFormat", &iDateFormat, PSP_SYSTEMPARAM_DATE_FORMAT_YYYYMMDD); pspConfig->Get("TimeZone", &iTimeZone, 0); diff --git a/Core/Config.h b/Core/Config.h index 8483681eaf..1009e042e6 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -18,6 +18,7 @@ #pragma once #include +#include #include #include "CommonTypes.h" @@ -306,6 +307,7 @@ private: std::string controllerIniFilename_; std::vector searchPath_; std::string defaultPath_; + std::map> langValuesMapping; }; // TODO: Find a better place for this.