Problem statement
We are using the Classic Universal Login and would like to know what is the right way to support localization within the Universal Login Screen.
Can we define the region of the user and then have automation on the translation or do we need to map specific copies to sections of the login HTML based on the local of the user?
Solution
When the user’s language selection is known before when the authentication request begins, we recommend passing that selection to the ui_locales
query parameter in the authentication request to support language translation on the Universal Login screen.
For example:
https://YOUR_DOMAIN/authorize?
response_type=code&
client_id=YOUR_CLIENT_ID&
redirect_uri=https://YOUR_APP/callback&
scope=SCOPE&
audience=API_AUDIENCE&
state=STATE&
ui_locales=de
Once the ui_locales
attribute is used to pass the language selection, you may access it in the Classic Universal Login widget with the following code:
var lock = new Auth0Lock(config.clientID, config.auth0Domain, {
//code redacted for brevity
language: config.extraParams.ui_locales,
languageBaseUrl: config.languageBaseUrl,
languageDictionary: languageDictionary,
// code redacted for brevity
});
Currently, Lock supports the following Languages.