Legacy Knowledge Base
Published Sep. 10, 2025

Define Configurable Variable to manage values across Liferay sites in Liferay pages

Written By

Koustuv Dhani

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

  • How variables to be used across the site, primarily for Fragments, to assign dynamic values that can be changed and propagated from a single place.

Environment

  • Liferay DXP 7.4 U4+
  • Liferay DXP Quarterly Release

Resolution

NOTE: The following resolution requires customization and should only be implemented at the discretion of your team. Liferay Support will not be able to assist with designing or implementing customizations.

  • In Liferay DXP, it's common to have certain values such as company names, taglines, contact numbers, or any reusable text that are used repeatedly across multiple sites and pages via Liferay fragment, Web comtent and in custom module JSP.
  • To address this challenge, Liferay provides a powerful feature called Language Override, which can be effectively used to define configurable variables and manage values consistently across your instance.
  • To define and use a configurable variable using Liferay’s Language Override feature, follow the steps below:
  • Start your Liferay DXP server and Navigate to the Control Panel and go to Configuration > Language Override.

  • Click on the "Add" button to create a new language override.

  • In the form that appears:

    • Enter the Language Key, which will act as the configurable variable (e.g., custom.key).

    • Set the Translation value, which is the text you want to store in en-US field.
  • Copy the language key created and save the configuration.

  • Now language key can be used in various Liferay components to dynamically insert the stored value.

Here are some examples of how to reference the key in different types of Liferay components:

  • In Fragments:

    [@liferay.language key="custom.key"/]
  • In Web Content Templates and Lifray Themes:

    <@liferay.language key="custom.key"/>
  • In JSP Files:

    <@liferay.language key="custom.key"/>
  • Once implemented, the configured value will be dynamically rendered in the component. Any future changes to the value in the Language Override settings will be reflected immediately across all instances where the key is used.

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base