Problems with Open-Source Downloads read and

Multi language support for Qml based Qt GUI

  • Hi All,

    I am new to Qt, I ve run the arrowpad, hellotr and i18N examples provided with my Qt 5.7 and understood the concept involved in the translations.

    Creating a .ts and .qm file and using QtLinguist to update/release the binary's provide the relevant strings and using QTranslator, but when I tried to use the same for a .qml based window it doesn't seems like generating the tag in .ts.

    Can somebody explain me the concept which I have to look for translating a text string in .qml based language?

  • Hello @suneelkv,
    Did you had

    SOURCES += <pathToYourQmlFiles>/*.qml 

    to your .pro file?

    Are you using qsTr(" ") for your text in your .qml files?

  • Thanks Julien,

    Just now found this, thanks...
    Also when I add this .qml in the .pro the files are getting added twice in the project view directory.
    as they are already added as
    FeatureModel.qml \

    Should I need to remove the DISTFILES in .pro to exclude the addition twice?

  • @suneelkv,

    I think you must keep DISTFILES as it intended for another purpose

    lupdate scan throught SOURCES (and RESSOURCES?) files to extract text to translate. That's why you add .qml files using lupdate_only.

    Nevertheless lupdate_only allow qmake to ignore thoses files for compilation but they still appears in QtCreator inside the Sources folder of your project view directory, even if they are not sources files.

Log in to reply