Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Translation - Model Data


  • Qt Champions 2017

    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, emit dataChanged).


  • Qt Champions 2017

    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.


  • Lifetime Qt Champion

    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.


  • Qt Champions 2017

    @SGaist thanks for reply. This is what we are doing as of now. Just wanted to check whether we have any other option.


Log in to reply