diff options
author | Alexander Golubev <fatzer2@gmail.com> | 2024-02-07 08:03:16 +0300 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2024-03-03 18:17:07 +0100 |
commit | 40879a72e313124001c9545060c48897e7440914 (patch) | |
tree | 300c602ba38b774be897e2201f06ff5341df0568 /kxkb/x11helper.cpp | |
parent | e56c1ff3b89f435479a3c74f7dce36772640a567 (diff) | |
download | tdebase-40879a72e313124001c9545060c48897e7440914.tar.gz tdebase-40879a72e313124001c9545060c48897e7440914.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>
(cherry picked from commit 18a8b8d43577941388fa40666641f628860d6f7a)
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 +} |