From 4e7f67812edd688f30e54f48517b3e16c5887553 Mon Sep 17 00:00:00 2001 From: saturneric Date: Mon, 29 Jul 2024 02:30:41 +0200 Subject: [PATCH] feat: improve modules translation --- include/GFModuleCommonUtils.hpp | 11 +++ src/m_gpg_info/CMakeLists.txt | 20 ++-- src/m_gpg_info/GnuPGInfoGatheringModule.cpp | 2 + .../ts/ModuleGnuPGInfoGathering.de_DE.ts | 94 +++++++++++++++++- .../ts/ModuleGnuPGInfoGathering.en_US.ts | 90 +++++++++++++++++- .../ts/ModuleGnuPGInfoGathering.fr_FR.ts | 94 +++++++++++++++++- .../ts/ModuleGnuPGInfoGathering.it_iT.ts | 95 +++++++++++++++++++ .../ts/ModuleGnuPGInfoGathering.zh_CN.ts | 90 +++++++++++++++++- .../ts/ModuleGnuPGInfoGathering.zh_TW.ts | 95 +++++++++++++++++++ src/m_ver_check/CMakeLists.txt | 21 ++-- src/m_ver_check/VersionCheckingModule.cpp | 11 +-- .../ts/ModuleVersionChecking.de_DE.ts | 48 +++++----- .../ts/ModuleVersionChecking.en_US.ts | 36 +++---- .../ts/ModuleVersionChecking.fr_FR.ts | 66 ++++++------- .../ts/ModuleVersionChecking.it_IT.ts | 76 +++++++++++++++ .../ts/ModuleVersionChecking.zh_CN.ts | 43 +++------ .../ts/ModuleVersionChecking.zh_TW.ts | 76 +++++++++++++++ 17 files changed, 831 insertions(+), 137 deletions(-) create mode 100644 src/m_gpg_info/ts/ModuleGnuPGInfoGathering.it_iT.ts create mode 100644 src/m_gpg_info/ts/ModuleGnuPGInfoGathering.zh_TW.ts create mode 100644 src/m_ver_check/ts/ModuleVersionChecking.it_IT.ts create mode 100644 src/m_ver_check/ts/ModuleVersionChecking.zh_TW.ts diff --git a/include/GFModuleCommonUtils.hpp b/include/GFModuleCommonUtils.hpp index 2e18cc5..0c29dc7 100644 --- a/include/GFModuleCommonUtils.hpp +++ b/include/GFModuleCommonUtils.hpp @@ -45,6 +45,17 @@ #define LISTEN(event) GFModuleListenEvent(GFGetModuleID(), DUP(event)) +#define LOAD_TRANS(name) \ + { \ + QFile f(QString(":/i18n/%2.%1.qm").arg(GFAppActiveLocale()).arg(name)); \ + if (f.exists() && f.open(QIODevice::ReadOnly)) { \ + FLOG_INFO("%3 loading, locale: %1, path: %2", GFAppActiveLocale(), \ + f.fileName(), UDUP(GFGetModuleID())); \ + auto b = f.readAll(); \ + GFAppRegisterTranslator(AllocBufferAndCopy(b), b.size()); \ + } \ + } + #define EXECUTE_MODULE() \ auto GFExecuteModule(GFModuleEvent* p_event) -> int { \ auto event = ConvertEventToMap(p_event); diff --git a/src/m_gpg_info/CMakeLists.txt b/src/m_gpg_info/CMakeLists.txt index 37f36e4..1a98483 100644 --- a/src/m_gpg_info/CMakeLists.txt +++ b/src/m_gpg_info/CMakeLists.txt @@ -31,7 +31,7 @@ aux_source_directory(. INTEGRATED_MODULE_SOURCE) add_library(mod_gpg_info SHARED ${INTEGRATED_MODULE_SOURCE}) # install dir -install(TARGETS mod_gpg_info +install(TARGETS mod_gpg_info LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/modules") # link sdk @@ -51,12 +51,14 @@ target_compile_features(mod_gpg_info PRIVATE cxx_std_17) # i18n set(LOCALE_TS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/ts) -set(TS_FILES "${LOCALE_TS_PATH}/ModuleGnuPGInfoGathering.en_US.ts" - "${LOCALE_TS_PATH}/ModuleGnuPGInfoGathering.de_DE.ts" - "${LOCALE_TS_PATH}/ModuleGnuPGInfoGathering.fr_FR.ts" - "${LOCALE_TS_PATH}/ModuleGnuPGInfoGathering.zh_CN.ts") +set(TS_FILES "${LOCALE_TS_PATH}/ModuleGnuPGInfoGathering.en_US.ts" + "${LOCALE_TS_PATH}/ModuleGnuPGInfoGathering.de_DE.ts" + "${LOCALE_TS_PATH}/ModuleGnuPGInfoGathering.fr_FR.ts" + "${LOCALE_TS_PATH}/ModuleGnuPGInfoGathering.it_iT.ts" + "${LOCALE_TS_PATH}/ModuleGnuPGInfoGathering.zh_CN.ts" + "${LOCALE_TS_PATH}/ModuleGnuPGInfoGathering.zh_TW.ts") qt_add_translations(mod_gpg_info - RESOURCE_PREFIX "/i18n" - TS_FILES ${TS_FILES} - SOURCES ${MODULE_SOURCE_FILES} - INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}) \ No newline at end of file + RESOURCE_PREFIX "/i18n" + TS_FILES ${TS_FILES} + SOURCES ${MODULE_SOURCE_FILES} + INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}) \ No newline at end of file diff --git a/src/m_gpg_info/GnuPGInfoGatheringModule.cpp b/src/m_gpg_info/GnuPGInfoGatheringModule.cpp index 9339882..2e13590 100644 --- a/src/m_gpg_info/GnuPGInfoGatheringModule.cpp +++ b/src/m_gpg_info/GnuPGInfoGatheringModule.cpp @@ -81,6 +81,8 @@ auto GFRegisterModule() -> int { auto GFActiveModule() -> int { LISTEN("REQUEST_GATHERING_GNUPG_INFO"); + + LOAD_TRANS("ModuleGnuPGInfoGathering"); return 0; } diff --git a/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.de_DE.ts b/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.de_DE.ts index 1f068c5..84933be 100644 --- a/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.de_DE.ts +++ b/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.de_DE.ts @@ -1,3 +1,95 @@ - + + + GTrC + + + GnuPG + GnuPG + + + + GnupgTab + + + Name + Name + + + + + Description + Beschreibung + + + + Version + Version + + + + Checksum + Prüfsumme + + + + Binary Path + Binärer Pfad + + + + Components + Komponenten + + + + Directories + Verzeichnisse + + + + Options + Optionen + + + + Directory Type + Verzeichnis Typ + + + + Path + Pfad + + + Configurations + Konfigurationen + + + + Component + Komponente + + + + Group + Gruppe + + + + Key + Schlüssel + + + + Default Value + Standardwert + + + + Value + Wert + + + diff --git a/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.en_US.ts b/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.en_US.ts index 1f068c5..b3e067a 100644 --- a/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.en_US.ts +++ b/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.en_US.ts @@ -1,3 +1,91 @@ - + + + GTrC + + + GnuPG + + + + + GnupgTab + + + Name + + + + + + Description + + + + + Version + + + + + Checksum + + + + + Binary Path + + + + + Components + + + + + Directories + + + + + Options + + + + + Directory Type + + + + + Path + + + + + Component + + + + + Group + + + + + Key + + + + + Default Value + + + + + Value + + + + diff --git a/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.fr_FR.ts b/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.fr_FR.ts index 1f068c5..13bc2fe 100644 --- a/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.fr_FR.ts +++ b/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.fr_FR.ts @@ -1,3 +1,95 @@ - + + + GTrC + + + GnuPG + GnuPG + + + + GnupgTab + + + Name + Nom + + + + + Description + Description + + + + Version + Version + + + + Checksum + Somme de contrôle + + + + Binary Path + Chemin binaire + + + + Components + Composants + + + + Directories + Annuaires + + + + Options + Options + + + + Directory Type + Type de répertoire + + + + Path + Chemin d'accès + + + Configurations + Configurations + + + + Component + Composant + + + + Group + Groupe + + + + Key + Clé + + + + Default Value + Valeur par défaut + + + + Value + Valeur + + + diff --git a/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.it_iT.ts b/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.it_iT.ts new file mode 100644 index 0000000..d35e0bb --- /dev/null +++ b/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.it_iT.ts @@ -0,0 +1,95 @@ + + + + + GTrC + + + GnuPG + GnuPG + + + + GnupgTab + + + Name + Nome + + + + + Description + Descrizione + + + + Version + Versione + + + + Checksum + Somma di controllo + + + + Binary Path + Percorso binario + + + + Components + Componenti + + + + Directories + + + + + Options + + + + + Directory Type + + + + + Path + + + + Configurations + Configurazioni + + + + Component + + + + + Group + + + + + Key + Chiave + + + + Default Value + + + + + Value + Valore + + + diff --git a/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.zh_CN.ts b/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.zh_CN.ts index 1f068c5..be9bc55 100644 --- a/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.zh_CN.ts +++ b/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.zh_CN.ts @@ -1,3 +1,91 @@ - + + + GTrC + + + GnuPG + GnuPG + + + + GnupgTab + + + Name + 名称 + + + + + Description + 含义 + + + + Version + 版本 + + + + Checksum + 校验和 + + + + Binary Path + 二进制文件路径 + + + + Components + 组件 + + + + Directories + 目录 + + + + Options + 选项 + + + + Directory Type + 目录类型 + + + + Path + 路径 + + + + Component + 组件 + + + + Group + + + + + Key + + + + + Default Value + 默认值 + + + + Value + + + + diff --git a/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.zh_TW.ts b/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.zh_TW.ts new file mode 100644 index 0000000..71ba20c --- /dev/null +++ b/src/m_gpg_info/ts/ModuleGnuPGInfoGathering.zh_TW.ts @@ -0,0 +1,95 @@ + + + + + GTrC + + + GnuPG + GnuPG + + + + GnupgTab + + + Name + 姓名 + + + + + Description + 描述 + + + + Version + 版本 + + + + Checksum + 校驗和 + + + + Binary Path + 二進制路徑 + + + + Components + 成分 + + + + Directories + + + + + Options + + + + + Directory Type + + + + + Path + + + + Configurations + 配置 + + + + Component + + + + + Group + + + + + Key + 鑰匙 + + + + Default Value + + + + + Value + 價值 + + + diff --git a/src/m_ver_check/CMakeLists.txt b/src/m_ver_check/CMakeLists.txt index 69464f8..c780a28 100644 --- a/src/m_ver_check/CMakeLists.txt +++ b/src/m_ver_check/CMakeLists.txt @@ -31,7 +31,7 @@ aux_source_directory(. MODULE_SOURCE_FILES) add_library(mod_ver_check SHARED ${MODULE_SOURCE_FILES}) # install dir -install(TARGETS mod_ver_check +install(TARGETS mod_ver_check LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/modules") # link sdk @@ -54,12 +54,15 @@ set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_AUTOUIC_SEARCH_PATHS} ${CMAKE_CURRENT_SOU # i18n set(LOCALE_TS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/ts) -set(TS_FILES "${LOCALE_TS_PATH}/ModuleVersionChecking.en_US.ts" - "${LOCALE_TS_PATH}/ModuleVersionChecking.de_DE.ts" - "${LOCALE_TS_PATH}/ModuleVersionChecking.fr_FR.ts" - "${LOCALE_TS_PATH}/ModuleVersionChecking.zh_CN.ts") +set(TS_FILES + "${LOCALE_TS_PATH}/ModuleVersionChecking.en_US.ts" + "${LOCALE_TS_PATH}/ModuleVersionChecking.de_DE.ts" + "${LOCALE_TS_PATH}/ModuleVersionChecking.fr_FR.ts" + "${LOCALE_TS_PATH}/ModuleVersionChecking.it_IT.ts" + "${LOCALE_TS_PATH}/ModuleVersionChecking.zh_CN.ts" + "${LOCALE_TS_PATH}/ModuleVersionChecking.zh_TW.ts") qt_add_translations(mod_ver_check - RESOURCE_PREFIX "/i18n" - TS_FILES ${TS_FILES} - SOURCES ${MODULE_SOURCE_FILES} - INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}) \ No newline at end of file + RESOURCE_PREFIX "/i18n" + TS_FILES ${TS_FILES} + SOURCES ${MODULE_SOURCE_FILES} + INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}) \ No newline at end of file diff --git a/src/m_ver_check/VersionCheckingModule.cpp b/src/m_ver_check/VersionCheckingModule.cpp index 6bb4f45..9185c9f 100644 --- a/src/m_ver_check/VersionCheckingModule.cpp +++ b/src/m_ver_check/VersionCheckingModule.cpp @@ -57,16 +57,7 @@ auto GFActiveModule() -> int { LISTEN("APPLICATION_LOADED"); LISTEN("CHECK_APPLICATION_VERSION"); - // load translations - QFile f( - QString(":/i18n/ModuleVersionChecking.%1.qm").arg(GFAppActiveLocale())); - if (f.exists() && f.open(QIODevice::ReadOnly)) { - auto f_n = f.fileName().toUtf8(); - FLOG_INFO("version checking module loading, locale: %1, path: %2", - GFAppActiveLocale(), f_n.data()); - auto b = f.readAll(); - GFAppRegisterTranslator(AllocBufferAndCopy(b), b.size()); - } + LOAD_TRANS("ModuleVersionChecking"); GFUIMountEntry(DUP("AboutDialogTabs"), QMapToMetaDataArray({{"TabTitle", GTrC::tr("Update")}}), 1, diff --git a/src/m_ver_check/ts/ModuleVersionChecking.de_DE.ts b/src/m_ver_check/ts/ModuleVersionChecking.de_DE.ts index 549b674..e9f23e2 100644 --- a/src/m_ver_check/ts/ModuleVersionChecking.de_DE.ts +++ b/src/m_ver_check/ts/ModuleVersionChecking.de_DE.ts @@ -4,7 +4,7 @@ GTrC - + Update Aktualisieren @@ -12,65 +12,65 @@ UpdateTab - + It is recommended that you always check the version of GpgFrontend and upgrade to the latest version. Es wird empfohlen, immer die Version von GpgFrontend zu überprüfen und auf die neueste Version zu aktualisieren. - + New versions not only represent new features, but also often represent functional and security fixes. Neue Versionen beinhalten nicht nur neue Funktionen, sondern stellen oft auch Funktions- und Sicherheitskorrekturen dar. - + Current Version Aktuelle Version - + : : - + Latest Version From Github Neueste Version von Github - + The current version is less than the latest version on github. - + Die aktuelle Versionsnunmmer ist kleiner als die neueste Version auf github. - - - + + + Please click - + Bitte klicken Sie - - - + + + Here - + Hier - - - + + + to download the latest stable version. - + um die neueste stabile Version herunterzuladen. - + This version has serious problems and has been withdrawn. Please stop using it immediately. - + Diese Version hat ernsthafte Probleme und wurde zurückgezogen. Bitte hören Sie sofort auf, sie zu verwenden. - + This version has not been released yet, it may be a beta version. If you are not a tester and care about version stability, please do not use this version. - + Diese Version wurde noch nicht veröffentlicht, möglicherweise handelt es sich um eine Beta-Version. Wenn Sie kein Tester sind und Ihnen Stabilität der Version wichtig ist, verwenden Sie diese Version bitte nicht. diff --git a/src/m_ver_check/ts/ModuleVersionChecking.en_US.ts b/src/m_ver_check/ts/ModuleVersionChecking.en_US.ts index 2795653..98193c7 100644 --- a/src/m_ver_check/ts/ModuleVersionChecking.en_US.ts +++ b/src/m_ver_check/ts/ModuleVersionChecking.en_US.ts @@ -4,7 +4,7 @@ GTrC - + Update @@ -12,63 +12,63 @@ UpdateTab - + It is recommended that you always check the version of GpgFrontend and upgrade to the latest version. - + New versions not only represent new features, but also often represent functional and security fixes. - + Current Version - + : - + Latest Version From Github - + The current version is less than the latest version on github. - - - + + + Please click - - - + + + Here - - - + + + to download the latest stable version. - + This version has serious problems and has been withdrawn. Please stop using it immediately. - + This version has not been released yet, it may be a beta version. If you are not a tester and care about version stability, please do not use this version. diff --git a/src/m_ver_check/ts/ModuleVersionChecking.fr_FR.ts b/src/m_ver_check/ts/ModuleVersionChecking.fr_FR.ts index 2795653..fff22ee 100644 --- a/src/m_ver_check/ts/ModuleVersionChecking.fr_FR.ts +++ b/src/m_ver_check/ts/ModuleVersionChecking.fr_FR.ts @@ -1,76 +1,76 @@ - + GTrC - + Update - + Mettre à jour UpdateTab - + It is recommended that you always check the version of GpgFrontend and upgrade to the latest version. - + Il est recommandé de toujours vérifier la version de GpgFrontend et de passer à la dernière version. - + New versions not only represent new features, but also often represent functional and security fixes. - - - - - Current Version - + Les nouvelles versions ne représentent pas seulement de nouvelles fonctionnalités, mais représentent également souvent des correctifs fonctionnels et de sécurité. + Current Version + Version actuelle + + + : - + : - + Latest Version From Github - + Dernière version de Github - + The current version is less than the latest version on github. - + La version actuelle est inférieure à la dernière version sur github. - - - + + + Please click - + Cliquez s'il vous plait - - - + + + Here - + Ici - - - + + + to download the latest stable version. - + pour télécharger la dernière version stable. - + This version has serious problems and has been withdrawn. Please stop using it immediately. - + Cette version a de sérieux problèmes et a été retirée. Veuillez cesser de l'utiliser immédiatement. - + This version has not been released yet, it may be a beta version. If you are not a tester and care about version stability, please do not use this version. - + Cette version n'est pas encore sortie, il s'agit peut-être d'une version bêta. Si vous n'êtes pas un testeur et que vous vous souciez de la stabilité de la version, veuillez ne pas utiliser cette version. diff --git a/src/m_ver_check/ts/ModuleVersionChecking.it_IT.ts b/src/m_ver_check/ts/ModuleVersionChecking.it_IT.ts new file mode 100644 index 0000000..06e6d8e --- /dev/null +++ b/src/m_ver_check/ts/ModuleVersionChecking.it_IT.ts @@ -0,0 +1,76 @@ + + + + + GTrC + + + Update + Aggiorna + + + + UpdateTab + + + It is recommended that you always check the version of GpgFrontend and upgrade to the latest version. + Si consiglia di controllare sempre la versione di GpgFrontend e di aggiornare all'ultima versione. + + + + New versions not only represent new features, but also often represent functional and security fixes. + Le nuove versioni non rappresentano solo nuove funzionalità, ma spesso rappresentano anche correzioni funzionali e di sicurezza. + + + + Current Version + Versione corrente + + + + : + : + + + + Latest Version From Github + Ultima versione da Github + + + + The current version is less than the latest version on github. + La versione corrente è inferiore all'ultima versione su github. + + + + + + Please click + Per favore clicca + + + + + + Here + Qui + + + + + + to download the latest stable version. + per scaricare l'ultima versione stabile. + + + + This version has serious problems and has been withdrawn. Please stop using it immediately. + Questa versione ha seri problemi ed è stata ritirata. Si prega di smettere di usarlo immediatamente. + + + + This version has not been released yet, it may be a beta version. If you are not a tester and care about version stability, please do not use this version. + Questa versione non è ancora stata rilasciata, potrebbe essere una versione beta. Se non sei un tester e ti interessa la stabilità della versione, non utilizzare questa versione. + + + diff --git a/src/m_ver_check/ts/ModuleVersionChecking.zh_CN.ts b/src/m_ver_check/ts/ModuleVersionChecking.zh_CN.ts index 2795653..89c4c16 100644 --- a/src/m_ver_check/ts/ModuleVersionChecking.zh_CN.ts +++ b/src/m_ver_check/ts/ModuleVersionChecking.zh_CN.ts @@ -4,73 +4,56 @@ GTrC - + Update - + 更新 UpdateTab - It is recommended that you always check the version of GpgFrontend and upgrade to the latest version. - + 建议您经常检查 GpgFrontend 的版本更新。 - New versions not only represent new features, but also often represent functional and security fixes. - + 新版本不仅代表新功能,而且通常代表功能和安全修复。 - Current Version - + 当前版本 - : - + - Latest Version From Github - + 来自 Github 的最新版本 - The current version is less than the latest version on github. - + 当前版本低于github上的最新版本。 - - - Please click - + 请点击 - - - Here - + 这里 - - - to download the latest stable version. - + 来下载最新的稳定版本。 - This version has serious problems and has been withdrawn. Please stop using it immediately. - + 此版本存在严重问题,已经被召回。请立即停止使用。 - This version has not been released yet, it may be a beta version. If you are not a tester and care about version stability, please do not use this version. - + 此版本尚未发布,可能是测试版。如果您不是测试人员并且关心版本稳定性,请不要使用此版本。 diff --git a/src/m_ver_check/ts/ModuleVersionChecking.zh_TW.ts b/src/m_ver_check/ts/ModuleVersionChecking.zh_TW.ts new file mode 100644 index 0000000..22246fc --- /dev/null +++ b/src/m_ver_check/ts/ModuleVersionChecking.zh_TW.ts @@ -0,0 +1,76 @@ + + + + + GTrC + + + Update + 更新 + + + + UpdateTab + + + It is recommended that you always check the version of GpgFrontend and upgrade to the latest version. + 建議您經常檢查 GpgFrontend 的版本併升級到最新版本。 + + + + New versions not only represent new features, but also often represent functional and security fixes. + 新版本不僅代表新功能,而且通常代表功能和安全修復。 + + + + Current Version + 當前版本 + + + + : + : + + + + Latest Version From Github + 來自 Github 的最新版本 + + + + The current version is less than the latest version on github. + 當前版本低於github上的最新版本。 + + + + + + Please click + 請點擊 + + + + + + Here + 這裡 + + + + + + to download the latest stable version. + 下載最新的穩定版本。 + + + + This version has serious problems and has been withdrawn. Please stop using it immediately. + 此版本存在嚴重問題,已撤回。請立即停止使用。 + + + + This version has not been released yet, it may be a beta version. If you are not a tester and care about version stability, please do not use this version. + 此版本尚未發布,可能是測試版。如果您不是測試人員並且關心版本穩定性,請不要使用此版本。 + + +