Hi there,
I have tied the basic project in Qt Quick. Wizzard creates two qml files: main.qml and MainPage.qml. MainPage.qml is loaded as component in main.qml like this:
initialPage: MainPage {tools: toolBarLayout}
initialPage: MainPage {tools: toolBarLayout}
To copy to clipboard, switch view to plain text mode
now in MainPage.qml the text says obligatory :
text: qsTr('Hello world!')
text: qsTr('Hello world!')
To copy to clipboard, switch view to plain text mode
but this is not translating properly. I am sure that I have:
1. created properly ts translation file from both main.qml and MainPage.qml (using lupdate)
2. released qm file with linguist
3. loaded qm file into the translator and installed the translator in the main.cpp file
When I move the MainPage.qml snippet directly into main.qml code like this:
initialPage: Page {
id: mainPage
Text {
anchors.centerIn: parent
text: qsTr('Hello world!')
color: platformStyle.colorNormalLight
font.pixelSize: 20
}
tools: toolBarLayout
}
initialPage: Page {
id: mainPage
Text {
anchors.centerIn: parent
text: qsTr('Hello world!')
color: platformStyle.colorNormalLight
font.pixelSize: 20
}
tools: toolBarLayout
}
To copy to clipboard, switch view to plain text mode
the "Hello world!" is translated correctly. It seem only in loaded QML components the qsTr function does not look up properly in translator.
Any quesses? Thanks.
Bookmarks