React hook that returns a function for changing the display language on the current ACUL screen. The screen automatically re-renders with the new locale after submission. The language must be one of the enabled locales configured in your Auth0 tenant.You can also populate the options dynamically from tenant configuration:
Key Features
- Tenant-aware — only accepts locales enabled in your Auth0 tenant configuration.
- Automatic re-render — the screen updates to the new language after the change is submitted.
- Session persistence — language preference is stored for the duration of the session by default.
Parameters
The returned function accepts a singleLanguageChangeOptions argument:The locale code to switch to. Must match one of the locales enabled in your Auth0 tenant. Example:
"en", "fr", "es".Persistence scope for the language preference. Defaults to
"session".Returns
(options: LanguageChangeOptions) => Promise<void>A function that submits the language change. The returned promise resolves when submission completes.Example
Remarks
- The
languagevalue must match a locale enabled in your Auth0 tenant — passing an unsupported locale will result in an error. - Use
useCurrentScreen()to accesstenant.enabledLocalesandtransaction.localefor dynamic locale selection. - Call
useChangeLanguageat the top level of your component; do not call it conditionally or inside event handlers.