Cannot Translate ListElement "name" Variables
Solved
QML and Qt Quick
-
Hello all,
I am trying to translate my qt application for first time. Everything does OK, but only ListElement's wont translate. Part of code that I am trying to translate:id: leftMenu model:tmodel } ListModel{ id: tmodel ListElement{ name: QT_TR_NOOP("Left Window") st:"LeftWindow" } ListElement{ name: QT_TR_NOOP("Right Window") st:"RightWindow" } } Text { text: qsTr(tmodel.get(0).name); }
When I run lupdate, it shows only ones with the QT_TR_NOOP("").
If I edit qsTr code as,Text { text: qsTr("hello"); }
It returns a qsTr on QT Linguist. I guess, it means, "tmodel.get(0).name" does not return a string value.
What can I do guys? -
@closx in you ListElement items, replace
QT_TR_NOOP()
withqsTr()
and remoteqsTr()
from the text item.Something like this
ListModel{ id: tmodel ListElement{ name: qsTr("Left Window") st:"LeftWindow" } ListElement{ name: qsTr("Right Window") st:"RightWindow" } } Repeater { model:tmodel Text { text: name } }
Perhaps you need to update your translation file.