Thursday, July 21, 2011

Localization Specific Logo Image : Liferay Portal

Often there are requirements to show customized logo image according to portal's current locale. In Liferay Portal there is no way achieve this but locale specific logo can applied by using the theme.

In theme, portal_normal.vm contains the following statement to display logo -

<a href="$company_url" title="#language("go-to") $company_name">
<span>$company_name</span>
</a>

Here you can place check for the locale and accordingly change the logo image -

<a href="$company_url" title="#language("go-to") $company_name">
#if($locale == "en_US")
<img src="englishlogoimage" />
#else
<img src="spanishlogoimage" />
#end
</a>

but now you can't manage the logo from the community settings as image urls are hardcoded in the theme. To make it manageable you can use web content to render the logo image.

Any comments or suggestions will be appreciated ....

 

Saturday, July 9, 2011

Community Specific Locale Liferay Portal (Per Community BasisLocalization)

Liferay provides us with fine grained built-in localization features. In Liferay Portal one can apply localization on per user basis. But how to apply default locale to a Community, Liferay doesn’t provide any such functionality but it can be implemented using Portal Properties Hook.

So case is, portal instance have more than one Community and we need to apply a default language setting for one Community that is different from other Communities. To achieve this implement an Event Hook for servlet.service.events.pre.

Following is the step by step description to achieve this functionality-

1.  Create a portal properties hook and choose the servlet.service.events.pre Event

2.  Create a new class say SampleClass by extending the com.liferay.portal.kernel.events.Action


3.  Now en_US locale will be applied to LONG_GROUP_ID Community.

Any queries or comments.........