Wiki

How to I18n, change or add new languages

How to I18n, change or add new languages

                So you already generated a few portlets and need to add new language templates or change something in the actual ones.  As you already notice portlet generation contemplates “en”,"fr","it" and “es” languages, if you develop a template for other language, feel free to send a copy to me, I will include it in the next version.

Prerequisites

Ø        Liferay plugins SDK installed and working

o         http://www.liferay.com/documentation/liferay-portal/6.0/development/-/ai/the-plugins-sdk

 

Ø        XMLPortletFactory installed and working in Liferay plugins SDK

o         http://sourceforge.net/projects/xmlportlet/files/

o         A portlet already generated, (see “First Run” chapter)

o         We are going to use same example here (the “example-portlet”)

 

Steps

 

                In the first run of XMLPortletFactory, two folders where automatically created, that were, lib and Resources. Under resources, you will find many files used in the generation of the portlet. We are going to talk about the ones that control I18n.

 

1.        Go to XMLPortletFactory / Resources / Velocity Templates / PortletFiles folder.

2.        If you just want to change something already exists just edit corresponding “Portlet_Language_??_properties.vm” file to suit your needs.

3.        In case you want to create a new language template copy “Portlet_Language_properties.vm” to “Portlet_Language_<your lang here>_properties.vm”

4.        Change line 4 to meet your lang so corresponding new file will be generated

a.        #set( $createName = "/Language_<your lang here>.properties" )

b.        Change rest of lines ALLWAYS at the right side of the “=” sign.

c.        Don’t touch velocity variables enclosed like this: ${xxxxxxx} they are values substituted at generation time.

d.        Don’t touch lines starting with the “#” sign; they are velocity commands or file comments.

e.        If you have doubts compare English and Spanish files, it clears a lot to compare them.

5.        Now generate again

a.        Cd to your “portlet”-xmlportletfactory

b.        Ant

Results

                You now are supposed to have a new language_xx.properties file in your newly generated portlet, and in every portlet you generate from this XMLPortletFactory SDK.

 

                Remember to backup a copy of the file.

 

Have fun.

0 Attachments
5170 Views
Average (0 Votes)
The average rating is 0.0 stars out of 5.
Comments