SAPUI5: How to Use the i18n Model in a Fragment or Dialog?

🏷️

This is about how to use i18n in a fragment or dialog in SAPUI5.

It’s pretty straightforward.

So if you want to translate fragments or dialogs, this is for you.

Let’s get started!

How to Use i18n in a Dialog in SAPUI5?

You can use the i18n model in a fragment or dialog too—you just add the fragment or dialog to the dependent aggregation of the respective XML view.

For example:

<!-- in your XML view -->
...

  <Button text="Dialog" press="onPress"/>
 
...
// in your controller
...
   
onPress: function() {
      
  if (!this.oDialog) {         
     
    this.oDialog = new Dialog();     
 
  }
 
     
  // add the dialog to the view's dependent aggregation
  this.getView().addDependent(this.oDialog);     
  this.oDialog.open(); 
 
}

...

After you added the fragment or dialog to the dependent aggregation of the view, the internalization i18n model is available for them as well.

🔥 The Complete SAP ERP Modules Overview Infographic in PDF Format (Free)

Leave this field blank

Plus, don't miss future infographics and free SAP tips and insights that are available only to newsletter subscribers. 

📚 More Articles

Leave a Comment

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

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu

🚀 Upgrade Your Work Experience With Altwork (Welcome to the Future)

altwork_picture_2

The Altwork Station redefines how people interact with their computers by allowing the computer screen and keyboard to physically conform to support the user’s body while working long hours on a computer.

Submission received, thank you!

Close Window