diff options
author | Alexander Golubev <fatzer2@gmail.com> | 2024-02-07 08:03:16 +0300 |
---|---|---|
committer | TDE Gitea <gitea@mirror.git.trinitydesktop.org> | 2024-03-03 17:14:21 +0000 |
commit | 18a8b8d43577941388fa40666641f628860d6f7a (patch) | |
tree | 6a8235e35bfceb4d28911820af24cf4fa6a2c920 /kxkb/x11helper.cpp | |
parent | 1fea8982fd2f256273989956d962a3daa848041f (diff) | |
download | tdebase-18a8b8d43577941388fa40666641f628860d6f7a.tar.gz tdebase-18a8b8d43577941388fa40666641f628860d6f7a.zip |
kxkb: utilize a translations provseided by xkeyboard-config
xkeyboard-config package comes with a message catalogue of its own to
translate locale, keyboard model and xkb option names. It would be
easier and more robust to utilize it instead of redoing all
translation in-house.
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
Diffstat (limited to 'kxkb/x11helper.cpp')
-rw-r--r-- | kxkb/x11helper.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/kxkb/x11helper.cpp b/kxkb/x11helper.cpp index 2663bf4d4..90e29d9e2 100644 --- a/kxkb/x11helper.cpp +++ b/kxkb/x11helper.cpp @@ -8,6 +8,8 @@ #include <tqregexp.h> #include <kdebug.h> +#include <kstandarddirs.h> +#include <tdelocale.h> #include <X11/Xlib.h> #include <X11/Xatom.h> @@ -214,25 +216,12 @@ X11Helper::loadRules(const TQString& file, bool layoutsOnly) { // workaround for empty 'compose' options group description if( rulesInfo->options.find("compose:menu") && !rulesInfo->options.find("compose") ) { - rulesInfo->options.replace("compose", "Compose Key Position"); + rulesInfo->options.replace("compose", I18N_NOOP("Compose Key Position")); } } for(TQDictIterator<char> it(rulesInfo->options) ; it.current() != NULL; ++it ) { - // HACK 2023/06/01 some descriptions in xkb rule files have "< >" in place - // of an actual key name, both in *.lst and *.xml files - TQString descFix = TQString::null; - if (it.currentKey().contains("lsgt_switch")) { - descFix = TQString(it.current()).replace("< >", "LSGT"); - } - else if (it.currentKey().startsWith("compose:102")) { - descFix = TQString(it.current()).replace("< >", "102"); - } - if (!descFix.isNull()) { - rulesInfo->options.replace(it.currentKey(), tqstrdup(descFix.ascii())); - } - // Add missing option groups TQString option(it.currentKey()); int columnPos = option.find(":"); @@ -403,3 +392,13 @@ bool X11Helper::areSingleGroupsSupported() { return true; //TODO: } + +void X11Helper::initializeTranslations() { + // TDE is usually installed into some non-standard prefix and by default system-wide locale + // dirs are not considered when searching for gettext message catalogues, so we have to add + // it explicitly. +#ifdef WITH_XKB_TRANSLATIONS + TDEGlobal::dirs()->addResourceDir("locale", XKB_CONFIG_LOCALE_DIR); + TDEGlobal::locale()->insertCatalogue("xkeyboard-config"); +#endif +} |