Solved 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?
-
Hi,
What OS are you running ?
-
On Windows.
-
Can you share the code where this is happening ?
-
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).
-
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_applicationC:\Qt\5.7\Src\qttranslations\translations
( around line 5577)<message> <location line="+7"/> <source>Copy &Link Location</source> <translation>Kopiér l&ink</translation> </message>
-
I will try it. Thanks.
-
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 EnglishQt
translations.Screenshot:
How to get English localization? Thanks.
-
@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. -
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 loadedQt
default language (in this case - Russian).Screenshot:
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 loadQt
source (English) translations. -
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 inmain.cpp
after it was loaded, then I can change to English at runtime in for exampleTest.cpp
. Thank you.