获取特定语言环境的 i18n 文本
Get i18n text for specific locale
我有两个 i18n 模型:
i18n_en.properties
英语
i18n_ar.properties
阿拉伯语
我的目标是获取 仅英语 的相应文本,尽管检测到语言。
以下函数根据自动语言检测获取文本。
fGetText: function(sText) {
var oBundle = this.getView().getModel("i18n").getResourceBundle();
return oBundle.getText(sText);
},
有没有办法检索特定语言的文本?
您可以使用 ResourceBundle.create
方法通过给定语言环境参数创建新的。
ResourceBundle.create({
url : "i18n/i18n.properties",
locale : "en",
async: true,
})
ResouceBundle
here 的文档。
我有两个 i18n 模型:
i18n_en.properties
英语i18n_ar.properties
阿拉伯语
我的目标是获取 仅英语 的相应文本,尽管检测到语言。
以下函数根据自动语言检测获取文本。
fGetText: function(sText) {
var oBundle = this.getView().getModel("i18n").getResourceBundle();
return oBundle.getText(sText);
},
有没有办法检索特定语言的文本?
您可以使用 ResourceBundle.create
方法通过给定语言环境参数创建新的。
ResourceBundle.create({
url : "i18n/i18n.properties",
locale : "en",
async: true,
})
ResouceBundle
here 的文档。