When installing Liferay Digital Experience Platform (DXP) 7.0 or any Liferay Portal version, portal administrators have the option to leverage any of the translations that come with the default installation. This article outlines the best way/s to correct these translations.
Resolution
First of all, check if the language that you need to correct is among Liferay's officially supported languages. You can verify which languages are supported by searching for the following in the portal.properties file:
Liferay DXP 7.0
Any languages that are listed as "locales.enabled" = supported
# Specify the locales that are enabled by default.
#
locales.enabled=ca_ES,zh_CN,nl_NL,en_US,fi_FI,fr_FR,de_DE,iw_IL,hu_HU,ja_JP,pt_BR,es_ES
Because of the implementation of OSGi and modularization, when overriding language properties in hooks and modules, you have to specify the desired locale(s) in the module, not in the portal-ext.properties. The information in portal.properties remains useful as a reference and for the core platform.
Liferay Portal 6.2 EE
Any languages that are listed as "locales.enabled" = supported
# Specify the locales that are enabled by default.
#
locales.enabled=ca_ES,zh_CN,nl_NL,en_US,fi_FI,fr_FR,de_DE,iw_IL,hu_HU,ja_JP,pt_BR,es_ES
Liferay Portal 6.1 EE GA3 and Below
Any languages that are not listed in the Beta languages = supported. If the language is supported and your subscription allows, please open a support ticket in Help Center.
Liferay Portal 6.2 EE Only
If the language you're interested in is not officially supported, or if you have a Basic/Limited subscription, you can easily update, correct and extend your portal's translations through the following steps:
- Create a new Liferay Project in Liferay Developer Studio and select the Hook as the Plugin Type
- Once it’s done, create a new folder under
docroot/WEB-INF/srccalled, for example, content, and create the appropriatelanguage.propertiesfile, in this example this is:Language_en.properties. - 3) Refer to this file in your
liferay-hook.xml:<hook><language-properties>content/Language_en.properties</language-properties></hook>Please note: if you'd like to overwrite/customize the English translation, you need to apply your changes in
Language_en.propertiesfile. If only the Language.properties file is changed it won't be applied, because the Language.properties file is the default language key file to which the portal falls back if no specific language key is present. - Now, you’re ready to customize your portal messages. To follow in our example, open the original
Language_en.propertiesfile and find the attributes that you'd like to change. Write the new strings in your hook's language file.
For reference, consult the official Liferay documentation on Sharing Language Keys Between Portlets and on Overriding Language Properties Using a Hook.
Additional Information
Liferay Portal 6.0, 6.1 and 6.2 Only
Any language that is not officially supported is maintained by Liferay's community, with each language having a designated Translation Leader. You are welcome to contribute yourself, and submit translations for the latest Liferay Portal version, by using the Pootle system or by sending pull requests to the corresponding Translation Leader in GitHub.
Attached, there are two sample hooks. One is a hook which can be deployed to all Liferay Portal 6.0 versions. In this sample, the Pages portlet's display name in Control Panel is changed from Pages to Community Pages
There is also a second hook which can be deployed to all Liferay Portal 6.1 versions. In this sample, the Site Settings portlet's display name in Control Panel is changed from Site Settings to My Company Settings.