Merge pull request #6564 from JosJuice/translate-certain-button-names

Translate certain button names but not all
This commit is contained in:
Léo Lam 2018-04-14 23:20:39 +02:00 committed by GitHub
commit ee955e37a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 142 additions and 85 deletions

View file

@ -8,7 +8,7 @@
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
MappingBool::MappingBool(MappingWidget* widget, ControllerEmu::BooleanSetting* setting)
: QCheckBox(QString::fromStdString(setting->m_ui_name)), m_parent(widget), m_setting(setting)
: QCheckBox(tr(setting->m_ui_name.c_str())), m_parent(widget), m_setting(setting)
{
Update();
Connect();

View file

@ -82,7 +82,10 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con
button->setMinimumWidth(100);
button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
form_layout->addRow(QString::fromStdString(control->name), button);
const bool translate = control->translate == ControllerEmu::Translate;
const QString translated_name =
translate ? tr(control->ui_name.c_str()) : QString::fromStdString(control->ui_name);
form_layout->addRow(translated_name, button);
auto* control_ref = control->control_ref.get();
@ -103,7 +106,7 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con
for (auto& numeric : group->numeric_settings)
{
auto* spinbox = new MappingNumeric(this, numeric.get());
form_layout->addRow(QString::fromStdString(numeric->m_name), spinbox);
form_layout->addRow(tr(numeric->m_name.c_str()), spinbox);
m_numerics.push_back(spinbox);
}