[Interest] Dynamic translations for mobile apps at runtime?

Jason H jhihn at gmx.com
Fri Mar 11 17:08:16 CET 2016


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 be more than English)
- User logs in, the user has a language on their profile
- That profile is selected on the UI
- The server sends content in that language (JSON)

The reason for this is some of the content is user-configurable, and as a result, the server has it's own internal translation tables. Currently, I can toggle the UI language, but the server delivered content stays the same. It would be nice if I could retranslate both. However the lupdate/lrelease workflow won't work someone suggested using localise.biz, but then we have to coordinate the strings, and we want to have the web UI without dependencies. My backend team won't be happy, but we (really just me) . I could then:
My options are:
a. could write a binary for direct DB tables-to-QM file translation, load the server translations into a QTranslator and have it just work, 
or
b. use some QTranslator API to dynamically add translations at runtime.

Both don't seem possible as there is no non-private API to write QM files, and there is no API to alter the QTranslator.

I'm hoping maybe the QM file format is just some kind of QMap? 







More information about the Interest mailing list