summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon
diff options
context:
space:
mode:
authorLéo Lam <leolino.lam@gmail.com>2018-04-14 23:20:39 +0200
committerGitHub <noreply@github.com>2018-04-14 23:20:39 +0200
commitee955e37a98dc20b96c9ed948dc6af96e85fdb51 (patch)
tree2bfcd16cc0f34e14cd08d21387f7e13a9bc2f6f5 /Source/Core/InputCommon
parentaafa8a10e10e26b4068b19cdc5b1bb36dfa9fbf2 (diff)
parent7ed28297b237779f0e4b6d7045cd27e10a8cfb0e (diff)
Merge pull request #6564 from JosJuice/translate-certain-button-names
Translate certain button names but not all
Diffstat (limited to 'Source/Core/InputCommon')
-rw-r--r--Source/Core/InputCommon/ControllerEmu/Control/Control.cpp11
-rw-r--r--Source/Core/InputCommon/ControllerEmu/Control/Control.h12
-rw-r--r--Source/Core/InputCommon/ControllerEmu/Control/Input.cpp7
-rw-r--r--Source/Core/InputCommon/ControllerEmu/Control/Input.h4
-rw-r--r--Source/Core/InputCommon/ControllerEmu/Control/Output.cpp3
-rw-r--r--Source/Core/InputCommon/ControllerEmu/Control/Output.h2
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp4
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp10
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.cpp12
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp2
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.cpp4
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp10
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControllerEmu.h4
13 files changed, 49 insertions, 36 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp b/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp
index 3f5d00d822..20ae3a3cda 100644
--- a/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/Control/Control.cpp
@@ -9,14 +9,15 @@
namespace ControllerEmu
{
-Control::Control(std::unique_ptr<ControlReference> ref, const std::string& name_,
- const std::string& ui_name_)
- : control_ref(std::move(ref)), name(name_), ui_name(ui_name_)
+Control::Control(std::unique_ptr<ControlReference> 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<ControlReference> ref, const std::string& name_)
- : Control(std::move(ref), name_, name_)
+Control::Control(std::unique_ptr<ControlReference> 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 b34c843c5d..e005431873 100644
--- a/Source/Core/InputCommon/ControllerEmu/Control/Control.h
+++ b/Source/Core/InputCommon/ControllerEmu/Control/Control.h
@@ -11,18 +11,26 @@ class ControlReference;
namespace ControllerEmu
{
+enum Translatability
+{
+ DoNotTranslate,
+ Translate
+};
+
class Control
{
public:
virtual ~Control();
std::unique_ptr<ControlReference> const control_ref;
+ const Translatability translate;
const std::string name;
const std::string ui_name;
protected:
- Control(std::unique_ptr<ControlReference> ref, const std::string& name,
+ Control(std::unique_ptr<ControlReference> ref, Translatability translate, const std::string& name,
const std::string& ui_name);
- Control(std::unique_ptr<ControlReference> ref, const std::string& name);
+ Control(std::unique_ptr<ControlReference> 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 a213916a83..69f817705e 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<InputReference>(), name_, ui_name_)
+Input::Input(Translatability translate_, const std::string& name_, const std::string& ui_name_)
+ : Control(std::make_unique<InputReference>(), translate_, name_, ui_name_)
{
}
-Input::Input(const std::string& name_) : Control(std::make_unique<InputReference>(), name_)
+Input::Input(Translatability translate_, const std::string& name_)
+ : Control(std::make_unique<InputReference>(), translate_, name_)
{
}
} // namespace ControllerEmu
diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Input.h b/Source/Core/InputCommon/ControllerEmu/Control/Input.h
index dad90ed12e..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(const std::string& name, const std::string& ui_name);
- explicit Input(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 a031893410..568035d106 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<OutputReference>(), name_)
+Output::Output(Translatability translate_, const std::string& name_)
+ : Control(std::make_unique<OutputReference>(), translate_, name_)
{
}
} // namespace ControllerEmu
diff --git a/Source/Core/InputCommon/ControllerEmu/Control/Output.h b/Source/Core/InputCommon/ControllerEmu/Control/Output.h
index 415c67f7d9..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:
- explicit Output(const std::string& name);
+ Output(Translatability translate, const std::string& name);
};
} // namespace ControllerEmu
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp
index 2b7430dcbf..3317da427c 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/AnalogStick.cpp
@@ -28,9 +28,9 @@ AnalogStick::AnalogStick(const char* const name_, const char* const ui_name_,
: ControlGroup(name_, ui_name_, GroupType::Stick)
{
for (auto& named_direction : named_directions)
- controls.emplace_back(std::make_unique<Input>(named_direction));
+ controls.emplace_back(std::make_unique<Input>(Translate, named_direction));
- controls.emplace_back(std::make_unique<Input>(_trans("Modifier")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Modifier")));
numeric_settings.emplace_back(
std::make_unique<NumericSetting>(_trans("Radius"), default_radius, 0, 100));
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Dead Zone"), 0, 0, 50));
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp
index 3467205ccf..a300a249f7 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Cursor.cpp
@@ -24,12 +24,12 @@ namespace ControllerEmu
Cursor::Cursor(const std::string& name_) : ControlGroup(name_, GroupType::Cursor)
{
for (auto& named_direction : named_directions)
- controls.emplace_back(std::make_unique<Input>(named_direction));
+ controls.emplace_back(std::make_unique<Input>(Translate, named_direction));
- controls.emplace_back(std::make_unique<Input>(_trans("Forward")));
- controls.emplace_back(std::make_unique<Input>(_trans("Backward")));
- controls.emplace_back(std::make_unique<Input>(_trans("Hide")));
- controls.emplace_back(std::make_unique<Input>(_trans("Recenter")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Forward")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Backward")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Hide")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Recenter")));
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Center"), 0.5));
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Width"), 0.5));
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.cpp
index a825ce51c9..46dbd63c49 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.cpp
@@ -19,12 +19,12 @@ namespace ControllerEmu
{
Force::Force(const std::string& name_) : ControlGroup(name_, GroupType::Force)
{
- controls.emplace_back(std::make_unique<Input>(_trans("Up")));
- controls.emplace_back(std::make_unique<Input>(_trans("Down")));
- controls.emplace_back(std::make_unique<Input>(_trans("Left")));
- controls.emplace_back(std::make_unique<Input>(_trans("Right")));
- controls.emplace_back(std::make_unique<Input>(_trans("Forward")));
- controls.emplace_back(std::make_unique<Input>(_trans("Backward")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Up")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Down")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Left")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Right")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Forward")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Backward")));
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Dead Zone"), 0, 0, 50));
}
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp
index a534b7904f..268d239f0b 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp
@@ -27,7 +27,7 @@ ModifySettingsButton::ModifySettingsButton(std::string button_name)
void ModifySettingsButton::AddInput(std::string button_name, bool toggle)
{
- controls.emplace_back(new Input(std::move(button_name)));
+ controls.emplace_back(std::make_unique<Input>(Translate, std::move(button_name)));
threshold_exceeded.emplace_back(false);
associated_settings.emplace_back(false);
associated_settings_toggle.emplace_back(toggle);
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.cpp
index b5e7ff5a1a..6784f6e24e 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Slider.cpp
@@ -20,8 +20,8 @@ namespace ControllerEmu
Slider::Slider(const std::string& name_, const std::string& ui_name_)
: ControlGroup(name_, ui_name_, GroupType::Slider)
{
- controls.emplace_back(std::make_unique<Input>("Left"));
- controls.emplace_back(std::make_unique<Input>("Right"));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Left")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Right")));
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Dead Zone"), 0, 0, 50));
}
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp
index 72bc258976..2785f56ba5 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp
@@ -19,12 +19,12 @@ namespace ControllerEmu
{
Tilt::Tilt(const std::string& name_) : ControlGroup(name_, GroupType::Tilt)
{
- controls.emplace_back(std::make_unique<Input>(_trans("Forward")));
- controls.emplace_back(std::make_unique<Input>(_trans("Backward")));
- controls.emplace_back(std::make_unique<Input>(_trans("Left")));
- controls.emplace_back(std::make_unique<Input>(_trans("Right")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Forward")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Backward")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Left")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Right")));
- controls.emplace_back(std::make_unique<Input>(_trans("Modifier")));
+ controls.emplace_back(std::make_unique<Input>(Translate, _trans("Modifier")));
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Dead Zone"), 0, 0, 50));
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Circle Stick"), 0));
diff --git a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h
index 8b7925f7df..4f734e2824 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h
+++ b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
+#include "Common/Common.h"
#include "Common/IniFile.h"
#include "InputCommon/ControllerInterface/Device.h"
@@ -16,7 +17,8 @@ class ControllerInterface;
#define sign(x) ((x) ? (x) < 0 ? -1 : 1 : 0)
-const char* const named_directions[] = {"Up", "Down", "Left", "Right"};
+const char* const named_directions[] = {_trans("Up"), _trans("Down"), _trans("Left"),
+ _trans("Right")};
namespace ControllerEmu
{