How to update a standard button text in SAP Fiori Elements in a RAP app?

I recently had the requirement to change the text of a standard button like “Edit” in the object page.

We have the following button, and we want to change it from “Bearbeiten” to “Abschliessen”.

Create a folder structure as follow:

When using a List report, then use ListReport instead of ObjectPage.

In our i18n.properties file of that folder, we have defined the following key value pair:

C_COMMON_OBJECT_PAGE_EDIT=Abschliessen

Now it depends if you are using an OData V2 app or an OData V4 app?

OData V4

Here it is quite easy to enhance the i18n by simply put in the correct target the property enhanceI18n and set the correct i18n properties file.

manifest.json

"targets": {
  "POList": {
    "type": "Component",
    "id": "POList",
    "name": "sap.fe.templates.ListReport",
    "options": {
      "settings": {
        "contextPath": "/PO",
        "variantManagement": "Page",
        "hideFilterBar": true,
        "navigation": {
          "PO": {
            "detail": {
              "route": "POObjectPage"
            }
          }
        },
        "controlConfiguration": {
          "@com.sap.vocabularies.UI.v1.LineItem": {
            "tableSettings": {
              "type": "ResponsiveTable",
              "selectionMode": "Single"
            }
          }
        }
      }
    },
    "controlAggregation": "beginColumnPages",
    "contextPattern": ""
  },
  "POObjectPage": {
    "type": "Component",
    "id": "POObjectPage",
    "name": "sap.fe.templates.ObjectPage",
    "options": {
      "settings": {
        "editableHeaderContent": false,
        "contextPath": "/PO",
        "enhanceI18n": "i18n/ObjectPage/PO/i18n.properties",
        "controlConfiguration": {
          "@com.sap.vocabularies.UI.v1.LineItem": {
            "tableSettings": {
              "type": "ResponsiveTable",
              "selectionMode": "Single"
            }
          },

OData V2

In an OData V2 Fiori App, we need to add a new model with the path to the correct i18n.properties file.

manifest.json

...
"models": {
  "i18n": {
    "type": "sap.ui.model.resource.ResourceModel",
    "settings": {
      "bundleName": "myapp.i18n.i18n"
    }
  },
  "": {
    "dataSource": "mainService",
    "preload": true,
    "settings": {
      "operationMode": "Server",
      "autoExpandSelect": true,
      "earlyRequests": true
    }
  },
  "i18n|sap.suite.ui.generic.template.ObjectPage|PO": {
    "type": "sap.ui.model.resource.ResourceModel",
    "uri": "i18n/ObjectPage/PO/i18n.properties"
  },
  "@i18n": {
    "type": "sap.ui.model.resource.ResourceModel",
    "uri": "i18n/i18n.properties"
  }
},
...

Sources:
https://community.sap.com/t5/technology-q-a/change-text-for-button-in-fiori-elements/qaq-p/568371
https://sapui5.hana.ondemand.com/#/topic/b8cb649973534f08a6047692f8c6830d


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ad blocker detected

We have detected that you are using extensions to block ads. Please support us by disabling your ad blocker.

Powered By
100% Free SEO Tools - Tool Kits PRO