I just checkout the retranslate doc and I found this:
Note: Due to a limitation in the implementation, this function refreshes all the engine's bindings, not only those that use strings marked for translation. This may be optimized in a future release. Ouch! I will stick with my property changes for the time being. ________________________________ From: Interest <interest-bounces+godboutj=amotus...@qt-project.org> on behalf of Jérôme Godbout <godbo...@amotus.ca> Sent: June 11, 2018 9:07 AM To: EXT Artem Sidyakin; mark...@gmail.com Cc: Qt Interest Subject: Re: [Interest] How to properly translate an application? Note: For 5.10, you have to call QQmlEngine::retranslate()<http://doc.qt.io/qt-5/qqmlengine.html#retranslate> to make this work. Not sure this is needed for 5.11 as I haven't move on to 5.11 because of borken Qml MouseGesture, will have to try it out. But good to known this is now fixed. ________________________________ From: EXT Artem Sidyakin <artem.sidya...@qt.io> Sent: June 11, 2018 4:48 AM To: Jérôme Godbout; mark...@gmail.com Cc: Qt Interest Subject: Re: [Interest] How to properly translate an application? > For the Qml part I have all my qsTr(“My str to tr") + I18n.r where I18n is a > singleton and "r" is a property upon which I call the changed when I load a > new language There is no need for that since Qt 5.10 (QTBUG-15602). Although, OP asked about Qt 5.9, and there you still have to use this trick. Speaking about translating QML applications, I would also recommend this article: https://retifrav.github.io/blog/2017/01/04/translating-qml-app/ --- Artem Sidyakin > On 7 Jun 2018, at 18:36, Jérôme Godbout <godbo...@amotus.ca> wrote: > > I for one, use the .qm into my qrc file and then load it with QTranslator() > from my resource. The I add/remove it to the > QCoreApplication::instance()->installTranslator() or removeTranslator(). > > This might not be the best way to do it, but I can change my language at > runtime with it. I list the availbale language from my resource folder, then > user can select any, I load it and remove the previous one. For the Qml part > I have all my qsTr("My str to tr") + I18n.r where I18n is a singleton and > "r" is a property upon which I call the changed when I load a new language. I > work well. I did not made C++ translation with it, since my views are pure > Qml and my C++ keep models and controller only. > > Not sure it might help, but might give some idea. > > From: Interest <interest-bounces+godboutj=amotus...@qt-project.org> on behalf > of Mark Gaiser <mark...@gmail.com> > Sent: June 7, 2018 11:26 AM > To: rainer_wiesenfa...@trimble.com > Cc: Qt Interest > Subject: Re: [Interest] How to properly translate an application? > > On Thu, Jun 7, 2018 at 3:09 PM Rainer Wiesenfarth > <rainer_wiesenfa...@trimble.com> wrote: > > On Thu, Jun 7, 2018 at 2:22 PM, Mark Gaiser <mark...@gmail.com> wrote: > I have a windows desktop application (Qt 5.9 LTS) here that has Dutch and > English translations files (in .ts format) created with Qt Linguist. Any > strings in that file show up in the Qt UI just fine in the chosen language. > > But if i set the language to Dutch (operating system language is English) > then Qt's default buttons are still in English. Sure, they can be translated > on a case-by-case basis but i don't think that > should be needed. > > I don't think there is a problem with the .ts files as anything in there just > works in the UI. > But perhaps i missed a step? > > For a couple of languages, there are .qm files for Qt (search e.g. for > qt_de.qm). These contain the translations of Qt itself. Unfortunately, Dutch > seems to be not included here... > > The page http://wiki.qt.io/Qt_Localization may be useful for further > investigations. > > That seems like a good point to investigate further. > Thank you for the link! > > > Cheers, Rainer > > -- > Software Engineer | Trimble Imaging Division > Rotebühlstraße 81 | 70178 Stuttgart | Germany > Office +49 711 22881 0 | Fax +49 711 22881 11 > http://www.trimble.com/imaging/ | http://www.inpho.de/ > > Trimble Germany GmbH, Am Prime Parc 11, 65479 Raunheim > Eingetragen beim Amtsgericht Darmstadt unter HRB 83893, > Geschäftsführer: Dr. Frank Heimberg, Jürgen Kesper > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest