KAcceleratorManager, Kirigami and accelerator key translations

Shinjo Park kde at peremen.name
Sat Apr 25 12:28:51 BST 2020


Hello,

I have reported Bug #420488 and got to know that similar bugs have been 
reported such as #407386, #417467. This was supposed to be fixed by #406035 but 
the fix was not effective at all.

Inspired by this, I have checked how other languages are translating the 
accelerator keys and found this pattern:
- Languages using Latin, Cyrillic, Arabic (except Uyghur), Hebrew, Greek and 
some Indic scripts are placing accelerator keys within the translated message
- Languages using another Indic scripts, C/J/K are placing accelerator keys 
separate from the message (example: "New &Window" is translated into "નવી વિન્ડો 
(&W)", "ಹೊಸ ಕಿಟಕಿ(&W)", "新建窗口(&W)", "නව කවුළුව (&W)", "새 창(&W)" in Gujarati, 
Kannada, Chinese Simplified, Sinhala, and Korean respectively)
- Source: https://l10n.kde.org/dictionary/compare-translations.php?
package=applications&filename=dolphin.po&compare=New+%26Window

To kde-i18n-doc: if I made some wrong assumptions, please correct them.

For the languages in the first list, I think KAcceleratorManager and Kirigami 
should work fine. For the languages in the second list, there are two problems: 
no accelerator keys are allocated in QWidget based applications when the 
translated string does not contain Latin alphabet within the string or 
followed by an ampersand. Also non typeable characters are misallocated 
accelerator keys in Kirigami based applications.

As a workaround for Kirigami displaying weird accelerator keys, I think 
extending the range of non-typeable characters to include abovementioned 
scripts can at least non-typeable accelerator keys from appearing:
https://cgit.kde.org/kirigami.git/tree/src/mnemonicattached.cpp#n92 However, 
this won't solve the problem that these strings won't have an accelerator key.

For the another problem of having no accelerator keys, I can think of two 
workarounds:
- Manually specify accelerator keys within the translated string. However, 
just by looking PO files I don't know which strings form a group, and some UI 
string which is supposed to have an accelerator key lacks of an accelerator 
key followed by an ampersand, so the suitable accelerator key has to be 
manually examined by translators.
- Allocate accelerator keys based on the original English string: That's what 
used by the current translations. I am not sure whether this workaround is 
possible in KDE Frameworks implementation (both KWidgetsAddons and Kirigami) 
wise or should be addressed in Qt.

I am looking for further opinions and inputs.

Best,
Shinjo




More information about the Kde-frameworks-devel mailing list