Also set the PSP-internal Language if possible on first-run

This commit is contained in:
ufdada 2014-01-03 14:32:33 +01:00
parent b5f5d16a39
commit f4c658881a
2 changed files with 10 additions and 1 deletions

View File

@ -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);

View File

@ -18,6 +18,7 @@
#pragma once
#include <string>
#include <map>
#include <vector>
#include "CommonTypes.h"
@ -306,6 +307,7 @@ private:
std::string controllerIniFilename_;
std::vector<std::string> searchPath_;
std::string defaultPath_;
std::map<std::string, std::pair<std::string, int>> langValuesMapping;
};
// TODO: Find a better place for this.