SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
β€’ Open full site

Add Localization to Luigi UI5 Micro-Frontend

Enable your micro-frontend to be displayed in multiple languages using the Luigi localization features.

Overview

🎓 beginner 5 min. User InterfaceBeginnerJavascript

You will learn

  • βœ”How to add localization to your UI5 micro-frontend
Johannes Doberer J Johannes Doberer November 30, 2025
Created by December 10, 2024
Contributors

Prerequisites

Steps

Step 1 Update current language with Luigi Client
β€”

In this step, you will add a function to get the current language from Luigi Client and then update it, so that the language of the UI5 micro-frontend can be changed accordingly.

  1. Open the ui5-mf/webapp/controller/Main.controller.js file and replace its content with the code below:

    JavaScript
    sap.ui.define(["luigi/ui5/controller/BaseController"], function (Controller) {
        "use strict";
    
        return Controller.extend("luigi.ui5.controller.Main", {
            onInit: function (Controller) {
                const oModel = new sap.ui.model.json.JSONModel();
    
                oModel.loadData("../model/products.json");
                this.getView().setModel(oModel);
                //This has been added - to update the current language 
                const updateCurrentLanguage = () => {
                    const currentLanguage = LuigiClient.uxManager().getCurrentLocale();
                    sap.ui.getCore().getConfiguration().setLanguage(currentLanguage);
                }
                //This has been added - listener for language changes 
                LuigiClient.addInitListener(updateCurrentLanguage);
            },
    
            onListItemPress: function (oEvent) {
                const id = oEvent.getSource().getBindingContext().getProperty("id");
                // Getting trasnlated text for the modal text title
                const title = this.getView().getModel("i18n").getResourceBundle().getText("ModalText");
    
                LuigiClient.linkManager().openAsModal('/home/products/' + id, { title: title, size: 'm' });
            }
        });
    });
Step 2 Add files with multi-language content
+
Step 3 Add default language to index.html
+
Step 4 Provide translation in UI5
+
Step 5 Run completed app
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 5
1. Update current language with Luigi Client 2. Add files with multi-language content 3. Add default language to index.html 4. Provide translation in UI5 5. Run completed app

Learn more →