Liferay Portal works with multiple languages. Liferay uses Struts to provide users with internationalized messages.
The default installation supports Chinese, Dutch, English, French, German, Greek, Italian, Japanese, Korean, Portuguese, Spanish, Turkish, and Vietnamese.
Available languages are set in /portal-ejb/classes/portal.properties.
## ## Languages and Time Zones ## # # Specify the available locales. Messages corresponding to a specific # language are specified in properties files with file names matching that # of content/Language_*.properties. These values can also be overridden in # properties files with file names matching that of # content/Language_*-ext.properties. Use a comma to separate # each entry. # # All locales must use UTF-8 encoding. # # The following links specifiy language and country codes: # http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt # http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html # locales=zh_CN,zh_TW,nl_NL,en_US,fr_FR,de_DE,el_GR,it_IT,ja_JP,ko_KP,pt_BR,es_ES,tr_TR,vi_VN # # Set the following to true if unauthenticated users get their preferred # language from the Accept-Language header. Set the following to false if # unauthenticated users get their preferred language from their company. # locale.default.request=false # # Specify the Struts character encoding. UTF-8 allows for the use of more # languages but takes a 15% performance hit compared to ISO-8859-1. # struts.char.encoding=UTF-8
These properties in your portal-ext.properties
can be edited or overridden.
Different languages have different properties files.
The English language properties file is Language.properties
and can be found in /portal-ejb/classes/content.
You can override the values in the English language property file by creating Language-ext.properties
and adding new values. Make sure this file is accessible in the class path.
The Japanese language properties file is Language_ja.properties
. To input Japanese characters, edit Language_ja.properties.native
and input Japanese characters that are UTF-8 encoded. Use the native2ascii tool to transform Language_ja.properties.native
to Language_ja.properties
.
You can override the values in the Japanese language property file by creating Language-ext_ja.properties
and adding new values. Make sure this file is accessible in the class path.
Go to /portal-ejb and run ant build-lang. This will translate any keys that exist in English but are missing in the other supported languages.
To access locale depent messages from JSPs, use the Struts tag <bean:message key="search" />
or get the ResourceBundle from the portletConfig
.
To access locale depent messages from Java classes, use LanguageUtil.get(locale, "search")
or LanguageUtil.get(pageContext, "search")
.