Liferay provides its ability to support multiple languages. It currently supports about 40 languages out of the box. In this blog we will see How to add a new language in Liferay 7. We will add “Gujarati” language in our example.

Environment Requirement

  • JDK 8
  • Eclipse
  • Liferay Portal

1) Web.xml (“${LIFERAY_HOME}\tomcat\webapps\ROOT\WEB-INF”)

Add new language in Liferay, it requires a servlet-mapping entry in web.xml. So we are modifying Liferay Portal’s web.xml file.

This step will activate the “Gujarati” language in Liferay.

2) Portal-ext.properties

We have configured servlet-mapping entry. Now we need to configure ‘locales’ property in portal-ext.properties.

By configuring the above property “Gujarati” language will be available in the Liferay portal.

  1. Restart Liferay server
  2. Go to the Control Panel Configuration Instance Settings.
  3. Click on “Localization”.
Add Custom Language Support To Liferay
  1. Move Gujarati language from available to current and click on save.
  2. Select Gujarati language as default language and click on save. Now our LIferay Portal’s default language is Gujarati.

3) Create resourceBundle module

Resource bundle module provides a way to add custom language key/value in Liferay Portal. You can create a resource bundle module for an existing language or custom language that you have added. Here we will create a resource bundle for ‘Gujarati’ language that we have added into the portal.

  1. Create module project and create class which extends ResourceBundle. Please take a look at the code below.

  1. Create “content” folder in “src/main/resources”.
  2. Create “language_gu_IN.properties” file in the content folder.

4) Add below language key/value in “language_gu_IN.properties”. Here we are adding gujarati translations for sign in portlet.

Module project structure should like below image :

Add Custom Language Support To Liferay

5) Deploy your module and clear cache from the Liferay control panel

6) Now sign in portlet will looks like below

Add Custom Language Support To Liferay