linux(i18n): add Turkish translations (#361)

* linux(i18n): add Turkish translations

- Add Qt Linguist translation infrastructure to CMakeLists.txt
- Wrap UI strings with qsTr() in Main.qml
- Wrap menu strings with tr() in trayiconmanager.cpp
- Add QTranslator loader in main.cpp for automatic locale detection
- Create Turkish translation file (librepods_tr.ts)

Translations include:
- Main window: connection status, noise control modes, settings
- Tray menu: all menu items and tooltips
- System notifications

* fix: allocate QTranslator on heap to ensure lifetime
This commit is contained in:
Mümin Köykıran
2025-12-10 04:12:51 +03:00
committed by GitHub
parent 0e1f784737
commit a75557d6dc
5 changed files with 217 additions and 28 deletions

View File

@@ -12,6 +12,10 @@
#include <QTimer>
#include <QProcess>
#include <QRegularExpression>
#include <QTranslator>
#include <QLibraryInfo>
#include <QDir>
#include <QStandardPaths>
#include "airpods_packets.h"
#include "logger.h"
@@ -987,6 +991,25 @@ private:
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
// Load translations
QTranslator *translator = new QTranslator(&app);
QString locale = QLocale::system().name();
// Try to load translation from various locations
QStringList translationPaths = {
QCoreApplication::applicationDirPath() + "/translations",
QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/librepods/translations",
"/usr/share/librepods/translations",
"/usr/local/share/librepods/translations"
};
for (const QString &path : translationPaths) {
if (translator->load("librepods_" + locale, path)) {
app.installTranslator(translator);
break;
}
}
QLocalServer::removeServer("app_server");
QFile stale("/tmp/app_server");