Bug 407386 - Action shortcut default to "Alt+关" if not specified
Summary: Action shortcut default to "Alt+关" if not specified
Status: CONFIRMED
Alias: None
Product: frameworks-kirigami
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.57.0
Platform: Other Linux
: NOR normal
Target Milestone: Not decided
Assignee: Marco Martin
URL:
Keywords:
: 417467 420488 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-05-10 10:01 UTC by Guo Yunhe
Modified: 2021-10-13 12:51 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot of Discover (10.57 KB, image/jpeg)
2019-05-10 10:06 UTC, Guo Yunhe
Details
Alt accelerators (37.67 KB, image/png)
2019-09-19 14:59 UTC, Nate Graham
Details
Better automatic allocation (13.24 KB, image/png)
2021-10-13 12:50 UTC, ryunosuke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guo Yunhe 2019-05-10 10:01:13 UTC
SUMMARY


STEPS TO REPRODUCE

1. Have the following code:
---------------------------------------------
import org.kde.kirigami 2.0

Action {
    id: aboutAction
    iconName: "help-feedback"
    text: i18n("About")
}
---------------------------------------------
2. text is translated to "关于" in Chinese.

3. Mouse hover on the item, show a tooltip.

OBSERVED RESULT

The tooltip is "Alt+关", an invalid shortcut. Because you cannot find the key "关" in any keyboard.

EXPECTED RESULT

If shortcut property is not specified, it shouldn't generate a shortcut.

We cannot make sure every action begins with unique letters or even valid letters. If developers defined action shortcut with same letter, conflicts will happen.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Guo Yunhe 2019-05-10 10:06:03 UTC
Created attachment 119950 [details]
Screenshot of Discover

This is the example in Discover left drawer.
Comment 2 Nate Graham 2019-05-13 04:23:51 UTC
See also Bug 406035.
Comment 3 Marco Martin 2019-09-19 14:21:28 UTC
it's following the convention of qwidget applications.

how does work with shortcuts on normal apps, like kate, dolphin and what not?
Comment 4 Nate Graham 2019-09-19 14:23:20 UTC
in QWidgets apps, the alt accelerator is shown as a line under the appropriate character in the text, not as a tooltip that appears on hover. The same thing should happen here.
Comment 5 Marco Martin 2019-09-19 14:32:35 UTC
(In reply to Nate Graham from comment #4)
> in QWidgets apps, the alt accelerator is shown as a line under the
> appropriate character in the text, not as a tooltip that appears on hover.
> The same thing should happen here.

it does?
Comment 6 Marco Martin 2019-09-19 14:33:08 UTC
would be ok to restrict automatic shortcuts to standard latin? (then having to explicitly set one with a non latin string which can have a shortcut)
Comment 7 Nate Graham 2019-09-19 14:59:52 UTC
Created attachment 122728 [details]
Alt accelerators

I'm talking about the Alt-key accelerators in QWidgets apps (see attachment). Are we talking about the same thing?
Comment 8 Guo Yunhe 2019-09-19 15:35:17 UTC
Qt Widgets applications must specify Alt-key accelerators with "&". For example:

&Edit

And it can be translated in non-Latin languages:

编辑(&E)

But in Kirigami it just chooses the first character, no matter what it is.
Comment 9 Marco Martin 2019-09-20 09:06:44 UTC
in kirigami & is supported as well.
it also chooses the first available letter for those which don't have an &, which is the same thing happening in qwidget applications when are running under plasma
Comment 10 Patrick Silva 2020-02-18 17:27:43 UTC
*** Bug 417467 has been marked as a duplicate of this bug. ***
Comment 11 Guo Yunhe 2020-08-27 08:35:09 UTC
Here are a lot of complains from users. When they see these weird shortcut tooltips, they first blame translation team but it is not something we can control.

Here shouldn't be such a automatic shortcut generation. The tooltip should be used for more important information, not just for shortcut. It is against the knowledge we have for all Qt Widgets and QtQuick based applications. Shortcuts should only be enabled when the developer really mean to use it. And it should be visible for all translation teams.

The old good & syntax is a solid solution that has been trusted for 25 years. Please just keep it and nothing else.
Comment 12 Guo Yunhe 2020-08-27 08:36:37 UTC
*** Bug 420488 has been marked as a duplicate of this bug. ***
Comment 13 Shinjo Park 2020-08-27 18:54:02 UTC
(In reply to Marco Martin from comment #9)
> it also chooses the first available letter for those which don't have an &,
> which is the same thing happening in qwidget applications when are running
> under plasma

This does not work at all in some languages, this is basically what the bug report is about.

(In reply to Marco Martin from comment #6)
> would be ok to restrict automatic shortcuts to standard latin? (then having
> to explicitly set one with a non latin string which can have a shortcut)

Yes please. Also when if translators need to manually set an accelerator or shortcut key, please clearly mark that cases so translators can take care of that. Currently in QWidget application, no accelerator key will be assigned if the translated string contains no latin-1 character. This is also far from ideal.

I also wrote a report about that too: https://marc.info/?l=kde-frameworks-devel&m=158782004706664&w=2
Comment 14 ryunosuke 2021-10-13 12:50:37 UTC
Created attachment 142393 [details]
Better automatic allocation
Comment 15 ryunosuke 2021-10-13 12:51:49 UTC
This problem is the same for Japanese.

EXPECTED RESULT

If shortcut property is not specified, it is to automatically assign the same characters as in the source text.

As shown in the attached figure.(prev post)