aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitmodules3
-rw-r--r--src/CMakeLists.txt11
-rw-r--r--src/ui/GpgFrontendUIInit.cpp18
m---------third_party/qttranslations0
4 files changed, 32 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
index 0ca4ffd2..3e9b725c 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -13,3 +13,6 @@
[submodule "third_party/libarchive"]
path = third_party/libarchive
url = https://github.com/libarchive/libarchive.git
+[submodule "third_party/qttranslations"]
+ path = third_party/qttranslations
+ url = git://code.qt.io/qt/qttranslations.git
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a225f616..6876ecf5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -448,6 +448,17 @@ if (BUILD_APPLICATION)
TS_FILES ${TS_FILES}
SOURCES ${ALL_SOURCE_FILES}
INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/src)
+
+ file(GLOB QT_TRANSLATIONS_TS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/third_party/qttranslations/translations/*.ts)
+ list(FILTER QT_TRANSLATIONS_TS INCLUDE REGEX ".*(qt|qtbase)_.*\.ts$")
+ add_custom_target(qttranslations ALL)
+ qt_add_lrelease(qttranslations
+ TS_FILES ${QT_TRANSLATIONS_TS}
+ QM_FILES_OUTPUT_VARIABLE QT_TRANSLATIONS_QM)
+ qt_add_resources(${AppName} "qttranslations"
+ PREFIX "/i18n_qt"
+ BASE ${CMAKE_CURRENT_BINARY_DIR}
+ FILES ${QT_TRANSLATIONS_QM})
endif()
# if building linux package
diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp
index aa92488e..148402d4 100644
--- a/src/ui/GpgFrontendUIInit.cpp
+++ b/src/ui/GpgFrontendUIInit.cpp
@@ -220,6 +220,24 @@ void InitUITranslations() {
QLocale().name());
QCoreApplication::installTranslator(translator);
}
+
+ auto* base_translation = new QTranslator(QCoreApplication::instance());
+ if (base_translation->load(QLocale(), QLatin1String("qt"), QLatin1String("_"),
+ QLatin1String(":/i18n_qt"),
+ QLatin1String(".qm"))) {
+ GF_UI_LOG_DEBUG("load qt translation file done, locale: {}",
+ QLocale().name());
+ QCoreApplication::installTranslator(base_translation);
+ }
+
+ base_translation = new QTranslator(QCoreApplication::instance());
+ if (base_translation->load(QLocale(), QLatin1String("qtbase"),
+ QLatin1String("_"), QLatin1String(":/i18n_qt"),
+ QLatin1String(".qm"))) {
+ GF_UI_LOG_DEBUG("load qtbase translation file done, locale: {}",
+ QLocale().name());
+ QCoreApplication::installTranslator(base_translation);
+ }
}
} // namespace GpgFrontend::UI
diff --git a/third_party/qttranslations b/third_party/qttranslations
new file mode 160000
+Subproject c4da2d3ed4511af796f88d0718aa9258908cc82