[Interest] qsTr in components

Kristoffersen, Even (NO14) Even.Kristoffersen at Honeywell.com
Mon May 23 15:23:50 CEST 2016


Yup,

translator is my C++ object exposed to QML, and refresh is the signal.
Not sure why it's not working, I'll try to create a minimal example and see if it's still an issue there.

This is with Qt 5.6 btw.

-Even

-----Original Message-----
From: Jason H [mailto:jhihn at gmx.com] 
Sent: 23. mai 2016 15:17
To: Jason H <jhihn at gmx.com>
Cc: Kristoffersen, Even (NO14) <Even.Kristoffersen at Honeywell.com>; interest at qt-project.org
Subject: Re: [Interest] qsTr in components



> Sent: Monday, May 23, 2016 at 9:14 AM
> From: "Jason H" <jhihn at gmx.com>
> To: "Kristoffersen, Even (NO14)" <Even.Kristoffersen at Honeywell.com>
> Cc: "interest at qt-project.org" <interest at qt-project.org>
> Subject: Re: [Interest] qsTr in components
>
> 
> 
> > Sent: Monday, May 23, 2016 at 8:31 AM
> > From: "Kristoffersen, Even (NO14)" <Even.Kristoffersen at Honeywell.com>
> > To: "interest at qt-project.org" <interest at qt-project.org>
> > Subject: [Interest] qsTr in components
> >
> > Hello all,
> > 
> > I've played around a bit with an approach inspired by http://wiki.qt.io/How_to_do_dynamic_translation_in_QML .
> > 
> 
> If you are following along, the example a few months ago, it works. I'm using it, and in components too.
> 
> You need to add a C++ object, and expose it to QML.
> 
> it has a proeprty: Q_PROPERTY(QString null READ getNull NOTIFY languageChanged )
> signals:
> 	void languageChanged(QString language);
> 
> When you change the language, you emit that signal, that causes the re-evaluation of all string with the langMgr.null added.

EDIT: Not sure why I used C++, it should be possible with QML. I think I used C++ so I could start the download of languages before the QML engine started. (My langmgr manages the languages, including downloads updates)



More information about the Interest mailing list