Adds missing tr functions for certain GUI strings that should be translatable (#2598)

* Adds missing tr functions for certain GUI strings that should be translatable

* set clang format off for multi-line strings, set userDir as arg

---------

Co-authored-by: rainmakerv2 <30595646+jpau02@users.noreply.github.com>
This commit is contained in:
rainmakerv2 2025-03-06 15:09:27 +08:00 committed by GitHub
parent f1aea5176d
commit 0efe9a4d0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 55 additions and 54 deletions

View file

@ -87,15 +87,16 @@ KBMSettings::KBMSettings(std::shared_ptr<GameInfoClass> game_info_get, QWidget*
connect(ui->CopyCommonButton, &QPushButton::clicked, this, [this] {
if (ui->ProfileComboBox->currentText() == "Common Config") {
QMessageBox::information(this, "Common Config Selected",
"This button copies mappings from the Common Config to the "
"currently selected profile, and cannot be used when the "
"currently selected profile is the Common Config.");
QMessageBox::information(this, tr("Common Config Selected"),
// clang-format off
tr("This button copies mappings from the Common Config to the currently selected profile, and cannot be used when the currently selected profile is the Common Config."));
// clang-format on
} else {
QMessageBox::StandardButton reply =
QMessageBox::question(this, "Copy values from Common Config",
"Do you want to overwrite existing mappings with the "
"mappings from the Common Config?",
QMessageBox::question(this, tr("Copy values from Common Config"),
// clang-format off
tr("Do you want to overwrite existing mappings with the mappings from the Common Config?"),
// clang-format on
QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) {
SetUIValuestoMappings("default");
@ -423,8 +424,8 @@ void KBMSettings::SaveKBMConfig(bool CloseOnSave) {
// Prevent duplicate inputs for KBM as this breaks the engine
for (auto it = inputs.begin(); it != inputs.end(); ++it) {
if (std::find(it + 1, inputs.end(), *it) != inputs.end()) {
QMessageBox::information(this, "Unable to Save",
"Cannot bind any unique input more than once");
QMessageBox::information(this, tr("Unable to Save"),
tr("Cannot bind any unique input more than once"));
return;
}
}
@ -625,7 +626,7 @@ void KBMSettings::GetGameTitle() {
void KBMSettings::onHelpClicked() {
if (!HelpWindowOpen) {
HelpWindow = new HelpDialog(&HelpWindowOpen, this);
HelpWindow->setWindowTitle("Help");
HelpWindow->setWindowTitle(tr("Help"));
HelpWindow->setAttribute(Qt::WA_DeleteOnClose); // Clean up on close
HelpWindow->show();
HelpWindowOpen = true;
@ -643,7 +644,7 @@ void KBMSettings::StartTimer(QPushButton*& button) {
mapping = button->text();
DisableMappingButtons();
button->setText("Press a key [" + QString::number(MappingTimer) + "]");
button->setText(tr("Press a key") + " [" + QString::number(MappingTimer) + "]");
timer = new QTimer(this);
MappingButton = button;
connect(timer, &QTimer::timeout, this, [this]() { CheckMapping(MappingButton); });
@ -652,7 +653,7 @@ void KBMSettings::StartTimer(QPushButton*& button) {
void KBMSettings::CheckMapping(QPushButton*& button) {
MappingTimer -= 1;
button->setText("Press a key [" + QString::number(MappingTimer) + "]");
button->setText(tr("Press a key") + " [" + QString::number(MappingTimer) + "]");
if (MappingCompleted) {
EnableMapping = false;
@ -1003,15 +1004,15 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) == AxisList.end()) {
SetMapping("mousewheelup");
} else {
QMessageBox::information(this, "Cannot set mapping",
"Mousewheel cannot be mapped to stick outputs");
QMessageBox::information(this, tr("Cannot set mapping"),
tr("Mousewheel cannot be mapped to stick outputs"));
}
} else if (wheelEvent->angleDelta().y() < -5) {
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) == AxisList.end()) {
SetMapping("mousewheeldown");
} else {
QMessageBox::information(this, "Cannot set mapping",
"Mousewheel cannot be mapped to stick outputs");
QMessageBox::information(this, tr("Cannot set mapping"),
tr("Mousewheel cannot be mapped to stick outputs"));
}
}
if (wheelEvent->angleDelta().x() > 5) {
@ -1023,8 +1024,8 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
SetMapping("mousewheelright");
}
} else {
QMessageBox::information(this, "Cannot set mapping",
"Mousewheel cannot be mapped to stick outputs");
QMessageBox::information(this, tr("Cannot set mapping"),
tr("Mousewheel cannot be mapped to stick outputs"));
}
} else if (wheelEvent->angleDelta().x() < -5) {
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) == AxisList.end()) {
@ -1034,8 +1035,8 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
SetMapping("mousewheelleft");
}
} else {
QMessageBox::information(this, "Cannot set mapping",
"Mousewheel cannot be mapped to stick outputs");
QMessageBox::information(this, tr("Cannot set mapping"),
tr("Mousewheel cannot be mapped to stick outputs"));
}
}
return true;