Issue
- There is a portal property to specify the locales that are enabled by default:
locales.enabled
. - However you can change that from
Control Panel > Instance Settings > Localization
. - How that portal property and that instance setting interact with each other?
Environment
- Liferay DXP 7.3
Resolution
- Liferay leverages the property value until it's overwritten by the instance setting. Once a change is made, it's persisted in the database and subsequent access to the language selection panel will be determined by the database value.
- To determine enabled locales,
PrefsPropsUtil
is invoked to retrieve the corresponding preference from the database. If no preference is found, the default value specified in thelocales.enabled
property is used as a fallback. See language.jsp#L74-L96:-
String[] currentLanguageIds = PrefsPropsUtil.getStringArray(
where
company.getCompanyId(), PropsKeys.LOCALES, StringPool.COMMA, PropsValues.LOCALES_ENABLED);PropsKeys.LOCALES
is the preference key (i.e., the instance setting's name) andPropsValues.LOCALES_ENABLED
is the default value (i.e., the value from thelocales.enabled
property) returned when no database record is found.
-
- Also, as you can see in the above snippet, the approach is slightly different for 'available' locales. The code directly accesses the
locales
property and the retrieved value is then processed accordingly.
Additional Information
会員限定記事
Liferay エンタープライズ サブスクリプションをお持ちのお客様は1500件を超えるベストプラクティス、トラブルシューティング、その他のソリューション記事を閲覧できます。ログインすると、記事全体をお読みいただけます。
ログイン