【发布时间】:2015-04-14 15:57:35
【问题描述】:
我有一个代码可以检查来自服务器的响应并根据收到的信息显示消息框。我有 2 种语言的这些消息(用户在登录时选择一种语言)。 这是一个例子:
if(sResponse == 'IDfail'){
sap.m.MessageBox.alert
("{i18nResourceModel>idnotnine}",
{icon: sap.m.MessageBox.Icon.ERROR,
title: "{i18nResourceModel>error}"}
);
}
这里是i18n模型声明(当然是在我使用模型之前声明的):
var oResourceModel = new sap.ui.model.resource.ResourceModel
({bundleUrl: "i18n/i18n.properties", bundleLocale: "en"});
sap.ui.getCore().setModel(oResourceModel, "i18nResourceModel");
我有 2 个.properties 文件:i18n.properties(英语)和 i18n_iw.properties(希伯来语)。
奇怪的是消息框的title 翻译正确,但我看到的不是消息本身,而是文本:“i18nResourceModel>idnotnine”。
之前运行良好,但我不知道发生了什么。
什么可能导致此问题,我该如何解决?
谢谢。
【问题讨论】:
-
.properties 文件中是否有 idnotnine=一些文本?
-
@jumpifzero 当然,我愿意。此外,如果我将
"{i18nResourceModel>idnotnine}"作为title的文本,我确实看到了正确的消息。
标签: javascript internationalization sapui5