cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member200679
Participant
0 Kudos

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

saurabh_vakil
Active Contributor

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.

former_member200679
Participant
0 Kudos

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).