Sapui5 如何扩展翻译?
我扩展了一个标准的fiori应用程序,我还想扩展i18n。Sapui5 如何扩展翻译?,sapui5,Sapui5,我扩展了一个标准的fiori应用程序,我还想扩展i18n。 扩展应用程序的结构如下所示: 在Component.js文件中,我注意到扩展名: this.i2d.eam.pmnotification.create.s1.Component.extend("i2d.eam.pmnotification.create.s1.ZEAM_NTF_CRES1_EXT.Component", { metadata: { manifest: "json", config
扩展应用程序的结构如下所示: 在Component.js文件中,我注意到扩展名:
this.i2d.eam.pmnotification.create.s1.Component.extend("i2d.eam.pmnotification.create.s1.ZEAM_NTF_CRES1_EXT.Component", {
metadata: {
manifest: "json",
config: {
"sap.ca.i18Nconfigs": {
bundleName: "i2d.eam.pmnotification.create.s1.ZEAM_NTF_CRES1_EXT.i18n.i18n"
}
}
}
});
但是文本仍然没有被翻译
i18n.properties
文件的内容:
ext.createNotification=Create notification
ext.createOrder=Create order
以及使用转换的按钮:
<Button press="onCreateWithOrder" text="{i18n>ext.createOrder}" />
<Button press="onSave" text="{i18n>ext.createNotification}"/>
我做错了什么?在使用老式的“脚手架”名称空间(sap.ca.scfld)翻译应用程序时,我只成功地使用了“sap.ca.i18nConfigures”
我敢打赌,你正在扩展的应用程序不是基于它的
然后,尝试将以下调用添加到Component.js文件中
init: function() {
UIComponent.prototype.init.apply(this, arguments);
var oModel = new sap.ui.model.resource.ResourceModel({
bundleUrl: "../pathToYourParentApp/i18n/i18n.properties"
});
oModel.enhance({
bundleUrl: "i18n/i18n.properties"
});
this.setModel(oModel, "i18n");
sap.ui.getCore().setModel(oModel, "i18n");
}
另外,请检查示例