diff options
author | saturneric <[email protected]> | 2024-07-29 00:30:41 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-07-29 00:30:41 +0000 |
commit | 4e7f67812edd688f30e54f48517b3e16c5887553 (patch) | |
tree | 70ab7c4b256647fabbe8d76c892083284d4a8ebd /include | |
parent | fix: remove dependency of assuan (diff) | |
download | Modules-4e7f67812edd688f30e54f48517b3e16c5887553.tar.gz Modules-4e7f67812edd688f30e54f48517b3e16c5887553.zip |
feat: improve modules translation
Diffstat (limited to 'include')
-rw-r--r-- | include/GFModuleCommonUtils.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
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); |