Show the name of the chosen language on the choice button. Looks weird not to.

This commit is contained in:
Henrik Rydgård 2022-12-05 12:07:07 +01:00
parent 93e5060137
commit dd22ec6fa7
3 changed files with 13 additions and 4 deletions

View file

@ -1294,8 +1294,8 @@ void Config::LoadLangValuesMapping() {
langCodeMapping["CHINESE_TRADITIONAL"] = PSP_SYSTEMPARAM_LANGUAGE_CHINESE_TRADITIONAL;
langCodeMapping["CHINESE_SIMPLIFIED"] = PSP_SYSTEMPARAM_LANGUAGE_CHINESE_SIMPLIFIED;
Section *langRegionNames = mapping.GetOrCreateSection("LangRegionNames");
Section *systemLanguage = mapping.GetOrCreateSection("SystemLanguage");
const Section *langRegionNames = mapping.GetOrCreateSection("LangRegionNames");
const Section *systemLanguage = mapping.GetOrCreateSection("SystemLanguage");
for (size_t i = 0; i < keys.size(); i++) {
std::string langName;

View file

@ -846,7 +846,17 @@ void GameSettingsScreen::CreateViews() {
LinearLayout *systemSettings = AddTab("GameSettingsSystem", ms->T("System"));
systemSettings->Add(new ItemHeader(sy->T("UI")));
systemSettings->Add(new Choice(sy->T("Language")))->OnClick.Add([&](UI::EventParams &e) {
auto langCodeToName = [](const char *value) -> std::string {
auto &mapping = g_Config.GetLangValuesMapping();
auto iter = mapping.find(value);
if (iter != mapping.end()) {
return iter->second.first;
}
return value;
};
systemSettings->Add(new ChoiceWithValueDisplay(&g_Config.sLanguageIni, sy->T("Language"), langCodeToName))->OnClick.Add([&](UI::EventParams &e) {
auto sy = GetI18NCategory("System");
auto langScreen = new NewLanguageScreen(sy->T("Language"));
langScreen->OnChoice.Add([&](UI::EventParams &e) {

View file

@ -106,7 +106,6 @@ public:
private:
void OnCompleted(DialogResult result) override;
bool ShowButtons() const override { return true; }
std::map<std::string, std::string> titleCodeMapping;
std::vector<File::FileInfo> langs_;
};