New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i18n - Browser preference language should have priority over system language #1137
Comments
|
The question may sound stupid, but what exactly do you mean with
As explained in the documentation that you linked above, the navigator.browserLanguage in IE reflects the language of the operating system. This might in many cases represent an "explicit preference" of the user, but it might also express the choice of a company administrator that doesn't care (or know) about user preferences. Not sure how UI5 should differentiate between the two cases. From my perspective one can argue for both orders of precedence. So at the end it is a "go left or right" thing. The language settings done in the browser are more obviously reflecting a user choice, but unfortunately, IE does not expose them via Javascript API (as also explained in the above documentation).
Eh, no. |
|
OK Well I tried setting a fixed language in the app (without the get parm method) but have not been able to succeeed:
|
|
Your variants 1 and 3 should have worked, variant 2 has a different meaning. It restricts the backend requests for i18n texts to the given list of languages (so if you specify "en" there and your locale setting is en_GB, UI5 will ask the server only for messagebundle_en.roperties, but not for message bundle_en_GB.properties). How did the variants 1 and 3 fail? |
|
@codeworrior If I use data-sap-ui-language="en", it should also propagade this language to the SAP Gateway system or not? |
|
Yes, the OData models (v1,v2 and v4) should do so if no higher prioritised way of specifying the language is used (URL parameter would override the script tag attribute, a runtime call to sap.ui.getCore().getConfiguration().setLanguage() would override all other configs). [Update] I should mention that "propagate" for the models means: set the "Accept-Language" header. The logon to the systems (and therefore the SY-LANGU) AFAIK depend only on the logon process. That logon process is not under UI5 control and uses what you specify in the logon page. |
|
I think my issue is related to #639 Although I set the language to EN and it works (because EN is the only bundle I have) the data returned from the backend is still in another locale (because in the request I can see Accept-Language: nl-BE or others). |
|
Hello piejanssens, can you please share your code and steps to reproduce with us? From the discussions above i can see that some steps were tried but i cannot give further advice without the actual app coding. As you can see from the documentation, the language is determined in the following order: "OpenUI5 has the notion of a current language. It is determined from the following sources of information. The sources are ordered increasingly by priority and the last available user language/locale wins:
https://openui5.hana.ondemand.com/#docs/guide/91f21f176f4d1014b6dd926db0e91070.html Kind Regards, |
|
Hi @Michadelic, It's pretty straightforward. I put data-sap-ui-language="en" in the bootstrap attributes: For now I only have a single i18n file: Because the app is now hard coded to use 'EN' I expect to get this language passed to the backend in the sy-langu variable. However here I see another user language like 'F' or 'N'. |
|
I've created a internal incident 1770165099. You can check its status on GitHub |
|
Hey @piejanssens As already mentioned by @codeworrior:
Therefore I am closing this one. Please use the SAP Support in case you still have issues. |
window.navigator.language "nl-BE"
window.navigator.userLanguage "nl-BE"
window.navigator.browserLanguage "en-US"
A user with an explicit preference for "en-US" expects this language to be used over whatever system language/region settings he might have. However according to the following documentation this is not the case and the window.navigator.browserLanguage is only second to last considered for setting the language of the UI5 app:
https://help.sap.com/saphelp_uiaddon10/helpdata/en/91/f21f176f4d1014b6dd926db0e91070/content.html
We notice the same behavior in angular.js, is this a leftover from angular in UI5?
The text was updated successfully, but these errors were encountered: