Localize default context menu for link labels



  • Hi! In my application I have some link labels, when I right click on them I get default OS context menu. It's only localized by Qt and this localization is not the same as my app localization. Is there a way to localize this menu? Thanks in advance.



  • The problem is, I don't code this menu. It manages by the system (OS) and localized by Qt. Any ideas how to localize it?


  • Lifetime Qt Champion

    Hi,

    What OS are you running ?



  • @SGaist

    On Windows.


  • Lifetime Qt Champion

    Can you share the code where this is happening ?



  • @SGaist

    I don't have access to this menu because I don't code it. It manages by the system.

    Screenshot:

    You can try it by right clicking on any link label on Windows OS. I want to localize it (if possible).


  • Qt Champions 2016

    @Cobra91151

    Hi
    Those texts are part of qt base languages.
    You can change the language by loading it in another translator than the one you are using for the app.
    https://wiki.qt.io/How_to_create_a_multi_language_application

    C:\Qt\5.7\Src\qttranslations\translations
    ( around line 5577)

       <message>
            <location line="+7"/>
            <source>Copy &amp;Link Location</source>
            <translation>Kopiér l&amp;ink</translation>
        </message>
    

    alt text



  • @mrjj

    I will try it. Thanks.



  • @mrjj

    I have changed code and now it loads localization the same as my app localization. Thank you.



  • Hi!

    I have found that qt_en.qm file doesn't contain any localization data, and it only 1 KB size. Other languages are fine. So when loading this file I don't get any English Qt translations.

    Screenshot:
    Qt localization folder (default)

    How to get English localization? Thanks.


  • Qt Champions 2016

    @Cobra91151 said in Localize default context menu for link labels:

    qt_en.qm

    Hi the english is the in the source so this file does not contain anything.
    I dont know if removing the translator will do it but its worth a shot.



  • @mrjj

    I have tried to remove translator but it doesn't work. When I load English localization, it loads only my en files, not qt. And MsgBox buttons and link label context menu still localized by previous loaded Qt default language (in this case - Russian).

    Screenshot:
    alt text

    I think the only way is to rewrite all MsgBox and translate all buttons text, load default Qt translation link label context menu (but it will not match with my app translation if it will be changed at runtime) or find a way to load Qt source (English) translations.



  • @mrjj

    I have figure it out. The problem was that I load Qt default translation file in main function and don't remove translator there. So when I remove translator in main.cpp after it was loaded, then I can change to English at runtime in for example Test.cpp. Thank you.


Log in to reply