From 744dab6f13f4c403d12c78dcac0c725babd5745f Mon Sep 17 00:00:00 2001 From: Simon Briere Date: Tue, 30 Apr 2024 10:57:56 -0400 Subject: [PATCH] Refs #2. Fixed WebAssembly translations. Changes to support Qt 6.6.3 --- Frontend/DashboardsViewer/CMakeLists.txt | 14 +++++++++++--- .../content/delegates/SessionDelegate.qml | 2 +- Frontend/DashboardsViewer/src/main.cpp | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Frontend/DashboardsViewer/CMakeLists.txt b/Frontend/DashboardsViewer/CMakeLists.txt index 42a0a01..a283ebd 100644 --- a/Frontend/DashboardsViewer/CMakeLists.txt +++ b/Frontend/DashboardsViewer/CMakeLists.txt @@ -16,8 +16,10 @@ find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick Websockets) qt_policy(SET QTP0001 NEW) -if (Qt6_VERSION VERSION_GREATER_EQUAL 6.3) +if (Qt6_VERSION VERSION_GREATER_EQUAL 6.7) qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES en fr) +else() + qt_standard_project_setup() endif() @@ -30,10 +32,16 @@ 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) +if (Qt6_VERSION VERSION_GREATER_EQUAL 6.7) + qt_add_translations(TARGETS DashboardsViewerApp TS_FILE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/translations) +else() + qt_add_translations(DashboardsViewerApp ${CMAKE_CURRENT_SOURCE_DIR}/translations/DashboardsViewerApp_en.ts + ${CMAKE_CURRENT_SOURCE_DIR}/translations/DashboardsViewerApp_fr.ts + ) +endif() + qt_add_resources(DashboardsViewerApp "configuration" PREFIX "/" FILES diff --git a/Frontend/DashboardsViewer/content/delegates/SessionDelegate.qml b/Frontend/DashboardsViewer/content/delegates/SessionDelegate.qml index ead6aea..bc52955 100644 --- a/Frontend/DashboardsViewer/content/delegates/SessionDelegate.qml +++ b/Frontend/DashboardsViewer/content/delegates/SessionDelegate.qml @@ -239,7 +239,7 @@ BaseDelegate { id: txtDate Layout.alignment: Qt.AlignRight | Qt.AlignVCenter property date sessionDate: new Date(model.session_start_datetime) - text: sessionDate.toLocaleDateString() +" - " + sessionDate.toLocaleTimeString() + text: sessionDate.toLocaleDateString() +" - " + sessionDate.toLocaleTimeString(Qt.locale(), Locale.ShortFormat) font.pixelSize: Constants.baseFontSize style: Text.Outline font.bold: true diff --git a/Frontend/DashboardsViewer/src/main.cpp b/Frontend/DashboardsViewer/src/main.cpp index e2316a3..cfdbf0d 100644 --- a/Frontend/DashboardsViewer/src/main.cpp +++ b/Frontend/DashboardsViewer/src/main.cpp @@ -69,7 +69,7 @@ int main(int argc, char *argv[]) // Setup translator QTranslator appTranslator; - if (!appTranslator.load(QLocale::system(), "DashboardsViewerApp", "_")){ + if (!appTranslator.load(QLocale::system(), "DashboardsViewerApp", "_", ":/i18n")){ qWarning() << "Unable to load translations for locale " << QLocale::system().uiLanguages().first(); } app.installTranslator(&appTranslator);