Using Liferay's Localization Settings

You can customize a given locale’s default language settings by overriding the properties that control those settings. For instructions on this, see Overriding Language Keys. Here, you’ll learn which properties correspond to common language settings.

So what all can be customized? This is an excellent question! Consider these examples:

  • In the add and edit user forms, you can configure the name fields that are displayed and the field values available in select fields. For example, you can leave out the middle name field or alter the prefix selections.

  • You can also control the directionality of content and messages (left to right or right to left).

Language properties exist in files, where xx represents the locale. For example, contains the properties for Spanish, contains the properties for English, and so on.

The default (core) language properties are in Do not edit this file. You can, however, open it to view the default language settings. There are two ways to do so:

  1. From Liferay Portal’s source code. Navigate to

  2. From a bundle’s portal-impl.jar.

    [Liferay Home]/tomcat-[version]/webapps/ROOT/WEB-INF/lib/portal-impl.jar

    Open the content folder in the JAR to find the language files.

The first section in the core file is labeled Language Settings and contains language properties that begin with lang:

## Language Settings


To use the language settings mentioned here, you must have a module. See the articles on overriding language keys to set up a module with the following characteristics:

  • Contains an implementation of ResourceBundle that is registered in the OSGi runtime.

  • Contains a file for the locale whose properties you want to override.

Localizing User Names

Naming conventions can differ between locales. For example, users in some locales have more than one last name. You can therefore change the user name properties to fit the given locale. The properties for changing user name settings begin with

User name fields are configurable in the following ways:

  • Remove certain name fields and make others appear more than once. Some locales need more than one last name, for example.,first-name,middle-name,last-name,suffix
  • Change the prefix and suffix values for a locale.,Mr,Ms,Mrs,III,IV,Jr,Phd,Sr
  • Specify which fields are required.

A user’s first name is mandatory. Because of this, take these two points into consideration when configuring a locale’s user name settings:

  • The first-name field can’t be removed from the field names list.,first-name,middle-name,last-name,suffix
  • Because a first name is required, it’s always implicitly included in the required field names property:

    Therefore, any fields you enter here are in addition to the first name field. Last name is required by default, but you can disable it by deleting its value from the property:

    In that case, only a first name would be required.

For most of the locales enabled by default, the user name properties are tailored to each locale. The default locales are specified by the locales.enabled property:


For example, here are the English ( properties for setting user name fields:,first-name,middle-name,last-name,suffix,Mr,Ms,Mrs,III,IV,Jr,Phd,Sr

Figure 1: The user name settings impact the appearance of user information and forms.

Figure 1: The user name settings impact the appearance of user information and forms.

Compare those to the Spanish ( settings:,first-name,last-name,Sra,Sta,Dr,Dra

Figure 2: The Spanish user name settings omit the suffix and middle name fields.

Figure 2: The Spanish user name settings omit the suffix and middle name fields.

The biggest difference between the English and Spanish form fields is that the middle name and suffix fields are omitted in the Spanish configuration. Other differences include the specific prefix values. ¡Muy excelente!

Identifying User Initials

The default avatar displays a user’s initials. Some cultures use initials differently, so there’s a way to configure them in the appropriate file.


The lang.user.default.portrait property sets the type of portrait to use for users. This can be set to initials or image. If set to image, the default images defined by the image.default.user.female.portrait or image.default.user.male.portrait properties residing in the file are used. Therefore, the lang.user.initials.field.names property is ignored.

Figure 3: The users initials are displayed for their avatar by default.

Figure 3: The user's initials are displayed for their avatar by default.

If you’re leveraging the user’s initials for the default avatar, you can use the lang.user.initials.field.names property to organize how the initials are displayed. Valid values for this property include first-name, middle-name, and last-name, in any order.

Right to Left or Left to Right?

The first three properties in the core file’s Language Settings section change the display direction of a language’s characters. Most languages read from left to right, but some languages read from right to left (e.g., Arabic, Hebrew, and Persian).

Here are the relevant language properties for a right-to-left language:


Overriding Language Keys

Localizing Your Application

Creating a Language Module

Using a Language Module

« Localizing Your ApplicationCreating a Language Module »
Was this article helpful?
0 out of 0 found this helpful