Saturday, September 17, 2016

Localize Portlet Title in Liferay

In the previous tutorial Localization (l10n) in liferay we change the portlet content on the basis of locale.But what if we want to change the title of portlet.In this tutorial we localize title of portlet.We can achieve this by two ways:-


First Method

Put a key (ex-portlet_title) in your Language_xxx.properties file and get the key using default locale and than set in setTitle() method:-

Demo.java





Second Method

This is pretty simple just put the key as javax.portlet.title and that's it. No need to do anything in Controller. Ex:- 

javax.portlet.title = MyCustomTitleAgain

Output:-


No comments:

Post a Comment

Total Pageviews

Like Us on Facebook

Number Of Unique Visitor

Free counters!