Localization is made in some property files usualy located in ../WEB-INF/classes/locale/.. of portal or portlet project.
For example, have a look at portal/WEB-INF/classes/locale/portal, and you will find there files like : expression.properties, services.properties, webui.properties, … Those files contains sets of expressions composed of an id and its translation in current language.
For example : word.abort=Abort
To translate those properties, you just have to copy the resource file, for example my_resource.properties, to a new one named with the ISO code of the country, for example my_resource_fr.properties for french translation.
You have to be carrefull that your portal or portlet support the language concerned by your translation. For portal, have a look at default-configuration.xml and locales-config.xml in /portal/WEB-INF/conf/common. For portlet, have a look at the section supported-locale in your /WEB-INF/portlet.xml and add the locales you want to be supported here.
How To add a properties file to a portlet :
1) Create the file in ../WEB-INF/classes/locale/portlet/rep2/myFile.properties
2) In portlet.xml, declare the properties file :
1) Create the file in ../WEB-INF/classes/locale/portlet/rep2/myFile.properties
2) In portlet.xml, declare the properties file :
<supported-locale>en</supported-locale>
<resource-bundle>locale.portlet.rep2.myFile</resource-bundle>
3) To use a property :
- in gtmpl :
_ctx.appRes(key);
- java file :
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
ResourceBundle res = Context.getApplicationResourceBundle();
res.getString(key);
How To add a properties file to the portal :
1) Create the file in ../WEB-INF/classes/locale/rep1/rep2/myFile.properties
2) in WEB-INF/conf/common/resource-bundle-configuration.xml, add the file in init.resources :
locale.rep1.rep2.myFile
3) To use a property :
- in gtmpl :
_ctx.appRes(key);
- in java file :
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance() ;
ResourceBundle res = context.getApplicationResourceBundle() ;
res.getString(key);
on 14/08/2008 at 09:38