Legacy Knowledge Base
Published Jun. 30, 2025

Understanding the 'locales.enabled' property and the Instance Settings language configuration

Written By

Jose L. Bango

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

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 the locales.enabled property is used as a fallback. See language.jsp#L74-L96:
    • String[] currentLanguageIds = PrefsPropsUtil.getStringArray(
      company.getCompanyId(), PropsKeys.LOCALES, StringPool.COMMA, PropsValues.LOCALES_ENABLED);
      where PropsKeys.LOCALES is the preference key (i.e., the instance setting's name) and PropsValues.LOCALES_ENABLED is the default value (i.e., the value from the locales.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

Did this article resolve your issue ?

Legacy Knowledge Base