Skip to Content
0

How to add another i18n file in manifest.json and get it initialized in application?

Sep 05, 2017 at 07:53 AM

90

avatar image

Hi,

I am creating an app locally, where in i have provided a switch control to switch between English and German language. As of now, English language text is loaded in the application. But i want to change the language of static texts in application on change of switch control state.

I am able to capture switch control's change state.

How to define i18n_de.properties in manifest.json and also call it in application based on switch state?

Below are the screenshots of various files:

Component.js:

Manifest json part 1:

Manifest json part 2:

Project json:

View controller js:

I want to reinitialize all the static texts in application, if the switch state is changed to false to German language using i18n_de.properties file.

View xml:

Please advise how to work on this.

Thanks,

Saurabh.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

saurabh vakil Sep 05, 2017 at 04:25 PM
1

The SAPUI5 framework reads the container's (browser in which the app runs) language-locale setting and then initializes and reads the relevant i18n file with fallback to the default i18n.properties file. I don't think that just by clicking on a switch at run-time the language of the app can be changed. If you are running the app from the FLP then you would have to reload the page and append the sap-language URL parameter with the value DE and then your app will automatically (assuming your project's i18n folder has a i18n_de.properties file) display static texts in German.

Share
10 |10000 characters needed characters left characters exceeded
Saurabh Singh Sep 11, 2017 at 06:15 AM
0

Since i am using this app locally, i created two resource models for English and German languages. I am binding German static texts explicitly from resource bundle on change of switch state. I cannot refresh page to change language as it would remove all existing data on that page.This is the only way i found to handle different languages (2).

Share
10 |10000 characters needed characters left characters exceeded