Translating Qt Quick applications
The procedure of translating a Qt Quick application is similar to a Qt Widgets application. We'll walk through the process with another example application.
Create a new Qt Quick application project and name it Internationalization_QML. The generated main.qml file has already added a qsTr() function for us. The contents may differ slightly in a later version of Qt Creator and (or) Qt Library. However, it should look similar to this one:
import QtQuick 2.3
import QtQuick.Controls 1.2
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("&Open")
onTriggered: console.log("Open action triggered");
}
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
}
}
}
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
}
}Now, let's edit the Internationalization_QML.pro...