i18n 模型不显示翻译文本

i18n model not displaying translated text

我有 i18n 属性 绑定到标签,但是当我尝试绑定 属性 时,它不起作用。

i18n_en

TABLE_ItemCateg=Item Category

view.xml

<Label text="{i18n>TABLE_ItemCateg}" />

它显示 "TABLE_ItemCateg" 而不是 "Item Category"

而在 i18n.properties 中,我没有保存任何数据。我还收到以下错误:

could not find any translatable text for key 'TABLE_ItemCateg' in bundle '../../sap/xyz_homepage/i18n/i18n.properties'

manifest.json

"models": {
  "i18n": {
    "type": "sap.ui.model.resource.ResourceModel",
    "settings": {
      "bundleName": "xyz_homepage.i18n.i18n"
    }
  }
}

定义

您必须将您的文本添加到您使用过的所有翻译文件中

i18n.properties

TABLE_ItemCateg=项目类别

i18n_en.properties

TABLE_ItemCateg=项目类别

用法

使用合适的模型

view.xml

text="{i18n>TABLE_ItemCateg}"