【发布时间】:2014-05-31 16:00:01
【问题描述】:
当运行lupdate 时,qml 文件中的qsTr 均不被识别。生成的 .ts 文件不包含任何翻译上下文。
$ lupdate -verbose App.pro
Updating 'translations/en.ts'...
Found 0 source text(s) (0 new and 0 already existing)
项目应该设置正确:
OTHER_FILES += \
content/main.qml
TRANSLATIONS += \
translations/en.ts
在 main.qml 中:
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("Open")
onTriggered: Qt.quit();
}
}
Menu {
title: qsTr("...")
MenuItem {
text: qsTr("About")
onTriggered: {
aboutApplicationDialog.open()
}
}
}
}
【问题讨论】:
标签: qt internationalization qml qt5 qt-linguist