There are multiple different settings used to set the language preferences for our web pages. What language is finally used when a user visits the site?
- Liferay DXP 7.2
- Liferay DXP 7.1
- Liferay DXP 7.0
For Anonymous Users
- If the URL contains a language code (ie: /en, /es, etc...), the language used is retrieved from I18n Servlet defined in the web.xml.
- If the URL does not contain a language code, the language used is from the value of
Instance Settings > Default Languagebecause of the default portal property
locale.default.request=true is set in portal-ext.properties, Liferay will use preferred languages defined in the user's browser according to the configured order, selecting the first one available on the current site. For example, the user's browser has two preferred languages, Czech and Spanish. If your site's available languages do not include Czech, then Spanish is used. In the event that the browser only has one preferred language that is not available on your site (Czech, in this example) then it will jump directly to the Default Language defined in Instance Settings.
For Authenticated Users
- The language used is from the value set in the user's
Account Settings > Language.
- If the user visits a URL which contains a language code different from the preferred language set in Account Settings, a message will pop up informing the user the page is displayed in a different language and giving the following options:
- A link to redirect the user to the page which contains the language configured in the user's Account Settings.
- A link to directly change the Language preference in the user's Account Settings to the language used on the current page.
Please note that the language used is stored in the GUEST_LANGUAGE_ID of the browser cookies. Unless you delete them manually, it will be used for subsequent requests.