Translation - Model Data
-
I have QML Application. Using ListView. Model is in C++. Data to the model is filled from DB. I would like to publish the app in different languages.
How can I translate the model data to different languages ? Any ideas ?
-
What kind of data does the model contain? If it is always going to be from a fixed pool of possible data, you can manually register the strings using
QT_TRANSLATE_NOOP
.
Otherwise, you might consider using an online translation API and doing the translations on the fly from the model (return the English data first, and then once your API call is successful, emitdataChanged
). -
Thanks @shaan7 for the reply. It is not fixed set of data. So we kept QT_TRANSLATE_NOOP out our scope. Data keeps changing everybody 15 days. Data is pushed to DB & app fetches the data from DB & starts working. We have written our own modules to some translation. I was looking at alternative ways as well.
-
Hi,
You have everything in your database, you should also store all translations there un use a setting to determine which one the user wants for the application, then it's a matter of requesting the data for the right language.
-
@SGaist thanks for reply. This is what we are doing as of now. Just wanted to check whether we have any other option.