Skip to content

Commit

Permalink
Refs #3. Added translations based on current locale.
Browse files Browse the repository at this point in the history
  • Loading branch information
SBriere committed Apr 11, 2024
1 parent 7614df9 commit d351085
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 23 deletions.
3 changes: 1 addition & 2 deletions Frontend/DashboardsViewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ add_subdirectory(resources)
add_subdirectory(submodules)
add_subdirectory(qml_cpp_modules)

qt_add_translations(TARGETS DashboardsViewerApp TS_FILE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/translations)

qt_add_executable(DashboardsViewerApp src/main.cpp)

qt_add_translations(TARGETS DashboardsViewerApp TS_FILE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/translations)

qt_add_resources(DashboardsViewerApp "configuration"
PREFIX "/"
FILES
Expand Down
2 changes: 1 addition & 1 deletion Frontend/DashboardsViewer/DashboardsViewer.qmlproject.qtds
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtDesignStudio 4.4.0, 2024-04-08T09:37:51. -->
<!-- Written by QtDesignStudio 4.4.0, 2024-04-10T15:08:28. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down
10 changes: 8 additions & 2 deletions Frontend/DashboardsViewer/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
#include <QQmlContext>
#include <QFontDatabase>
#include <QDebug>
#include <QTranslator>

#include "app_environment.h"
#include "import_qml_components_plugins.h"
#include "import_qml_plugins.h"
#include "ConfigParser.h"

#ifdef WEBASSEMBLY
#include <emscripten.h>

#endif

void setupFonts(const QGuiApplication* app){
Expand Down Expand Up @@ -68,6 +67,13 @@ int main(int argc, char *argv[])
// Setup fonts
setupFonts(&app);

// Setup translator
QTranslator appTranslator;
if (!appTranslator.load(QLocale::system(), "DashboardsViewerApp", "_")){
qWarning() << "Unable to load translations for locale " << QLocale::system().uiLanguages().first();
}
app.installTranslator(&appTranslator);

engine.load(url);

if (engine.rootObjects().isEmpty()) {
Expand Down
14 changes: 7 additions & 7 deletions Frontend/DashboardsViewer/translations/DashboardsViewerApp_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/BaseComManager.cpp" line="627"/>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/BaseComManager.cpp" line="651"/>
<source>Impossible de créer la requête</source>
<source>Unable to create network request</source>
<translation type="unfinished"></translation>
</message>
</context>
Expand Down Expand Up @@ -62,17 +62,17 @@
<name>DownloadingFile</name>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/DownloadingFile.cpp" line="81"/>
<source>Impossible de déterminer le nom du fichier à télécharger.</source>
<source>Unable to get filename to download</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/DownloadingFile.cpp" line="87"/>
<source>Mauvaise en-tête pour le téléchargement du fichier.</source>
<source>Bad header set in file download request</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/DownloadingFile.cpp" line="114"/>
<source>Impossible d&apos;ouvrir le fichier &apos;</source>
<source>Unable to open file</source>
<translation type="unfinished"></translation>
</message>
</context>
Expand Down Expand Up @@ -342,20 +342,20 @@
<name>TransferringFile</name>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/TransferringFile.cpp" line="79"/>
<source>Transfert annulé</source>
<source>Transfer cancelled</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UploadingFile</name>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/UploadingFile.cpp" line="30"/>
<source>Impossible d&apos;envoyer le fichier</source>
<source>Unable to upload file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/UploadingFile.cpp" line="30"/>
<source>le fichier est introuvable.</source>
<source>file not found</source>
<translation type="unfinished"></translation>
</message>
</context>
Expand Down
42 changes: 31 additions & 11 deletions Frontend/DashboardsViewer/translations/DashboardsViewerApp_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
</context>
<context>
<name>BaseComManager</name>
<message>
<source>Impossible de créer la requête</source>
<translation type="vanished">Impossible de créer la requête</translation>
</message>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/BaseComManager.cpp" line="627"/>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/BaseComManager.cpp" line="651"/>
<source>Impossible de créer la requête</source>
<source>Unable to create network request</source>
<translation>Impossible de créer la requête</translation>
</message>
</context>
Expand Down Expand Up @@ -61,18 +65,30 @@
<context>
<name>DownloadingFile</name>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/DownloadingFile.cpp" line="81"/>
<source>Impossible de déterminer le nom du fichier à télécharger.</source>
<translation>Impossible de déterminer le nom du fichier à télécharger.</translation>
<translation type="vanished">Impossible de déterminer le nom du fichier à télécharger.</translation>
</message>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/DownloadingFile.cpp" line="87"/>
<source>Mauvaise en-tête pour le téléchargement du fichier.</source>
<translation>Mauvaise en-tête pour le téléchargement du fichier.</translation>
<translation type="vanished">Mauvaise en-tête pour le téléchargement du fichier.</translation>
</message>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/DownloadingFile.cpp" line="114"/>
<source>Impossible d&apos;ouvrir le fichier &apos;</source>
<translation type="vanished">Impossible d&apos;ouvrir le fichier</translation>
</message>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/DownloadingFile.cpp" line="81"/>
<source>Unable to get filename to download</source>
<translation>Impossible de déterminer le nom du fichier à télécharger</translation>
</message>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/DownloadingFile.cpp" line="87"/>
<source>Bad header set in file download request</source>
<translation>Mauvaise en-tête pour le téléchargement du fichier</translation>
</message>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/DownloadingFile.cpp" line="114"/>
<source>Unable to open file</source>
<translation>Impossible d&apos;ouvrir le fichier</translation>
</message>
</context>
Expand Down Expand Up @@ -341,22 +357,26 @@
<context>
<name>TransferringFile</name>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/TransferringFile.cpp" line="79"/>
<source>Transfert annulé</source>
<translation type="vanished">Transfert annulé</translation>
</message>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/TransferringFile.cpp" line="79"/>
<source>Transfer cancelled</source>
<translation>Transfert annulé</translation>
</message>
</context>
<context>
<name>UploadingFile</name>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/UploadingFile.cpp" line="30"/>
<source>Impossible d&apos;envoyer le fichier</source>
<translation></translation>
<source>Unable to upload file</source>
<translation>Impossible de téléverser le fichier</translation>
</message>
<message>
<location filename="../submodules/opentera-libraries/cpp/clients/common/src/UploadingFile.cpp" line="30"/>
<source>le fichier est introuvable.</source>
<translation></translation>
<source>file not found</source>
<translation>Fichier non-trouvé</translation>
</message>
</context>
<context>
Expand Down

0 comments on commit d351085

Please sign in to comment.