Localization and Internationalization

Overview

FusionAuth is built from the ground up with localization (often abbreviated l10n), translation and internationalization (often abbreviated i18n) in mind.

  • Internationalization is the practice of building a product such that it can be used in many languages. This is often done by extracting user interface elements such as images and text to files which can be customized for a given language and country, as well as by having a data model capable of storing users’ preferred language and locale.
  • Localization is the practice of actually configuring a product for a given language and country. This can include formatting of data, such as numbers, translation, and formatting images or layout.
  • Translation is converting all text in an interface to a given language.
  • A locale identifies a language and a geographic region. An example is fr_CA, which means Canadian French, as opposed to French French, which is fr_FR. Java has some good locale documentation.

The key data element most relevant to l10n and i18n in FusionAuth is the preferredLanguages field. This is present in both the User and Registration objects and stores a user’s locale. The locale is available in the Registration because different applications may support different languages.

There are four different areas of FusionAuth where user language preferences matter.

Obtaining the User’s Locale In Your Application

Assign a user’s preferredLanguages via the API or advanced registration form. This allows you to store a user’s preferred locale in FusionAuth and use it across all applications. This can take more than one locale. As of version 1.32.2, they are stored in the order they were added. Previously, they were stored in alphabetical order.

The default application registration form has the preferredLanguages field as well.

Adding a registration via the administrative interface allows you to set the preferred language of the user.

After the user has a locale assigned, you can add it to a JWT using a JWT populate lambda, so it can be utilized by other applications.

function populate(jwt, user, registration) {
  jwt.preferredLanguages = registration.preferredLanguages || ['en_US'];
}

You may also retrieve the value from via the User API.

Hosted Login Pages

The hosted login pages, which are displayed for user facing login flows are fully localized. The translation and localization of these pages is done using themes.

The locale for display is determined in the following manner.

  1. The locale request parameter if present on the HTTP request. This is useful if you already know the user’s preferred locale prior to redirecting them to FusionAuth to complete authentication. See example below.

    locale=fr

  2. The user selects a language during login using the locale selector or there is a fusionauth.locale cookie present
  3. The HTTP Accept-Language header if present on the HTTP request
  4. The system default locale as determined by the underlying operating system

The user’s preferredLanguages settings are not used to select a locale for the hosted login pages.

The text in all of these login flows for these pages have been translated into a number of different languages. These are available for installation into your FusionAuth instance; they do not ship with the default installation.

To install a community supported localization package, navigate to Themes -> Your Theme -> Messages and click the “Add Localization” button. Select your Locale and then copy and paste in the appropriate messages file obtained from the repository.

Installing a Polish translation for the hosted login pages.

After you have set up your localized theme, set the tenant’s Login theme to your theme. Navigate to Tenants -> My Tenant -> General to do so.

The current list of languages is:

  • English (en)
  • Arabic (ar)
  • Danish (da)
  • German (de)
  • Spanish (es)
  • Finnish (fi)
  • French (fr)
  • Indonesian (id_ID)
  • Italian (it)
  • Japanese (ja)
  • Dutch (nl)
  • Polish (pl)
  • Portuguese - Brazilian (pt_BR)
  • Russian (ru)
  • Swedish (sv)
  • Ukrainian (ua)

Here’s a brief video showing how to install translated messages in your theme.

Visit the fusionauth-localization GitHub repo to view the most up to date list of translations or to contribute one.

Emails and Other Messages

FusionAuth sends emails and other messages on behalf of your application. An example would be a “Forgot Password” email. FusionAuth provides support for you to customize and localize these messages.

Unlike the hosted login pages, there are no community supported bundles of translated email templates. The shipped email template text is rarely used in production. In general you will customize the content as well as the language to support your organization and applications.

Please see the email template localization documentation for more.

The FusionAuth Administrative User Interface

There are no translations of the FusionAuth administrative user interface. Currently the only supported language is English. The interface does support limited localization in the display of dates, times and numbers.

To enable this localization, set the admin user’s preferred language. Then, items such as dates and numbers will be formatted based on the user’s locale.

FusionAuth supports the following locales for the administrative user interface.

The list below is of supported locales which will affect the presentation of dates, times and numbers in the administrative user interface, not locales for which the interface has been completely translated.

  • Arabic (ar)
  • Czech (cs)
  • Danish (da)
  • German (de)
  • Greek (el)
  • English (en)
  • English - US (en_us)
  • Spanish (es)
  • French (fr)
  • Irish (ga)
  • Hebrew (he)
  • Hindi (hi)
  • Italian (it)
  • Japanese (ja)
  • Korean (ko)
  • Dutch (nl)
  • Norwegian (no)
  • Portuguese (pt)
  • Russian (ru)
  • Swedish (sv)
  • Chinese (kzh)
  • Chinese - Simplified (zh_CN)
  • Chinese - Traditional (zh_TW)

In the below screenshot, Richard has a preferredLanguage of French. When Richard interacts with the FusionAuth administrative user interface, the account with the email dinesh@fusionauth.io, created on Oct 5, 2020, has a displayed date formatted as specified by the French locale, with the day first.

The FusionAuth administrative interface as viewed by a user with a preferred language of French.

If you’d like to see additional localizations or translations of the FusionAuth administrative interface, please file an issue.