From 2555c81673a628316891af267652eb9dd0bb2eef Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Sat, 18 Jul 2020 16:22:14 +0200 Subject: Add code localization support! --- locales/bin/de_DE.qm | Bin 0 -> 550 bytes locales/bin/es_ES.qm | Bin 0 -> 574 bytes locales/bin/main_en.qm | Bin 0 -> 310 bytes locales/de_DE.ts | 36 ++++++++++++++++++++++++++++++++++++ locales/es_ES.ts | 34 ++++++++++++++++++++++++++++++++++ locales/main_en.ts | 34 ++++++++++++++++++++++++++++++++++ main.cpp | 13 +++++++++++++ qml.qrc | 4 ++++ 8 files changed, 121 insertions(+) create mode 100644 locales/bin/de_DE.qm create mode 100644 locales/bin/es_ES.qm create mode 100644 locales/bin/main_en.qm create mode 100644 locales/de_DE.ts create mode 100644 locales/es_ES.ts create mode 100644 locales/main_en.ts diff --git a/locales/bin/de_DE.qm b/locales/bin/de_DE.qm new file mode 100644 index 0000000..6afd413 Binary files /dev/null and b/locales/bin/de_DE.qm differ diff --git a/locales/bin/es_ES.qm b/locales/bin/es_ES.qm new file mode 100644 index 0000000..5eb76d5 Binary files /dev/null and b/locales/bin/es_ES.qm differ diff --git a/locales/bin/main_en.qm b/locales/bin/main_en.qm new file mode 100644 index 0000000..8a9ba24 Binary files /dev/null and b/locales/bin/main_en.qm differ diff --git a/locales/de_DE.ts b/locales/de_DE.ts new file mode 100644 index 0000000..a7e8454 --- /dev/null +++ b/locales/de_DE.ts @@ -0,0 +1,36 @@ + + + + + main + + + Remote Support for your Desktop + Just the titel of the window + Fernwartung für den Desktop + + + + Unknown state of service + DBUS service state + Unbekannter Status des Dienstes + + + + Allow remote desktop support + Desktop zur Fernwartung freigeben + + + + Access pin to this computer + Zugangspin zu diesem Computer + + + + %1 + Do not translate! + + is just the pin which is used to authenticate to remote web app (django) frontend + + + diff --git a/locales/es_ES.ts b/locales/es_ES.ts new file mode 100644 index 0000000..e58d9fd --- /dev/null +++ b/locales/es_ES.ts @@ -0,0 +1,34 @@ + + + + + main + + + Remote Support for your Desktop + Soporte remoto para su escritorio + + + + Unknown state of service + Estado de servicio desconocido + + + + Allow remote desktop support + Permitir soporte de escritorio remoto + + + + Access pin to this computer + Pin de acceso a esta computadora + + + + %1 + Do not translate! + + is just the pin which is used to authenticate to remote web app (django) frontend + + + diff --git a/locales/main_en.ts b/locales/main_en.ts new file mode 100644 index 0000000..07d13c9 --- /dev/null +++ b/locales/main_en.ts @@ -0,0 +1,34 @@ + + + + + main + + + Remote Support for your Desktop + + + + + Unknown state of service + + + + + Allow remote desktop support + + + + + Access pin to this computer + + + + + %1 + Do not translate! + + is just the pin which is used to authenticate to remote web app (django) frontend + + + diff --git a/main.cpp b/main.cpp index 6333b85..6889e8d 100644 --- a/main.cpp +++ b/main.cpp @@ -1,5 +1,7 @@ #include #include +#include +#include int main(int argc, char *argv[]) { @@ -7,6 +9,17 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); + + QTranslator translator; + + qDebug() << "Im about to load: :/locales/bin/" + QLocale::system().name() + " locale!"; + if(translator.load(":/locales/bin/" + QLocale::system().name())) { + app.installTranslator(&translator); + qDebug() << "Loaded: " + QLocale::system().name() + " locale!"; + } else { + qDebug() << "Unable to load translation"; + } + QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()) diff --git a/qml.qrc b/qml.qrc index dd554cd..89940e7 100644 --- a/qml.qrc +++ b/qml.qrc @@ -2,5 +2,9 @@ main.qml main.cpp + locales/bin/de_DE.qm + locales/bin/main_en.qm + locales/de_DE.ts + locales/main_en.ts -- cgit v1.2.3