Search code examples
sapui5

i18n model not displaying translated text


I have i18n property to bind to the label but when I try to bind the property, it does not work.

i18n_en

TABLE_ItemCateg=Item Category

view.xml

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

It displays "TABLE_ItemCateg" rather than "Item Category".

And in i18n.properties, I have no data saved. Also I receive below error:

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"
    }
  }
}

enter image description here


Solution

  • definition

    you have to add your text to all of your used translation files

    i18n.properties

    TABLE_ItemCateg=Item Category

    i18n_en.properties

    TABLE_ItemCateg=Item Category

    usage

    use the appropriate model

    view.xml

    text="{i18n>TABLE_ItemCateg}"