Qt: Add translation support (#664)

* Translation PoC

* i18n but better

* More Greek translation

* Add proper translation UI

* Linux CI: Install qt6-tools-dev
This commit is contained in:
wheremyfoodat
2024-12-04 21:08:33 +02:00
committed by GitHub
parent 28461a1d44
commit bfdc6f0240
11 changed files with 1656 additions and 7 deletions

View File

@@ -12,7 +12,7 @@ ConfigWindow::ConfigWindow(ConfigCallback configCallback, MainWindowCallback win
// Set the window title of the main window appropriately if we enable showing the app version on the window
if (config.windowSettings.showAppVersion) {
getMainWindow()->setWindowTitle("Alber v" PANDA3DS_VERSION);
getMainWindow()->setWindowTitle(tr("Alber v%1").arg(PANDA3DS_VERSION));
}
// Initialize the widget list and the widget container widgets
@@ -96,6 +96,9 @@ ConfigWindow::ConfigWindow(ConfigCallback configCallback, MainWindowCallback win
});
guiLayout->addRow(tr("Window icon"), iconSelect);
QComboBox* languageSelect = createLanguageSelect();
guiLayout->addRow(tr("Language"), languageSelect);
QCheckBox* showAppVersion = new QCheckBox(tr("Show version on window title"));
showAppVersion->setChecked(config.windowSettings.showAppVersion);
connect(showAppVersion, &QCheckBox::toggled, this, [&](bool checked) {
@@ -103,7 +106,7 @@ ConfigWindow::ConfigWindow(ConfigCallback configCallback, MainWindowCallback win
updateConfig();
// Update main window title
getMainWindow()->setWindowTitle(checked ? "Alber v" PANDA3DS_VERSION : "Alber");
getMainWindow()->setWindowTitle(checked ? tr("Alber v%1").arg(PANDA3DS_VERSION) : tr("Alber"));
});
connectCheckbox(showAppVersion, config.windowSettings.showAppVersion);
guiLayout->addRow(showAppVersion);