Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Qt. Access application ts file from JS code (context menu translated texts)

Status
Not open for further replies.

Diego Donate

Programmer
Jul 30, 2018
3
ES
Hi,

In my Qt application I have some .ts files for languages in my application resources, so I access translations with tr("") from a C++ class, and with qsTr("") from a QML file

I also have a WebEngineView + WebChannel, with a custom HTML file and JS files associated.

In this JS code, I have a custom context menu:
Using the 'build' callback, I can set a name dinamically every time my menu is open:

$(document).contextMenu({
selector: 'span.context-menu',
build: function($triggerElement, e){
return {
items: {
copy: { name: [text depending on the language]
...
My problem is how to access to my .ts files from this JS code. For example, I need context menu translated texts

Thanks in advance, Diego
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top