Skip to content

Commit

Permalink
wip translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Jan 31, 2025
1 parent aa32706 commit 2cbb306
Show file tree
Hide file tree
Showing 22 changed files with 3,316 additions and 167 deletions.
10 changes: 5 additions & 5 deletions Source/RMG-Input/UserInterface/MainDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ MainDialog::MainDialog(QWidget* parent, Thread::SDLThread* sdlThread, bool romCo
{
Widget::ControllerWidget* widget = new Widget::ControllerWidget(this, this->eventFilter);
widget->SetOnlyLoadGameProfile(romConfig);
widget->SetSettingsSection("Player " + QString::number(i + 1), "Rosalie's Mupen GUI - Input Plugin Profile " + QString::number(i));
widget->SetSettingsSection(tr("Player ") + QString::number(i + 1), "Rosalie's Mupen GUI - Input Plugin Profile " + QString::number(i));
widget->LoadSettings();
this->tabWidget->widget(i)->layout()->addWidget(widget);
controllerWidgets.push_back(widget);
Expand All @@ -69,12 +69,12 @@ MainDialog::MainDialog(QWidget* parent, Thread::SDLThread* sdlThread, bool romCo
// so we only have to expose it there
if (controllerWidget == this->controllerWidgets.last())
{
controllerWidget->AddInputDevice({"Voice Recognition Unit", "", "", (int)InputDeviceType::EmulateVRU});
controllerWidget->AddInputDevice({tr("Voice Recognition Unit").toStdString(), "", "", (int)InputDeviceType::EmulateVRU});
}
#endif // VRU
controllerWidget->AddInputDevice({"None", "", "", (int)InputDeviceType::None});
controllerWidget->AddInputDevice({"Automatic", "", "", (int)InputDeviceType::Automatic});
controllerWidget->AddInputDevice({"Keyboard", "", "", (int)InputDeviceType::Keyboard});
controllerWidget->AddInputDevice({tr("None").toStdString(), "", "", (int)InputDeviceType::None});
controllerWidget->AddInputDevice({tr("Automatic").toStdString(), "", "", (int)InputDeviceType::Automatic});
controllerWidget->AddInputDevice({tr("Keyboard").toStdString(), "", "", (int)InputDeviceType::Keyboard});
controllerWidget->SetInitialized(true);
}

Expand Down
16 changes: 8 additions & 8 deletions Source/RMG-Input/UserInterface/Widget/ControllerWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ bool ControllerWidget::isCurrentDeviceKeyboard()
bool ControllerWidget::isCurrentDeviceNotFound()
{
QString title = this->inputDeviceComboBox->currentText();
return title.endsWith("(not found)");
return title.endsWith(tr("(not found)"));
}

void ControllerWidget::disableAllChildren()
Expand Down Expand Up @@ -576,7 +576,7 @@ void ControllerWidget::CheckInputDeviceSettings(QString sectionQString)
}

// clear (not found) devices first
int notFoundIndex = this->inputDeviceComboBox->findText("(not found)", Qt::MatchFlag::MatchEndsWith);
int notFoundIndex = this->inputDeviceComboBox->findText(tr("(not found)"), Qt::MatchFlag::MatchEndsWith);
if (notFoundIndex != -1)
{
this->inputDeviceNameList.removeAt(notFoundIndex);
Expand Down Expand Up @@ -638,7 +638,7 @@ void ControllerWidget::CheckInputDeviceSettings(QString sectionQString)
else
{ // no match
QString title = QString::fromStdString(deviceName);
title += " (not found)";
title += tr(" (not found)");
this->inputDeviceNameList.append(QString::fromStdString(deviceName));
this->inputDeviceComboBox->addItem(title, QVariant::fromValue<SDLDevice>(device));
this->inputDeviceComboBox->setCurrentIndex(this->inputDeviceNameList.count() - 1);
Expand Down Expand Up @@ -672,7 +672,7 @@ void ControllerWidget::GetCurrentInputDevice(SDLDevice& device, bool ignoreDevic
void ControllerWidget::on_deadZoneSlider_valueChanged(int value)
{
QString title;
title = "Deadzone: ";
title = tr("Deadzone: ");
title += QString::number(value);
title += "%";

Expand Down Expand Up @@ -752,7 +752,7 @@ void ControllerWidget::on_addProfileButton_clicked()

// ask user for a new profile name
QString newProfile = QInputDialog::getText(this,
"Create New Profile", "New profile name:",
tr("Create New Profile"), tr("New profile name:"),
QLineEdit::Normal, "",
nullptr,
Qt::WindowCloseButtonHint | Qt::WindowTitleHint);
Expand All @@ -766,15 +766,15 @@ void ControllerWidget::on_addProfileButton_clicked()
newProfile.contains('[') ||
newProfile.contains(']'))
{
this->showErrorMessage("Profile name cannot contain ';','[' or ']'!");
this->showErrorMessage(tr("Profile name cannot contain ';','[' or ']'!"));
return;
}

// ensure the name is unique
profilesIter = std::find(profiles.begin(), profiles.end(), newProfile.toStdString());
if (profilesIter != profiles.end())
{
this->showErrorMessage("Profile with the same name already exists!");
this->showErrorMessage(tr("Profile with the same name already exists!"));
return;
}

Expand Down Expand Up @@ -804,7 +804,7 @@ void ControllerWidget::on_removeProfileButton_clicked()
{
QMessageBox messageBox(this);
messageBox.setIcon(QMessageBox::Icon::Warning);
messageBox.setText("Are you sure you want to clear the main profile?");
messageBox.setText(tr("Are you sure you want to clear the main profile?"));
messageBox.addButton(QMessageBox::Yes);
messageBox.addButton(QMessageBox::No);
if (messageBox.exec() == QMessageBox::Yes)
Expand Down
7 changes: 6 additions & 1 deletion Source/RMG/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

find_package(Qt6 COMPONENTS Gui Widgets Core REQUIRED)
find_package(Qt6 COMPONENTS Gui Widgets Core OpenGL LinguistTools REQUIRED)

file(GLOB TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../../Translations/*.ts")
qt6_add_translations(RMG
TS_FILES ${TS_FILES}
)

if (PORTABLE_INSTALL)
add_definitions(-DPORTABLE_INSTALL)
Expand Down
4 changes: 2 additions & 2 deletions Source/RMG/OnScreenDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ bool OnScreenDisplaySetDisplaySize(int width, int height)
return true;
}

void OnScreenDisplaySetMessage(std::string message)
void OnScreenDisplaySetMessage(QString message)
{
if (!l_Initialized)
{
return;
}

l_Message = message;
l_Message = message.toStdString();
l_MessageTime = std::chrono::high_resolution_clock::now();
}

Expand Down
4 changes: 2 additions & 2 deletions Source/RMG/OnScreenDisplay.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifndef RMG_ONSCREENDISPLAY_HPP
#define RMG_ONSCREENDISPLAY_HPP

#include <string>
#include <QString>

// attempts to initialize the OSD
bool OnScreenDisplayInit(void);
Expand All @@ -25,7 +25,7 @@ void OnScreenDisplayLoadSettings(void);
bool OnScreenDisplaySetDisplaySize(int width, int height);

// sets the current message to the OSD
void OnScreenDisplaySetMessage(std::string message);
void OnScreenDisplaySetMessage(QString message);

// renders the OSD
void OnScreenDisplayRender(void);
Expand Down
8 changes: 4 additions & 4 deletions Source/RMG/UserInterface/Dialog/Cheats/AddCheatDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ bool AddCheatDialog::getCheat(CoreCheat& cheat)

if (!CoreParseCheat(lines, cheat))
{
QtMessageBox::Error(this, "CoreParseCheat() Failed", QString::fromStdString(CoreGetError()));
QtMessageBox::Error(this, tr("CoreParseCheat() Failed"), QString::fromStdString(CoreGetError()));
return false;
}

Expand All @@ -276,7 +276,7 @@ bool AddCheatDialog::addCheat(void)

if (!CoreAddCheat(cheat))
{
QtMessageBox::Error(this, "CoreAddCheat() Failed", QString::fromStdString(CoreGetError()));
QtMessageBox::Error(this, tr("CoreAddCheat() Failed"), QString::fromStdString(CoreGetError()));
return false;
}

Expand All @@ -301,7 +301,7 @@ bool AddCheatDialog::updateCheat(void)

if (!CoreUpdateCheat(this->oldCheat,cheat))
{
QtMessageBox::Error(this, "CoreUpdateCheat() Failed", QString::fromStdString(CoreGetError()));
QtMessageBox::Error(this, tr("CoreUpdateCheat() Failed"), QString::fromStdString(CoreGetError()));
return false;
}

Expand All @@ -314,7 +314,7 @@ void AddCheatDialog::accept(void)

if (!this->validate())
{
QtMessageBox::Error(this, "Validating Cheat Failed", "");
QtMessageBox::Error(this, tr("Validating Cheat Failed"), "");
return;
}

Expand Down
6 changes: 3 additions & 3 deletions Source/RMG/UserInterface/Dialog/Cheats/CheatsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void CheatsDialog::loadCheats(void)

if (!CoreGetCurrentCheats(cheats))
{
QtMessageBox::Error(this, "CoreGetCurrentCheats() Failed", QString::fromStdString(CoreGetError()));
QtMessageBox::Error(this, tr("CoreGetCurrentCheats() Failed"), QString::fromStdString(CoreGetError()));
this->failedToParseCheats = true;
return;
}
Expand Down Expand Up @@ -176,7 +176,7 @@ void CheatsDialog::on_removeCheatButton_clicked(void)
// try to remove cheat
if (!CoreRemoveCheat(cheat))
{
QtMessageBox::Error(this, "CoreRemoveCheat() Failed", QString::fromStdString(CoreGetError()));
QtMessageBox::Error(this, tr("CoreRemoveCheat() Failed"), QString::fromStdString(CoreGetError()));
return;
}

Expand All @@ -196,7 +196,7 @@ void CheatsDialog::accept(void)

if (!CoreApplyCheats())
{
QtMessageBox::Error(this, "CoreApplyCheats() Failed", QString::fromStdString(CoreGetError()));
QtMessageBox::Error(this, tr("CoreApplyCheats() Failed"), QString::fromStdString(CoreGetError()));
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ CreateNetplaySessionDialog::CreateNetplaySessionDialog(QWidget *parent, QWebSock

// change ok button name
QPushButton* createButton = this->buttonBox->button(QDialogButtonBox::Ok);
createButton->setText("Create");
createButton->setText(tr("Create"));
createButton->setEnabled(false);

// set validator for nickname
Expand Down Expand Up @@ -181,7 +181,7 @@ void CreateNetplaySessionDialog::on_webSocket_textMessageReceived(QString messag
}
else
{
QtMessageBox::Error(this, "Server Error", json.value("message").toString());
QtMessageBox::Error(this, tr("Server Error"), json.value("message").toString());
this->validateCreateButton();
}
}
Expand Down Expand Up @@ -215,7 +215,7 @@ void CreateNetplaySessionDialog::on_networkAccessManager_Finished(QNetworkReply*
{
if (reply->error())
{
QtMessageBox::Error(this, "Server Error", "Failed to retrieve server list json: " + reply->errorString());
QtMessageBox::Error(this, tr("Server Error"), "Failed to retrieve server list json: " + reply->errorString());
reply->deleteLater();
return;
}
Expand All @@ -241,7 +241,7 @@ void CreateNetplaySessionDialog::on_serverComboBox_currentIndexChanged(int index
return;
}

this->pingLineEdit->setText("Calculating...");
this->pingLineEdit->setText(tr("Calculating..."));

QString address = this->serverComboBox->itemData(index).toString();
this->webSocket->open(QUrl(address));
Expand Down Expand Up @@ -271,7 +271,7 @@ void CreateNetplaySessionDialog::accept()
{
if (!this->webSocket->isValid())
{
QtMessageBox::Error(this, "Server Error", "Connection Failed");
QtMessageBox::Error(this, tr("Server Error"), "Connection Failed");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ NetplaySessionBrowserDialog::NetplaySessionBrowserDialog(QWidget *parent, QWebSo

// change restore defaults button name
QPushButton* refreshButton = this->buttonBox->button(QDialogButtonBox::RestoreDefaults);
refreshButton->setText("Refresh");
refreshButton->setText(tr("Refresh"));
refreshButton->setIcon(QIcon::fromTheme("refresh-line"));
refreshButton->setEnabled(false);

Expand Down
16 changes: 8 additions & 8 deletions Source/RMG/UserInterface/Dialog/Netplay/NetplaySessionDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ NetplaySessionDialog::NetplaySessionDialog(QWidget *parent, QWebSocket* webSocke
webSocket->sendTextMessage(QJsonDocument(json).toJson());

QPushButton* startButton = this->buttonBox->button(QDialogButtonBox::Ok);
startButton->setText("Start");
startButton->setText(tr("Start"));
startButton->setEnabled(false);

QPushButton* cheatsButton = this->buttonBox->button(QDialogButtonBox::RestoreDefaults);
cheatsButton->setText("Cheats");
cheatsButton->setText(tr("Cheats"));
cheatsButton->setIcon(QIcon::fromTheme("code-box-line"));

this->updateCheatsTreeWidget();
Expand Down Expand Up @@ -99,7 +99,7 @@ bool NetplaySessionDialog::getCheats(std::vector<CoreCheat>& cheats, QJsonArray&
if (!CheatsCommon::ParseCheatJson(cheatsArray, cheats))
{
QString error = "Failed to parse cheats json: " + QString(cheatDocument.toJson());
QtMessageBox::Error(this, "CheatsCommon::ParseCheatJson() Failed", error);
QtMessageBox::Error(this, tr("CheatsCommon::ParseCheatJson() Failed"), error);
return false;
}

Expand All @@ -118,7 +118,7 @@ bool NetplaySessionDialog::applyCheats(void)

if (!CoreSetNetplayCheats(cheats))
{
QtMessageBox::Error(this, "CoreSetNetplayCheats() Failed", QString::fromStdString(CoreGetError()));
QtMessageBox::Error(this, tr("CoreSetNetplayCheats() Failed"), QString::fromStdString(CoreGetError()));
return false;
}

Expand Down Expand Up @@ -201,7 +201,7 @@ void NetplaySessionDialog::on_webSocket_textMessageReceived(QString message)
startButton->setEnabled(true);
cheatsButton->setEnabled(true);

QtMessageBox::Error(this, "Server Error", json.value("message").toString());
QtMessageBox::Error(this, tr("Server Error"), json.value("message").toString());
}
}
else if (type == "reply_motd")
Expand All @@ -219,7 +219,7 @@ void NetplaySessionDialog::on_webSocket_textMessageReceived(QString message)
}
else
{
QtMessageBox::Error(this, "Server Error", json.value("message").toString());
QtMessageBox::Error(this, tr("Server Error"), json.value("message").toString());
}
}
}
Expand Down Expand Up @@ -257,7 +257,7 @@ void NetplaySessionDialog::on_buttonBox_clicked(QAbstractButton* button)

if (!CoreOpenRom(this->sessionFile.toStdU32String()))
{
QtMessageBox::Error(this, "CoreOpenRom() Failed", QString::fromStdString(CoreGetError()));
QtMessageBox::Error(this, tr("CoreOpenRom() Failed"), QString::fromStdString(CoreGetError()));
return;
}

Expand All @@ -266,7 +266,7 @@ void NetplaySessionDialog::on_buttonBox_clicked(QAbstractButton* button)

if (!CoreCloseRom())
{
QtMessageBox::Error(this, "CoreCloseRom() Failed", QString::fromStdString(CoreGetError()));
QtMessageBox::Error(this, tr("CoreCloseRom() Failed"), QString::fromStdString(CoreGetError()));
return;
}

Expand Down
Loading

0 comments on commit 2cbb306

Please sign in to comment.