Qt: Translation issues with displaying hotkey assignments
Whilst preparing an MR with a bunch of hotkey related work, I noticed what seems to be an issue constructing the displayed text in the hotkey editor table wrt. translation. I have not included a fix for this in that work, and I do not know whether or not I will attempt to address it.
Each row of the table contains: the action name; the normal key assignment; the global key assignment. The latter two are displayed translated, whilst an untranslated copy is held behind the scenes in the data attribute (the value stored in the config).
The problem is that to get the displayed text, the entire option value string is simply put through qfut()
, yet, can we be certain that translations will actually contain translations for all possible values? I expect not.
We must consider:
- The basic/common set of single key/combination assignments.
- Different ordering. E.g.
"Ctrl+Shift+s"
vs."Shift+Ctrl+s"
. - Multi-key/combination assignments, such as is the default on Linux, e.g.
"Space\tMedia Play Pause"
forKEY_PLAY_PAUSE
.
It seems that we at the very least need to split the string up by tab to split into individual key/combination assignments, convert each individually, and then recombine for the final display text, fixing the latter concern.
Possibly we need a function that takes each key/combination, identifies what modifiers are present, performs translation on each modifier and the base key, and then combines those fragments in same or fixed order.