I have my fist Ubuntu Touch QML app running, and I am willing to translate it. Whenever I use a UI string in the qml files, I was careful to use i18n.tr("my text").
So now I need to generate the pot, po, and mo files. I found this question and a relevant answer, even if I'm not sure this is up to date (for example, the screenshot taken by zeokila does not correspond to what I see in my QtCreator version...?).
Maybe a comprehensive howto exists ?
So my question is specifically this:
how can strings in ListElement properties be taken into account by xgettext when generating the pot file ?
I cannot use i18n.tr here, as this results in a "ListElement: cannot use script for property value" error.
With plain Qt qsTr() and lupdate, you can use QT_TR_NOOP() to make these strings visible to lupdate.
How to do it with xgettext ?
The only workaround for the "ListElement: cannot use script for property value" error that I know is to rely on the dynamicRoles property:
Creating the ListElement that way allow you to call
i18n.tr()
andxgettext
correctly adds it to the pot file: