This page is about translating the Liferay application. For adding translations of wiki articles, see Translations.
Liferay Portal is an application that can be localized to multiple languages, that even allows each user to choose a different languages of the ones supported by the platform. By default Liferay provides translations to a large number of languages. Some of those translations are reviewed carefully by native speakers although others are automatically translated (you can help if this is the case for you language!).
This article explains how to translate Liferay to a new language or how to improve an existing translation.
Liferay maintains the sentences used throughout the portal in a set of files of the form Language_(Language code).properties where (Language code) identifies the language as defined by the Java Internationalization specs.
These files are stored within a directory named 'content' which is deployed to the classpath. The exact location of this directory varies depending if you are looking at the sources or a deployed installation. Here are the most common cases:
The Language_(Language code).properties files are regular text files that can be edited with a simple text editor. Java properties editors available in the most modern IDEs can also be used.
To create the translation for a new language make a copy of the file for an existing language and change the (Language code) to the one associated to the new language. The language code has the following syntax (brackets denote optional portion)
<language code>_<[country code>_<variant code>]
Note that you may have to modify more than one language.properties files. In this page you will find the Location of language.properties
For more information check Internationalization: Understanding Locale in the Java Platform
When writing a translation to a language that uses non-ASCII characters some problems may arise. This section explains why this may happen and how to solve it.
When using a non-ASCII character in a Language*.properties file the text editor will use a different encoding system to be able to represent those files. If the encoding does not match the one used by the portal the non-ASCII characters will not be shown correctly to the user.
While this can be solved by making sure the file is saved with the same encoding, a better way to solve the problem is to encode the file with a Java specific format that is independent of the encoding used. This ensures that even if the encoding used by the portal is used the non-ASCII characters will still be read correctly.
Java provides a command line tool called native2ascii that allows converting from any encoding (specified as a parameter) to Java's format. Liferay uses this tool for all languages that need it (actually, all but English). It stores the files with the original encoding with the extension .native and the does a conversion:
Language_(Language code).properties.native ==> Language_(Language code).properties
As a conclusion, if you are using liferay 6 or newer you don't have the native files and you don't have to worry about the non-ASCII characters at all. Otherwise:
Once you have a new or improved translation file they should be placed along with the other Language files in the locations listed in step 1.
If it is a new translation it will also be necessary to register it within Liferay. To do that you'll have to edit the files portal.properties or portal-ext.properties and add the new language to the property locales. For example to add
locales=ar_SA,ca_AD,ca_ES,...tr_TR,vi_VN,**ro**
If you want to contribute the new translation so that it's included in the next version of Liferay, follow these steps:
0 Attachments | Average (0 Votes) ![]() ![]() ![]() ![]() |