Skip to Content
0

How to call multiple i18n files dynamically based on user action in UI5?

Apr 10 at 09:59 AM

38

avatar image

Hi all,

As, you all know Internationalization (i18n) files help us adapt our running application to our desired local language in UI5. Now, I have a UI5 application which consists of two i18n files (one for English & the other for Arabic). I also have a switch control which on turning to 'EN' should display the application in English language and if to 'AR' should display the application in Arabic Language. Initially, all the fields and their values get displayed in English. Now if I switch to Arabic, it doesn't get displayed in Arabic.Can someone help me with this?

You can download the sample code here in this link:

Sample code for i18n

i18nfile.png (17.5 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Kiran Padarthi
Apr 10 at 10:23 AM
1

Hi Ramya,

There are two changes you need to make:

1. Change your file name i18n_AR.properties to i18n_arproperties.

2. In your state validation please use below code:

if (state) {

sap.ui.getCore().getConfiguration().applySettings({

language: "en" });

} else {

sap.ui.getCore().getConfiguration().applySettings({

language: "ar" });

}

As it is arabic language screen will turn to right to left.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hi Kiran,

Thanks for ur reply. As you said, the screen turns right to left when I switch over the button.

But I also need the text to be displayed in arabic language if, I store arabic values in 18n_arproperties file .

For example, the Plant Group text should be changed to its arabic language like مجموعة النباتات if i store this value in lab1 variable.

Do u have any idea on this?

0

Hi,

I have attached the screen shot below. When screen turn left to right then click on info, then you will see the arabic text which is maintained in i18n file.

arabic.jpg (37.3 kB)
1

Hi Kiran,

I misunderstood the file name to be i18n_arproperties since you mentioned like that in your previous comment.When I changed it to i18n_ar.properties I was able to get it in Arabic Language.

Thanks for your reply. It was really helpful.

0