Wednesday, 31 July 2013

I18N in Liferay Plugin Portlet


Internationalization is one of the most easiest things to do in Liferay Portlet Plugin. Following are the steps to configure & pick-up properties resource bundle:
  1. In portlet.xml file make an entry under after <supports> as follows: <resource-bundle>content/Language-ext</resource-bundle>
  2. Create a folder under src called content and within content create a file called Language-ext.properties file. Configure the required properties in this file. Create properties file for other languages for e.g Langauage-ext_es.properties for Spanish.
  3. Configure a property called javax.portlet.title  in each one of the Language-ext files with values based on the language that the property file stands for.
  4. Build your portlet and deploy it. Drop your portlet on the page. Also drop Language portlet.
  5. Change from one langauge to the other (change to Esapan) and you will get title that you have configured in Langauage-ext_es.properties file and then change to English. You will get the title that you configured in Langauage-ext.properties

No comments:

Post a Comment