Theme Localization
Overview
The FusionAuth theme can be localized to better server your end users. In each theme you may specify one to many language specific message bundles to translate text rendered in a theme into a user’s preferred language.
If you’re just looking into localizing your theme, take a look at our community provided and maintained message bundles. https://github.com/FusionAuth/fusionauth-localization
Messages
In the Messages tab of your theme editor you may specify one to many languages. Once you have specified a key and value the key may be used in any template to display a localized string.
Consider the following message bundle and theme usage example with English and German messages defined.
greeting=Good day
greeting=Guten Tag
<p>${theme.message('greeting')}</p>
If I have selected German as my locale, I will be greeted with Guten Tag
rendered on the page, if I have English selected I will instead find the greeting Good day
.
Locale
The locale is determined by the locale value. The locale is resolved on each request using the following precedence:
-
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.Example requestGET /oauth2/authorize?client_id={client_id}&redirect_uri={redirect_uri}&response_type=code&tenantId={tenantId}
&locale=fr
-
The user selects a language during login using the locale selector
-
The HTTP
Accept-Language
header if present on the HTTP request -
The system default locale as determined by the underlying operating system