Using Liferay's Language Settings

For a given locale, you can override Liferay DXP’s core UI messages. Modifying language key values provides a lot of localization flexibility in itself, but we’re always looking for new ways to give you more control. There are language settings in files that give you even more localization options.

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

  • Control the directionality of content and messages (left to right or right to left).

To see how these settings are configured, open Liferay DXP’s core file in one of two ways:

  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

    Just open the content folder in the JAR to find the language files.

The first section in the file is labeled Language Settings:

## Language Settings


The user name properties are used to customize certain fields of the Add and Edit user forms based on a user’s locale.

Localizing User Names

Customers come from all over the world, so naming conventions are different between locales. Because of this, 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.

The properties for changing user name settings are those that begin with in the language settings section of a locale’s language properties file.

For most of the locales enabled by default, the user name properties are specifically tailored to that location.


For example, these are the English (i.e., 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 way user information and forms appear in Liferay.

Figure 1: The user name settings impact the way user information and forms appear in Liferay.

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 entirely.

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

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! Localizing the forms for adding and editing users is accomplished using the same method by which Liferay DXP’s UI messages are localized: overriding one of its files.

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 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, the lang.user.initials.field.names property is used to organize how the initials are displayed. Valid values for this property include first-name, middle-name, and last-name, in any order.

Now you can manage how a user’s initials are displayed!

Right to Left or Left to Right?

The first three properties in the’s Language Settings section change the direction in which the language’s characters are displayed. Most languages are read from left to right, but some languages are read from right to left (e.g., Arabic, Hebrew, and Persian). You can also change it for languages that have been traditionally displayed left to right (like English) as a funny practical joke. Just don’t tell anyone that you got the idea here.

Here’s what the relevant language properties look like for a language that should be displayed from right to left:


With these customizations, you can transform your UI into a user-friendly environment no matter where your users are from.

« Automatically Generating Language FilesIntroduction to Application Display Templates »
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 1