summaryrefslogtreecommitdiffstats
path: root/kxkb
diff options
context:
space:
mode:
Diffstat (limited to 'kxkb')
-rw-r--r--kxkb/kcmlayout.cpp20
-rw-r--r--kxkb/kcmmisc.cpp1
-rw-r--r--kxkb/kxkb.cpp1
-rw-r--r--kxkb/rules.cpp9
-rw-r--r--kxkb/rules.h4
-rw-r--r--kxkb/x11helper.cpp27
-rw-r--r--kxkb/x11helper.h2
7 files changed, 40 insertions, 24 deletions
diff --git a/kxkb/kcmlayout.cpp b/kxkb/kcmlayout.cpp
index fb4d5d063..f9fbf3c59 100644
--- a/kxkb/kcmlayout.cpp
+++ b/kxkb/kcmlayout.cpp
@@ -36,6 +36,7 @@
#include "pixmap.h"
#include "kcmmisc.h"
#include "kcmlayoutwidget.h"
+#include "x11helper.h"
#include "kcmlayout.h"
#include "kcmlayout.moc"
@@ -105,6 +106,7 @@ LayoutConfig::LayoutConfig(TQWidget *parent, const char *name)
m_rules(NULL),
m_forceGrpOverwrite(false)
{
+ X11Helper::initializeTranslations();
TQVBoxLayout *main = new TQVBoxLayout(this, 0, KDialog::spacingHint());
widget = new LayoutConfigWidget(this, "widget");
@@ -244,7 +246,7 @@ void LayoutConfig::initUI() {
const char *hkOpt = tqstrdup(TQString("grp:" + (*hk)).ascii());
const char *hkDesc = allOptions[hkOpt];
if (hkDesc != 0) { // the option exists
- widget->comboHotkey->insertItem(i18n(hkDesc));
+ widget->comboHotkey->insertItem(XkbRules::trOpt(hkDesc));
}
}
widget->comboHotkey->insertItem(i18n("None"));
@@ -315,7 +317,7 @@ void LayoutConfig::initUI() {
foundGrp = true;
}
- OptionListItem *item = m_optionGroups[i18n(optionKey.latin1())];
+ OptionListItem *item = m_optionGroups[optionKey];
if (item != NULL) {
OptionListItem *child = item->findChildItem( option );
@@ -686,25 +688,25 @@ TQWidget* LayoutConfig::makeOptionsTab()
{
if( it.currentKey() == "ctrl" || it.currentKey() == "caps"
|| it.currentKey() == "altwin") {
- parent = new OptionListItem(listView, i18n( it.current() ),
+ parent = new OptionListItem(listView, XkbRules::trOpt( it.current() ),
TQCheckListItem::RadioButtonController, it.currentKey());
OptionListItem *item = new OptionListItem(parent, i18n( "None" ),
TQCheckListItem::RadioButton, "none");
item->setState(TQCheckListItem::On);
}
else if (it.currentKey() == "grp") {
- parent = new OptionListItem(listView, i18n(it.current()),
+ parent = new OptionListItem(listView, XkbRules::trOpt(it.current()),
TQCheckListItem::RadioButtonController, it.currentKey());
parent->setSelectable(false);
OptionListItem *item = new OptionListItem(parent, i18n("None"),
TQCheckListItem::CheckBox, "grp:none");
}
else {
- parent = new OptionListItem(listView, i18n( it.current() ),
+ parent = new OptionListItem(listView, XkbRules::trOpt( it.current() ),
TQCheckListItem::CheckBoxController, it.currentKey());
}
parent->setOpen(true);
- m_optionGroups.insert(i18n(it.currentKey().local8Bit()), parent);
+ m_optionGroups.insert(it.currentKey(), parent);
}
}
@@ -724,10 +726,10 @@ TQWidget* LayoutConfig::makeOptionsTab()
text = text.replace( "Cap$", "Caps." );
if ( parent->type() == TQCheckListItem::CheckBoxController
|| key.startsWith("grp:"))
- new OptionListItem(parent, i18n(text.utf8()),
+ new OptionListItem(parent, XkbRules::trOpt(text),
TQCheckListItem::CheckBox, key);
else
- new OptionListItem(parent, i18n(text.utf8()),
+ new OptionListItem(parent, XkbRules::trOpt(text),
TQCheckListItem::RadioButton, key);
}
}
@@ -1333,7 +1335,7 @@ extern "C"
//these seem to be new in XFree86 4.4.0
I18N_NOOP("Shift with numpad keys works as in MS Windows.");
- I18N_NOOP("Special keys (Ctrl+Alt+<key>) handled in a server.");
+ I18N_NOOP("Special keys (Ctrl+Alt+&lt;key&gt;) handled in a server.");
I18N_NOOP("Miscellaneous compatibility options");
I18N_NOOP("Right Control key works as Right Alt");
diff --git a/kxkb/kcmmisc.cpp b/kxkb/kcmmisc.cpp
index 6c7caa36e..c23b3cf6c 100644
--- a/kxkb/kcmmisc.cpp
+++ b/kxkb/kcmmisc.cpp
@@ -48,6 +48,7 @@
#include "kcmmisc.h"
#include "kcmmiscwidget.h"
+#include "x11helper.h"
#include <X11/Xlib.h>
KeyboardConfig::KeyboardConfig (TQWidget * parent, const char *)
diff --git a/kxkb/kxkb.cpp b/kxkb/kxkb.cpp
index 6a90aa0dd..34ed19334 100644
--- a/kxkb/kxkb.cpp
+++ b/kxkb/kxkb.cpp
@@ -68,6 +68,7 @@ KXKBApp::KXKBApp(bool allowStyles, bool GUIenabled)
m_tray(NULL),
kWinModule(NULL)
{
+ X11Helper::initializeTranslations();
m_extension = new XKBExtension();
if( !m_extension->init() ) {
kdDebug() << "xkb initialization failed, exiting..." << endl;
diff --git a/kxkb/rules.cpp b/kxkb/rules.cpp
index 442a78c00..ab89b4f17 100644
--- a/kxkb/rules.cpp
+++ b/kxkb/rules.cpp
@@ -79,4 +79,11 @@ TQString XkbRules::getLayoutName(LayoutUnit layout) const {
fullName += " (" + layout.variant + ")";
}
return fullName;
-} \ No newline at end of file
+}
+
+TQString XkbRules::trOpt(TQString opt) {
+ // xkeyboard-config's translation is generated directly from the xml and has some querks
+ // like sustitution for the '<' and '>'. We will have to workaroung those manually:
+ TQString translated = i18n(opt.replace("<", "&lt;").replace(">", "&gt;").utf8());
+ return translated.replace("&lt;", "<").replace("&gt;", ">");
+}
diff --git a/kxkb/rules.h b/kxkb/rules.h
index e7a6e8840..0a68f3dbf 100644
--- a/kxkb/rules.h
+++ b/kxkb/rules.h
@@ -3,6 +3,7 @@
#include <tqstring.h>
#include <tqdict.h>
+#include <tqstringlist.h>
#include <tqmap.h>
#include "layoutunit.h"
@@ -21,6 +22,9 @@ public:
TQString getLayoutName(LayoutUnit layout) const;
+ /// A helper to translate option description
+ static TQString trOpt(TQString opt);
+
protected:
void loadRules(TQString filename, bool layoutsOnly=false);
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
+}
diff --git a/kxkb/x11helper.h b/kxkb/x11helper.h
index 042fb4ce5..8315dc446 100644
--- a/kxkb/x11helper.h
+++ b/kxkb/x11helper.h
@@ -3,6 +3,7 @@
#include <tqdict.h>
#include <tqstringlist.h>
+#include <tqwindowdefs.h>
struct RulesInfo {
@@ -36,6 +37,7 @@ public:
static bool areLayoutsClean() { return m_layoutsClean; }
static bool areSingleGroupsSupported();
+ static void initializeTranslations();
};
#endif /*X11HELPER_H_*/