d7d6b83bd6
closes #17130 Co-authored-by: andymunro <48995441+andymunro@users.noreply.github.com>
17 lines
1.3 KiB
Text
17 lines
1.3 KiB
Text
[[_locale_selector]]
|
|
=== Locale selector
|
|
|
|
By default, the locale is selected using the `DefaultLocaleSelectorProvider` which implements the `LocaleSelectorProvider` interface. English is the default language when internationalization is disabled.
|
|
|
|
With internationalization enabled, the locale is resolved according to the logic described in the link:{adminguide_link}#_user_locale_selection[{adminguide_name}].
|
|
|
|
This behavior can be changed through the `LocaleSelectorSPI` by implementing the `LocaleSelectorProvider` and `LocaleSelectorProviderFactory`.
|
|
|
|
The `LocaleSelectorProvider` interface has a single method, `resolveLocale`, which must return a locale given a `RealmModel` and a nullable `UserModel`. The actual request is available from the `KeycloakSession#getContext` method.
|
|
|
|
Custom implementations can extend the `DefaultLocaleSelectorProvider` in order to reuse parts of the default behavior. For example to ignore the `Accept-Language` request header, a custom implementation could extend the default provider, override it's `getAcceptLanguageHeaderLocale`, and return a null value. As a result the locale selection will fall back on the realm's default language.
|
|
|
|
[role="_additional-resources"]
|
|
=== Additional resources for Locale selector
|
|
* For more details on creating and deploying a custom provider, see <<_providers,Service Provider Interfaces>>.
|
|
|