Legacy Knowledge Base
Published Jun. 30, 2025

Translating static texts with Fragments

Written By

Santhosh Kumar

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

  • Translating static text with the help of fragments and language overrides

Environment

  • Liferay DXP 7.4 [all updates]
  • Liferay DXP 2023.Q1
  • Liferay DXP 2024.Q1

Resolution

Step 1:

a) Navigate to Applications Menu -> Control Panel -> and click Instance Setting (under the Configuration tab).

b) Click on Localisation in the Platform Section.

c) Select the languages you like from the available languages in the Current field and click Save. 

 

Step 2:

a) Navigate to Applications Menu -> Control Panel -> and click Language Override (under the Configuration tab).

b) In the Language Override click the "New" button.

c) In the Language Key information, give a language key for the Static Text you wish to translate.

d) Now, enter the text you wish to use for English in the English field and translated texts in the other fields respectively, and click save.

Please note that the languages that are added in Step 1 will be listed here, so If want to add more languages, users need to first repeat Step 1.

e) Note down the language key given in the above step. 

 

Step 3:

a) Inside the HTML tag in the Fragment, add the

[@liferay.language key="your-static-text-language-key" /]

Replace the key within quotes for the respective static texts.  

b) Add a Language Selector Fragment to the pages that users wish to translate, then add the Fragments respectively and click publish.  

c) Now click on the Language selector fragment and select a language.

Observed Behavior: Upon completion, users should observe the translated static texts.

If certain texts remain untranslated, consider removing editable attributes in the fragment, such as data-lfr-editable-id and data-lfr-editable-type.

Here is a video for reference: Drive Link

Did this article resolve your issue ?

Legacy Knowledge Base