Skip to main content

Locale Handling at login - Knowledgebase / Miscellaneous - Bare.ID - Support

Locale Handling at login

Authors list
  • Steffen Ritter

Introduction

The available languages (locales) and how the interface language is chosen are configured as described in the Bare.ID manual.
For further details, see the relevant chapter of the handbook.
Users can select from the available languages in the login form and the account console.

1 How the login language is determined

The language for the login form is selected by following a defined order rather than at random.
Bare.ID evaluates different sources in sequence and uses the first applicable setting:

  1. User selected – if someone chooses a language via the drop‑down on the login page, it is used immediately.
  2. User profile – for signed‑in users, the preferred locale stored in the user account is applied.
  3. Client requested – applications can specify a preferred locale via the OIDC parameter ui_locales.
  4. Locale cookie – if a language has been selected previously, it is stored in a cookie and automatically preselected on the next visit.
  5. Accept‑Language header – if no cookie is present, the browser’s language header is used.
  6. Default language of the instance – if none of the above apply, the default language configured for the system is used.
  7. English fallback – as a final fallback, English is used.

Controlling the locale via URL

Applications can preset the login form language by passing the OIDC parameter ui_locales.
When calling the authorization endpoint of Bare.ID, append the parameter to the URL, e.g.:

https://auth.example.com/realms/myrealm/protocol/openid-connect/auth
?client_id=myclient
&redirect_uri=https%3A%2F%2Fapp.example.com%2Fcallback
&response_type=code
&scope=openid
&ui_locales=en

2 Which locale information is stored on the user

Only explicit choices made by the user are stored permanently.
If someone selects a different language on the login form, Bare.ID writes the new setting to the user account after successful authentication.
At the same time, the system creates a locale cookie so that the login form preselects the same language on the next visit.
Automatically determined locales – for example via ui_locales, a cookie or the browser header – are not persisted on the user.

The preferred language is stored in the locale attribute of the user account.
Users can change this via the account portal (Personal info → Locale) or it can be set through the administrator interface.
The interface only returns the locale attribute when it is actually set.

3 Locale information in tokens and the UserInfo endpoint

The locale attribute is added to ID tokens and access tokens only when a value is set on the user account.
Implicit locale choices – such as from the browser header or the system’s default language – are not automatically propagated into tokens.
The same applies to the UserInfo endpoint; locale is returned only when it is explicitly set on the user.

Summary

The language of the login form and user interfaces in Bare.ID is determined by a priority list – from an explicit choice to the system’s default language.
Applications can influence the language via the ui_locales parameter.
Only explicitly chosen languages are stored on the user profile and exposed in tokens or the UserInfo endpoint.