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") ...

Get Qt 5 Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.