Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-11 Thread Jason H
Ooops. I concretely missed the `virtual`. > Sent: Friday, March 11, 2016 at 11:15 AM > From: "Julien Cugnière" > To: "Jason H" > Cc: "interest@qt-project.org Interest" > Subject: Re: [Interest] Dynamic translations for mobile apps at runtim

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-11 Thread Julien Cugnière
QTranslator::translate is virtual. Its documentation even says "If you need to programatically insert translations into a QTranslator, this function can be reimplemented." :-) So you can create a QTranslator based class that returns translations from your own list if the QM file found nothing. Jul

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-11 Thread Jason H
So we had a great thread about "dynamic translations" Its in and working well. (Thanks everyone) And while I have a slick update procedure for adding dictionaries at run time, I am wondering about adding translation strings at runtime? Here's what's happening: - App is in a language (Now, can b

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-09 Thread Jason H
Great clarification, thanks Andre! > Sent: Wednesday, March 09, 2016 at 2:24 AM > From: "André Somers" > To: interest@qt-project.org > Subject: Re: [Interest] Dynamic translations for mobile apps at runtime? > > > > Op 08/03/2016 om 23:21 schreef Jason H: >

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-08 Thread André Somers
-project.org" Subject: Re: [Interest] Dynamic translations for mobile apps at runtime? qApp->installTranslator add a new translation into the stack. Does not remove the old ones. So, if the user click 10 times: Italian - English - Italian - English … etc… you got ten translator into the memor

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-08 Thread Jason H
org" > Subject: Re: [Interest] Dynamic translations for mobile apps at runtime? > > qApp->installTranslator add a new translation into the stack. Does not remove > the old ones. > So, if the user click 10 times: Italian - English - Italian - English … etc… > you got ten tran

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-08 Thread Gianluca
qApp->installTranslator add a new translation into the stack. Does not remove the old ones. So, if the user click 10 times: Italian - English - Italian - English … etc… you got ten translator into the memory. That’s because the translation is searched into the order on which the translator are in

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-08 Thread Jason H
I'm wondering why you load all those languages and then remove all but one of them? Being a mobile app, I have to be somewhat conscience of memory foot print. Do you see anything wrong with: void Backend::selectLanguage( QString language ) { translator = new QTranslator(this); translator

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-04 Thread Jérôme Godbout
ut" >> *To:* "Julien Cugnière" >> *Cc:* "interest@qt-project.org" >> *Subject:* Re: [Interest] Dynamic translations for mobile apps at >> runtime? >> I test it out, it work as long as the function is a direct function >> access,

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-04 Thread Jérôme Godbout
hursday, March 03, 2016 at 5:31 PM > *From:* "Jérôme Godbout" > *To:* "Julien Cugnière" > *Cc:* "interest@qt-project.org" > *Subject:* Re: [Interest] Dynamic translations for mobile apps at runtime? > I test it out, it work as long as the function i

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-03 Thread Dmitry Volosnykh
You will have the same overhead whenever the text to translate changes. If it is static during the application life cycle then this should not be an issue either. On Thu, Mar 3, 2016 at 11:41 PM Jérôme Godbout wrote: > Nice, I didn't knew about "-tr-function-alias", indeed this seem like the > r

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-03 Thread Jason H
What if you did "-tr-function-alias qsTr=MySingleton.myqsTr" ?    Sent: Thursday, March 03, 2016 at 5:31 PM From: "Jérôme Godbout" To: "Julien Cugnière" Cc: "interest@qt-project.org" Subject: Re: [Interest] Dynamic translations for mobile apps at runt

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-03 Thread Jérôme Godbout
I test it out, it work as long as the function is a direct function access, you can't use module call like MySingleton.myqsTr("My String") // don't work, lupdate does get this one myqsTr("My String") // work Could have put the function into it's own javascript .pragma library and just import it i

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-03 Thread Jérôme Godbout
Nice, I didn't knew about "-tr-function-alias", indeed this seem like the right thing to do. Will try this out. About speed, for the number of time you use the change language during runtime, it doesn't really matter, if it take a few ms more. Thanks for the tips! On Thu, Mar 3, 2016 at 2:37 PM,

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-03 Thread Julien Cugnière
2016-03-03 18:50 GMT+01:00 Jérôme Godbout : > We did the same thing into Qml, we have a C++ singleton equivalent to your > backend, that select the current language files and emit the QString > property changed. > qsTr("String to convert") + I18n.revaluate > > I wish they made underlying hook to re

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-03 Thread Jérôme Godbout
We did the same thing into Qml, we have a C++ singleton equivalent to your backend, that select the current language files and emit the QString property changed. qsTr("String to convert") + I18n.revaluate I wish they made underlying hook to revaluate the qsTr() with a signal connected like if the

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-03 Thread Jason H
Absolutely fantastic!!! THANKS! > Sent: Thursday, March 03, 2016 at 11:04 AM > From: "Gian Maxera" > To: "Jason H" > Cc: "interest@qt-project.org" > Subject: Re: [Interest] Dynamic translations for mobile apps at runtime? > > Hello Jason,

Re: [Interest] Dynamic translations for mobile apps at runtime?

2016-03-03 Thread Gian Maxera
Hello Jason, I got the same issue some times ago … and I found that it’s possible to use the translation feature of Qt … that seems static, but it’s not. And localize.biz it’s a wonderful site that allow you to modify Qt translation files directly on web and download the updated one. The trick t