cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 and the arabic language

karim_mohamed2
Participant
0 Kudos

Hello Gurus

i'm trying to build a simple ui that contains Arabic characters i'm building the views in JavaScript but the problem is i can not display the Arabic characters in the screen it displays like the image attached

i googled and i found that there is a .properties file that could be used but i cant figure how to use it

any help would be appreciated

thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

former_member182329
Participant
0 Kudos

Hi Karim,

             The language can be changed by adding a new file ending with ".properties" (example messageBundle_ar.properties) in your ui5 application under web content folder.

And add the field values you want use in arabic in that file.In this case i am adding a DetailTitle variable to be used as my heading in my sample page as arabic.

DetailTitle=\u0627\u062E\u062A\u0628\u0627\u0631 \u0639\u0646\u0648\u0627\u0646

The above corresponding Arabic language  value for the variable  DetailTitle was obtained by using Google translate.

             Then either in the controller file of your respective view or in your component.js file (if it is a fiori application) add the following code

// create root view

  oView = sap.ui.view({

  id : "app",

  viewName : "sap.ui.demo.mysampleApp",

  type : "JS",

  viewData : { component : this }

  });

var langModel = new sap.ui.model.resource.ResourceModel({

  bundleUrl : "i18n/messageBundle.properties"

  });

  oView.setModel(langModel,"i18n");

In your design page where you want to add your Arabic text.Use the { } sign to point the variable declared in your message bundle file in your project.Use the below format.

<Page title="{i18n>DetailTitle}" id="det">

To change the language call the URL with "?sap-ui-language=AR"  parameter

The output will be in Arabic language. Similarly if you specify the Arabic language to a Form layout title .Then the form layout will be automatically mirrored according to the RTL language layout for Arabic,as shown in the below screenshot

Hope it helps.

Regards,

Bince Mathew

Answers (1)

Answers (1)

Qualiture
Active Contributor
0 Kudos

Hi,

It depends a bit on how the Arabic text is saved in the first place, but in your HTML file, do you have a line like

    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>


in your head section?