Skip to content

Commit

Permalink
Refs #2. Fixed WebAssembly translations. Changes to support Qt 6.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
SBriere committed Apr 30, 2024
1 parent 4b6d0e6 commit 744dab6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
14 changes: 11 additions & 3 deletions Frontend/DashboardsViewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Frontend/DashboardsViewer/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 744dab6

Please sign in to comment.