From b31b76c53698be765f5a01579f0c826f0347e038 Mon Sep 17 00:00:00 2001 From: vnctdj Date: Thu, 17 Aug 2017 22:47:46 +0200 Subject: [PATCH] Make control mapping pop-up title translatable --- UI/ControlMappingScreen.cpp | 12 ++++++++---- UI/ControlMappingScreen.h | 9 +++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index 8a0d4583c1..690b29e20e 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -182,25 +182,29 @@ void ControlMapper::MappedCallback(KeyDef kdf) { UI::EventReturn ControlMapper::OnReplace(UI::EventParams ¶ms) { actionIndex_ = atoi(params.v->Tag().c_str()); action_ = REPLACEONE; - scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, std::bind(&ControlMapper::MappedCallback, this, std::placeholders::_1))); + I18NCategory *km = GetI18NCategory("KeyMapping"); + scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, std::bind(&ControlMapper::MappedCallback, this, std::placeholders::_1), km)); return UI::EVENT_DONE; } UI::EventReturn ControlMapper::OnReplaceAll(UI::EventParams ¶ms) { action_ = REPLACEALL; - scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, std::bind(&ControlMapper::MappedCallback, this, std::placeholders::_1))); + I18NCategory *km = GetI18NCategory("KeyMapping"); + scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, std::bind(&ControlMapper::MappedCallback, this, std::placeholders::_1), km)); return UI::EVENT_DONE; } UI::EventReturn ControlMapper::OnAdd(UI::EventParams ¶ms) { action_ = ADD; - scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, std::bind(&ControlMapper::MappedCallback, this, std::placeholders::_1))); + I18NCategory *km = GetI18NCategory("KeyMapping"); + scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, std::bind(&ControlMapper::MappedCallback, this, std::placeholders::_1), km)); return UI::EVENT_DONE; } UI::EventReturn ControlMapper::OnAddMouse(UI::EventParams ¶ms) { action_ = ADD; g_Config.bMapMouse = true; - scrm_->push(new KeyMappingNewMouseKeyDialog(pspKey_, true, std::bind(&ControlMapper::MappedCallback, this, std::placeholders::_1))); + I18NCategory *km = GetI18NCategory("KeyMapping"); + scrm_->push(new KeyMappingNewMouseKeyDialog(pspKey_, true, std::bind(&ControlMapper::MappedCallback, this, std::placeholders::_1), km)); return UI::EVENT_DONE; } diff --git a/UI/ControlMappingScreen.h b/UI/ControlMappingScreen.h index 9456ff925e..b7850b3510 100644 --- a/UI/ControlMappingScreen.h +++ b/UI/ControlMappingScreen.h @@ -21,6 +21,7 @@ #include #include +#include "i18n/i18n.h" #include "ui/view.h" #include "ui/ui_screen.h" @@ -49,8 +50,8 @@ private: class KeyMappingNewKeyDialog : public PopupScreen { public: - explicit KeyMappingNewKeyDialog(int btn, bool replace, std::function callback) - : PopupScreen("Map Key", "Cancel", ""), callback_(callback), mapped_(false) { + explicit KeyMappingNewKeyDialog(int btn, bool replace, std::function callback, I18NCategory *i18n) + : PopupScreen(i18n->T("Map Key"), "Cancel", ""), callback_(callback), mapped_(false) { pspBtn_ = btn; } @@ -72,8 +73,8 @@ private: class KeyMappingNewMouseKeyDialog : public PopupScreen { public: - explicit KeyMappingNewMouseKeyDialog(int btn, bool replace, std::function callback) - : PopupScreen("Map Mouse", "", ""), callback_(callback), mapped_(false) { + explicit KeyMappingNewMouseKeyDialog(int btn, bool replace, std::function callback, I18NCategory *i18n) + : PopupScreen(i18n->T("Map Mouse"), "", ""), callback_(callback), mapped_(false) { pspBtn_ = btn; }