From 3f13dbe0878523b65d158efddc3eff37d59ca3a2 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 30 Mar 2018 21:42:26 +0200 Subject: Translate certain button names but not all Some button names should be translated, for instance Up, Left and such. At the same time, some other button names shouldn't be translated, for reasons that might be less obvious. In 0146456af, I removed the _trans markers for button names that never need to be translated (such as A and B), but that isn't actually enough to ensure that DolphinWX won't try to translate them anyway. This commit adds a bool that explicitly tells the GUI whether a button name should be translated. Otherwise we'll have problems like the GUI treating the button name "B" (which isn't supposed to be translated) as matching the translatable string "B" (being an abbreviation of "bytes"), meaning that the button "B" will be labeled "o" when running Dolphin in French (after translations get pulled from Transifex the next time). By the way, while it turned out that DolphinWX translated all button names, it also turned out that DolphinQt2 translated *no* button names. Go figure. This commit makes them consistent with each other. --- Source/Core/InputCommon/ControllerEmu/Control/Control.cpp | 8 ++++---- Source/Core/InputCommon/ControllerEmu/Control/Control.h | 5 +++-- Source/Core/InputCommon/ControllerEmu/Control/Input.cpp | 7 ++++--- Source/Core/InputCommon/ControllerEmu/Control/Input.h | 4 ++-- Source/Core/InputCommon/ControllerEmu/Control/Output.cpp | 3 ++- Source/Core/InputCommon/ControllerEmu/Control/Output.h | 2 +- 6 files changed, 16 insertions(+), 13 deletions(-) (limited to 'Source/Core/InputCommon/ControllerEmu/Control') diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp b/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp index 3f5d00d822..7ea3ec27d5 100644 --- a/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp +++ b/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp @@ -9,14 +9,14 @@ namespace ControllerEmu { -Control::Control(std::unique_ptr ref, const std::string& name_, +Control::Control(std::unique_ptr ref, bool translate_, const std::string& name_, const std::string& ui_name_) - : control_ref(std::move(ref)), name(name_), ui_name(ui_name_) + : control_ref(std::move(ref)), translate(translate_), name(name_), ui_name(ui_name_) { } -Control::Control(std::unique_ptr ref, const std::string& name_) - : Control(std::move(ref), name_, name_) +Control::Control(std::unique_ptr ref, bool translate_, const std::string& name_) + : Control(std::move(ref), translate_, name_, name_) { } diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Control.h b/Source/Core/InputCommon/ControllerEmu/Control/Control.h index b34c843c5d..f5c2e394ea 100644 --- a/Source/Core/InputCommon/ControllerEmu/Control/Control.h +++ b/Source/Core/InputCommon/ControllerEmu/Control/Control.h @@ -17,12 +17,13 @@ public: virtual ~Control(); std::unique_ptr const control_ref; + const bool translate; const std::string name; const std::string ui_name; protected: - Control(std::unique_ptr ref, const std::string& name, + Control(std::unique_ptr ref, bool translate, const std::string& name, const std::string& ui_name); - Control(std::unique_ptr ref, const std::string& name); + Control(std::unique_ptr ref, bool translate, const std::string& name); }; } // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Input.cpp b/Source/Core/InputCommon/ControllerEmu/Control/Input.cpp index a213916a83..ca872b5cbd 100644 --- a/Source/Core/InputCommon/ControllerEmu/Control/Input.cpp +++ b/Source/Core/InputCommon/ControllerEmu/Control/Input.cpp @@ -10,12 +10,13 @@ namespace ControllerEmu { -Input::Input(const std::string& name_, const std::string& ui_name_) - : Control(std::make_unique(), name_, ui_name_) +Input::Input(bool translate_, const std::string& name_, const std::string& ui_name_) + : Control(std::make_unique(), translate_, name_, ui_name_) { } -Input::Input(const std::string& name_) : Control(std::make_unique(), name_) +Input::Input(bool translate_, const std::string& name_) + : Control(std::make_unique(), translate_, name_) { } } // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Input.h b/Source/Core/InputCommon/ControllerEmu/Control/Input.h index dad90ed12e..1782249026 100644 --- a/Source/Core/InputCommon/ControllerEmu/Control/Input.h +++ b/Source/Core/InputCommon/ControllerEmu/Control/Input.h @@ -12,7 +12,7 @@ namespace ControllerEmu class Input : public Control { public: - Input(const std::string& name, const std::string& ui_name); - explicit Input(const std::string& name); + Input(bool translate, const std::string& name, const std::string& ui_name); + Input(bool translate, const std::string& name); }; } // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Output.cpp b/Source/Core/InputCommon/ControllerEmu/Control/Output.cpp index a031893410..9089b15b7f 100644 --- a/Source/Core/InputCommon/ControllerEmu/Control/Output.cpp +++ b/Source/Core/InputCommon/ControllerEmu/Control/Output.cpp @@ -10,7 +10,8 @@ namespace ControllerEmu { -Output::Output(const std::string& name_) : Control(std::make_unique(), name_) +Output::Output(bool translate, const std::string& name_) + : Control(std::make_unique(), translate, name_) { } } // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Output.h b/Source/Core/InputCommon/ControllerEmu/Control/Output.h index 415c67f7d9..74aa85e165 100644 --- a/Source/Core/InputCommon/ControllerEmu/Control/Output.h +++ b/Source/Core/InputCommon/ControllerEmu/Control/Output.h @@ -12,6 +12,6 @@ namespace ControllerEmu class Output : public Control { public: - explicit Output(const std::string& name); + Output(bool translate, const std::string& name); }; } // namespace ControllerEmu -- cgit v1.2.3 From 7ed28297b237779f0e4b6d7045cd27e10a8cfb0e Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 10 Apr 2018 17:22:30 +0200 Subject: ControllerEmu: Use enum instead of bool for translatability --- Source/Core/InputCommon/ControllerEmu/Control/Control.cpp | 7 ++++--- Source/Core/InputCommon/ControllerEmu/Control/Control.h | 13 ++++++++++--- Source/Core/InputCommon/ControllerEmu/Control/Input.cpp | 4 ++-- Source/Core/InputCommon/ControllerEmu/Control/Input.h | 4 ++-- Source/Core/InputCommon/ControllerEmu/Control/Output.cpp | 4 ++-- Source/Core/InputCommon/ControllerEmu/Control/Output.h | 2 +- 6 files changed, 21 insertions(+), 13 deletions(-) (limited to 'Source/Core/InputCommon/ControllerEmu/Control') diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp b/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp index 7ea3ec27d5..20ae3a3cda 100644 --- a/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp +++ b/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp @@ -9,13 +9,14 @@ namespace ControllerEmu { -Control::Control(std::unique_ptr ref, bool translate_, const std::string& name_, - const std::string& ui_name_) +Control::Control(std::unique_ptr ref, Translatability translate_, + const std::string& name_, const std::string& ui_name_) : control_ref(std::move(ref)), translate(translate_), name(name_), ui_name(ui_name_) { } -Control::Control(std::unique_ptr ref, bool translate_, const std::string& name_) +Control::Control(std::unique_ptr ref, Translatability translate_, + const std::string& name_) : Control(std::move(ref), translate_, name_, name_) { } diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Control.h b/Source/Core/InputCommon/ControllerEmu/Control/Control.h index f5c2e394ea..e005431873 100644 --- a/Source/Core/InputCommon/ControllerEmu/Control/Control.h +++ b/Source/Core/InputCommon/ControllerEmu/Control/Control.h @@ -11,19 +11,26 @@ class ControlReference; namespace ControllerEmu { +enum Translatability +{ + DoNotTranslate, + Translate +}; + class Control { public: virtual ~Control(); std::unique_ptr const control_ref; - const bool translate; + const Translatability translate; const std::string name; const std::string ui_name; protected: - Control(std::unique_ptr ref, bool translate, const std::string& name, + Control(std::unique_ptr ref, Translatability translate, const std::string& name, const std::string& ui_name); - Control(std::unique_ptr ref, bool translate, const std::string& name); + Control(std::unique_ptr ref, Translatability translate, + const std::string& name); }; } // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Input.cpp b/Source/Core/InputCommon/ControllerEmu/Control/Input.cpp index ca872b5cbd..69f817705e 100644 --- a/Source/Core/InputCommon/ControllerEmu/Control/Input.cpp +++ b/Source/Core/InputCommon/ControllerEmu/Control/Input.cpp @@ -10,12 +10,12 @@ namespace ControllerEmu { -Input::Input(bool translate_, const std::string& name_, const std::string& ui_name_) +Input::Input(Translatability translate_, const std::string& name_, const std::string& ui_name_) : Control(std::make_unique(), translate_, name_, ui_name_) { } -Input::Input(bool translate_, const std::string& name_) +Input::Input(Translatability translate_, const std::string& name_) : Control(std::make_unique(), translate_, name_) { } diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Input.h b/Source/Core/InputCommon/ControllerEmu/Control/Input.h index 1782249026..3fd301ae65 100644 --- a/Source/Core/InputCommon/ControllerEmu/Control/Input.h +++ b/Source/Core/InputCommon/ControllerEmu/Control/Input.h @@ -12,7 +12,7 @@ namespace ControllerEmu class Input : public Control { public: - Input(bool translate, const std::string& name, const std::string& ui_name); - Input(bool translate, const std::string& name); + Input(Translatability translate, const std::string& name, const std::string& ui_name); + Input(Translatability translate, const std::string& name); }; } // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Output.cpp b/Source/Core/InputCommon/ControllerEmu/Control/Output.cpp index 9089b15b7f..568035d106 100644 --- a/Source/Core/InputCommon/ControllerEmu/Control/Output.cpp +++ b/Source/Core/InputCommon/ControllerEmu/Control/Output.cpp @@ -10,8 +10,8 @@ namespace ControllerEmu { -Output::Output(bool translate, const std::string& name_) - : Control(std::make_unique(), translate, name_) +Output::Output(Translatability translate_, const std::string& name_) + : Control(std::make_unique(), translate_, name_) { } } // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Output.h b/Source/Core/InputCommon/ControllerEmu/Control/Output.h index 74aa85e165..7970c26ad0 100644 --- a/Source/Core/InputCommon/ControllerEmu/Control/Output.h +++ b/Source/Core/InputCommon/ControllerEmu/Control/Output.h @@ -12,6 +12,6 @@ namespace ControllerEmu class Output : public Control { public: - Output(bool translate, const std::string& name); + Output(Translatability translate, const std::string& name); }; } // namespace ControllerEmu -- cgit v1.2.3