Thursday, June 2, 2016

Internationalization (i18n) in Liferay

Today we will discuss about Internationalization (i18n) in liferay. By default Liferay support English language. Here we add Hindi language support in our portlet. So lets start this Step by Step:-

Step 1:-Create Liferay Project and Portlet
Just create a Liferay project and then create a MVC portlet in it.

Step 2:-Create your file
Now create a folder content inside docroot/WEB-INF/src .Create two files and and paste the content as:-

Welcome_Msg =Welcome to Liferayiseasy

Welcome_Msg =आपका स्वागत है LiferayisEasy में

Here file support English Language and supports Hindi Language.For different languages you change the name of files accordingly.
Ex- For Spanish use

Step 3:-Change view.jsp
Open view.jsp and paste this:-


Here we are using <liferay-ui> tag for accessing our keys that are mention in our properties files.

Step 4:-Add resource bundle entry
Open portlet.xml and provide resourse bundle entry:-


Now your portlet.xml become:-

Step 5:-Check output
First Go to Admin-->Control panel-->Portal Setting-->Display Setting(inside Miscellaneous) and add Hindi language to current languages.

Now add Language portlet(OOTB) and your custom portlet to page:-

Click on Indian Flag Symbol:-

Your text automatically chage to Hindi Language.


If you don't want to use  Language portlet (OOTB) than you can directly mention Language_hi_IN in portlet.xml (Step 4).In this case only Hindi language is supported by your portlet.

Project Structure

Hope this will Help....

You can Download Source code from  Internationalization in Liferay.

Related Post:-

No comments:

Post a Comment

Total Pageviews

Number Of Unique Visitor

Free counters!