From b86d55e80ca13b5c4611b4b8dadd4341a50ee1ff Mon Sep 17 00:00:00 2001 From: MinyazevR <89993880+MinyazevR@users.noreply.github.com> Date: Fri, 10 Jan 2025 20:07:03 +0300 Subject: [PATCH] Add translations for Qt modules to installer (#1887) * Add translations to installer for Qt modules * Add French translations for Qt modules to installer * Change the path to search for translations from /translations to /resources/translations --- .github/workflows/windows_build_with_installer.yml | 2 +- buildScripts/github/install.sh | 2 +- installer/build-installer.sh | 1 + .../ru.qreal.root.languages.french/meta/prebuild-common.sh | 2 ++ .../ru.qreal.root.languages.russian/meta/prebuild-common.sh | 2 ++ qrgui/mainWindow/main.cpp | 2 +- 6 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows_build_with_installer.yml b/.github/workflows/windows_build_with_installer.yml index 351d24420a..da21af6f86 100644 --- a/.github/workflows/windows_build_with_installer.yml +++ b/.github/workflows/windows_build_with_installer.yml @@ -96,7 +96,7 @@ jobs: version: '${{matrix.qt-version}}' arch: win${{ matrix.mingw-bitness }}_mingw${{matrix.mingw-short-version}} modules: 'qtscript' - archives: 'qtbase qtmultimedia qtsvg qtscript qttools qtserialport qtimageformats qtwinextras' + archives: 'qtbase qtmultimedia qtsvg qtscript qttools qtserialport qtimageformats qtwinextras qttranslations' tools: 'tools_mingw,qt.tools.win${{ matrix.mingw-bitness }}_mingw${{matrix.mingw-short-version}}0 tools_ifw' add-tools-to-path: true cache: true diff --git a/buildScripts/github/install.sh b/buildScripts/github/install.sh index 7ecf0af566..35da434908 100755 --- a/buildScripts/github/install.sh +++ b/buildScripts/github/install.sh @@ -67,7 +67,7 @@ case "$(uname)" in sudo yum install -y --setopt=install_weak_deps=False libX11-xcb libXext libxkbcommon-x11 fontconfig freetype libXrender #libQt5WaylandCompositor.so.5.15: libQt5Quick.so.5 libQt5Qml.so.5 libQt5QmlModels.so.5 modules=("qtscript" "qtwaylandcompositor") - archives=("qtbase" "qtmultimedia" "qtsvg" "qtscript" "qttools" "qtserialport" "qtimageformats" "icu" "qtwayland" "qtdeclarative") + archives=("qtbase" "qtmultimedia" "qtsvg" "qtscript" "qttools" "qtserialport" "qtimageformats" "icu" "qtwayland" "qtdeclarative" "qttranslations") install_qt linux desktop "$TRIK_QT_VERSION" "$HOME/Qt" $modules $archives QT_ROOT_DIR=$(ls -1d "$HOME"/Qt/$TRIK_QT_VERSION*/gcc_64 | head -n 1) echo "$QT_ROOT_DIR/bin" >> $GITHUB_PATH diff --git a/installer/build-installer.sh b/installer/build-installer.sh index 8717f6519b..cf1416610b 100755 --- a/installer/build-installer.sh +++ b/installer/build-installer.sh @@ -23,6 +23,7 @@ esac export QT_LIB=$(cygpath -u $("$QT_DIR"/qmake -query "$qt_query_key")) export QT_PLUGINS=$(cygpath -u $("$QT_DIR"/qmake -query QT_INSTALL_PLUGINS)) +export QT_TRANSLATIONS=$(cygpath -u $("$QT_DIR"/qmake -query QT_INSTALL_TRANSLATIONS)) export QTIFW_DIR=$(realpath $(cygpath -u "$2")) export PRODUCT="$3" export OS="$OSTYPE" diff --git a/installer/packages/qreal-base/ru.qreal.root.languages.french/meta/prebuild-common.sh b/installer/packages/qreal-base/ru.qreal.root.languages.french/meta/prebuild-common.sh index 260a37dabf..16fa2ef590 100755 --- a/installer/packages/qreal-base/ru.qreal.root.languages.french/meta/prebuild-common.sh +++ b/installer/packages/qreal-base/ru.qreal.root.languages.french/meta/prebuild-common.sh @@ -6,3 +6,5 @@ cd "$(dirname "$0")" mkdir -p "$PWD"/../data/translations rsync -a "$BIN_DIR"/translations/fr "$PWD"/../data/translations +ls "$QT_TRANSLATIONS" +rsync -a "$QT_TRANSLATIONS"/*fr.qm "$PWD"/../data/translations diff --git a/installer/packages/qreal-base/ru.qreal.root.languages.russian/meta/prebuild-common.sh b/installer/packages/qreal-base/ru.qreal.root.languages.russian/meta/prebuild-common.sh index 0f4f8ae1b2..b17ded9a8d 100755 --- a/installer/packages/qreal-base/ru.qreal.root.languages.russian/meta/prebuild-common.sh +++ b/installer/packages/qreal-base/ru.qreal.root.languages.russian/meta/prebuild-common.sh @@ -6,3 +6,5 @@ cd "$(dirname "$0")" mkdir -p "$PWD"/../data/translations rsync -a "$BIN_DIR"/translations/ru "$PWD"/../data/translations +ls "$QT_TRANSLATIONS" +rsync -a "$QT_TRANSLATIONS"/*ru.qm "$PWD"/../data/translations diff --git a/qrgui/mainWindow/main.cpp b/qrgui/mainWindow/main.cpp index e7d67db48c..e7b7a96a56 100644 --- a/qrgui/mainWindow/main.cpp +++ b/qrgui/mainWindow/main.cpp @@ -43,7 +43,7 @@ static void loadTranslators(QLocale &locale) { /// Load Qt's system translations before application translations static const QStringList qtModules {"qtbase", "qtmultimedia", "qtserialport", "qtxmlpatterns", "qtscript" }; - static const auto qtAppsTranslationsDir = QLibraryInfo::location(QLibraryInfo::LibraryLocation::TranslationsPath); + static const auto qtAppsTranslationsDir = PlatformInfo::invariantSettingsPath("pathToTranslations"); for (auto &&module: qtModules) { auto *t = new QTranslator(qApp);