cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OData language

jakob_steen-petersen
Contributor
2,705

Hi

Do we anywhere in the oData Class interface have the language property of the used webbrowser.

i mean - if uger has default language DE in user master, but uses en-EN in the browser, Can i check this anywhere or do i need to build it into all the Entityˋs where i need to fetch data for specific languages?

I.ex i could build a material list and need the text returned based on browser setting.

What is best practice?

Accepted Solutions (0)

Answers (2)

Answers (2)

leoirudayam
Product and Topic Expert
Product and Topic Expert
0 Likes

Maybe this helps you (https://github.com/SAP/openui5/issues/1137)?

Maybe you check also your supported locals:

"supportedLocales": ["dk", "en"],
mariusobert
Developer Advocate
Developer Advocate
0 Likes

Hi Jakob,

OData build on top of HTTP which is why you can use the header accept-language. This question here might also be helpful in case you want to set a default language.

jakob_steen-petersen
Contributor
0 Likes

Hi Marius

Thanx - basically it works. BUT: when i set the default language in the Browser it is ok. But i have done a small "trick" in order to provide the user with the posibility to change language for this application only.

Simply by using this code on Button Press (just a switch between DK and EN):

            var sCurrentLocale = sap.ui.getCore().getConfiguration().getLanguage();
           
            if (sCurrentLocale === "en_EN"){
                sCurrentLocale = "da_DK";
            } else {
                sCurrentLocale = "en_EN";
            }
            sap.ui.getCore().getConfiguration().setLanguage(sCurrentLocale);

But when switching in this way it seems like the accept-language is not changed?

Any ideas?

mariusobert
Developer Advocate
Developer Advocate
0 Likes

Mhhh. I'm afraid I don't know