[Interest] How to properly translate an application?

Jérôme Godbout godboutj at amotus.ca
Thu Jun 7 18:36:24 CEST 2018


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.ca at qt-project.org> on behalf of Mark Gaiser <markg85 at gmail.com>
Sent: June 7, 2018 11:26 AM
To: rainer_wiesenfarth at 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_wiesenfarth at trimble.com<mailto:rainer_wiesenfarth at trimble.com>> wrote:

On Thu, Jun 7, 2018 at 2:22 PM, Mark Gaiser <markg85 at gmail.com<mailto:markg85 at 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 at qt-project.org<mailto:Interest at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180607/a675356c/attachment.html>


More information about the Interest mailing list