Skip to Content

Implementing labels using the i18n (internationalization) features of SAPUI5

0 %
Implementing labels using the i18n (internationalization) features of SAPUI5
// Explore More Tutorials

Implementing labels using the i18n (internationalization) features of SAPUI5


Utilize the i18n framework in SAPUi5 to extract "hard-coded" strings in your app and maintain them in a single file.

You will learn

In the previous tutorials you added some labels to the details view by inserting a title="xxx" XML snippet into an ObjectAttribute element. In this tutorial, you will extract those strings to the file (which you just used to insert the currency symbol) and insert a reference to them in place of the string literals in your app. The appearance of the app will not change, but having the strings in one place will make the app easier to maintain, and will enable the support of different languages and locales (which you will do as part of this series). The three labels you will work with in this tutorial are:

  • Product ID
  • Units In Stock
  • Units On Order

Step 1: Add properties

To begin, open the northwind > i18n > file and insert the three lines below.

label_ProductID=Product ID
label_UnitsInStock=Units In Stock
label_UnitsOnOrder=Units On Order
Step 2: Add references

Following the same pattern used for the currency example: {i18n>key}, the three references you will use are in the Detail.view.xml file are:

  • {i18n>label_ProductID}
  • {i18n>label_UnitsInStock}
  • {i18n>label_UnitsOnOrder}

Edit the Detail.view.xml file to replace the hard-coded title strings with the references above. Your file should look like this:

Modified Detail.view.xml file
Step 3: Save and run

Save your changes and reload the preview tab or run the app. The app should look the same, but the implementation is will simplify the support of other languages.

Modified Detail.view.xml file

Next Step:

Next Steps


Back to top