From 4b675dda1b5934c2c57657b76ccf3838ee6ef0ab Mon Sep 17 00:00:00 2001 From: Laurent Trinques Date: Fri, 11 Sep 2026 11:40:10 +0200 Subject: [PATCH] CI/Windows: bundle Qt's own translations (qtbase) as lang/qt_XX.qm windeployqt runs with --no-translations, so standard buttons (OK/Cancel) and dialogs stayed in English. Copy each qtbase_XX.qm from the MSYS2 Qt translations into files/lang/qt_XX.qm, where QETApp::setLanguage() looks, with aliases for QET languages Qt only ships with a region (pt, zh). --- .github/workflows/windows-build.yml | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 956f8f697..86e47e7cc 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -248,6 +248,41 @@ jobs: exit 1 fi + # Qt's own translations (OK/Cancel buttons, standard dialogs...): + # they come from qtbase_XX.qm, not from QET's .ts, and windeployqt + # runs with --no-translations. QETApp::setLanguage() falls back to + # lang/qt_XX.qm, so copy each qtbase_XX.qm there under that name + # (qtbase_XX.qm is standalone, unlike Qt's qt_XX.qm meta catalogs). + QT_TR_DIR=/ucrt64/share/qt6/translations + if [ ! -d "$QT_TR_DIR" ]; then + QT_TR_DIR=$(cygpath -u "$(/ucrt64/bin/qtpaths6 --query QT_INSTALL_TRANSLATIONS 2>/dev/null)" 2>/dev/null || true) + fi + find "$QT_TR_DIR" -maxdepth 1 -name 'qtbase_*.qm' 2>/dev/null | while read -r f; do + l=$(basename "$f" .qm) + cp "$f" "$FILES/lang/qt_${l#qtbase_}.qm" + done + # QET languages Qt only ships with a region (pt -> pt_PT, zh -> zh_CN): + # QTranslator only shortens codes (fr_FR -> fr), it never extends them. + for q in $TS_LISTED; do + l=${q#qet_} + if [ ! -e "$FILES/lang/qt_$l.qm" ]; then + if [ -e "$QT_TR_DIR/qtbase_${l}_${l^^}.qm" ]; then + alt="$QT_TR_DIR/qtbase_${l}_${l^^}.qm" + else + alt=$(find "$QT_TR_DIR" -maxdepth 1 -name "qtbase_${l}_*.qm" 2>/dev/null | LC_ALL=C sort | head -1 || true) + fi + if [ -n "$alt" ]; then + cp "$alt" "$FILES/lang/qt_$l.qm" + fi + fi + done + QT_QM_COUNT=$(find "$FILES/lang" -maxdepth 1 -name 'qt_*.qm' | wc -l) + echo "=== $QT_QM_COUNT Qt translation files (qt_*.qm) copied from $QT_TR_DIR ===" + if [ "$QT_QM_COUNT" -eq 0 ]; then + echo "ERROR: no qtbase_*.qm found in '$QT_TR_DIR' (mingw-w64-ucrt-x86_64-qt6-translations installed?)" + exit 1 + fi + for f in LICENSE ChangeLog CREDIT README ELEMENTS.LICENSE; do cp "$GITHUB_WORKSPACE/$f" "$FILES/$f" 2>/dev/null || true done