Search This Blog

Tuesday, 17 December 2013

Creating & Using a language.properties for your custom portlet





STEP:1 Create a Package named-'content' under the.. '/docroot/WEB-INF/src'
Note: Create a Package and not a folder. [i did that mistake for the first time ;-)]

STEP:2 now create a file named - '/content/language.properties' under the content folder created above..

STEP:3 now to recognize this file @ portlet-level you need to make an entry in the 'portlet.xml' file present under the -'/docroot/WEB-INF/portlet.xml'
Add the properties file entry in this file using the resource-bundle tag as following :-
--------------------------------------------------------------------
<resource-bundle>content.language</resource-bundle>

--------------------------------------------------------------------

Note: add this Tag @ following location for each portlet (that intends to use this language.properties file) in the portlet.xml:-
--------------------------------------------------------------------
<portlet>
    <portlet-name>portfolio</portlet-name>
    ...
   <resource-bundle>content.language</resource-bundle>
    <portlet-info>...</portlet-info>
    ...
</portlet>
--------------------------------------------------------------------
Note: Also , the correct entry format is : <resource-bundle>content.language</resource-bundle>
often mistaken with --
<resource-bundle>language</resource-bundle>  OR
<resource-bundle>language.properties</resource-bundle>  OR
<resource-bundle>content.language.properties</resource-bundle>

No comments:

Post a Comment