Qt blackberry retranslate.onLanguageChanged isn';行不通
我的应用程序不能正常工作 这是我的密码Qt blackberry retranslate.onLanguageChanged isn';行不通,qt,c++11,blackberry-10,Qt,C++11,Blackberry 10,我的应用程序不能正常工作 这是我的密码 Label { // The label text is set using the qsTr() function to support translation. // and Retranslate.onLanguageChanged will force the string to update // if language change happens while the app is run
Label {
// The label text is set using the qsTr() function to support translation.
// and Retranslate.onLanguageChanged will force the string to update
// if language change happens while the app is running.
text: qsTr("hello world") + Retranslate.onLanguageChanged
// The label text style.
textStyle.base: SystemDefaults.TextStyles.BigText
textStyle.color: Color.create("#085861")
}
及
以下项目工作正常
我认为我的源代码和link项目的源代码是完全相同的
但是我的项目,翻译方法不起作用……你需要更具体一点,它是如何起作用的。预期的输出是什么,它产生了什么。您有一个.ts文件吗?这与C++11无关,因为当我构建bb项目时,BlackBerry10不支持C++11,qml text->hello world。在我的设备->中,文本“hello world”是用韩语翻译的。但当我构建项目时,翻译方法不起作用。“hello world”上印的是“hello world”…我是一个非常愚蠢的人。我发现了一个问题。我必须检查翻译文件夹。谢谢
void ApplicationUI::onSystemLanguageChanged() {
QCoreApplication::instance()->removeTranslator(mTranslator);
QString localeString = QLocale().name();
QString fileName = QString("FirstProject_%1").arg(localeString);
if (mTranslator->load(fileName, "app/native/qm")) {
QCoreApplication::instance()->installTranslator(mTranslator);
}
}