> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure Flexible Language Selection

> Learn how you can add a preferred language menu to Universal Login prompts.

Flexible language selection is an optional feature that allows users to select their preferred language on Universal Login (Universal Login: Your application redirects to Universal Login, hosted on Auth0's Authorization Server, to verify a user's identity.) prompts associated with your application, such as the login screen. You can configure this feature individually for different Universal Login prompts.

After implementing this feature for a specific prompt, a language selection menu is added to the associated screen. Users can choose a preferred language from this menu to automatically render the prompt in that language.

![Two Universal Login prompts showing the language selection menu. ](https://mintlify.s3.us-west-1.amazonaws.com/docs-dev/images/cdy7uua7fh8z/4Z5pt3aH3vpRRYV0RDDnba/dc7a5abc8ee2cb462b2be4b43490393c/Language_Selector_Prompts.png)

## Before you begin

Before you can implement flexible language selection, ensure the following requirements are met:

* Use [Universal Login](/docs/docs/authenticate/login/auth0-universal-login).

  * This feature is not available for custom login pages.
* Configure a [custom domain](/docs/docs/customize/custom-domains).
* Enable the languages you plan to add to your prompts in your Auth0 tenant.

  * On the Auth0 Dashboard, navigate to [Settings > General > Languages](https://manage.auth0.com/#/tenant/general) and enable one or more desired languages.

    * For more information, review [Universal Login Internationalization](/docs/docs/customize/internationalization-and-localization/universal-login-internationalization).

## Implement flexible language selection

Setting up flexible language selection includes two primary steps:

1. Preparing your page template to facilitate language selection.
2. Configuring individual prompts to display language selection to users.

### Prepare your Universal Login page template

To get started, add the following script to your [Universal Login page template](/docs/docs/customize/login-pages/universal-login/customize-templates) to facilitate language selection.

```html lines theme={null}
<script>
  function updateSelectedLanguage() {
    const selectElement = document.getElementById('language');
    const selectedValue = selectElement.value;
    const options = selectElement.options;
    for (let i = 0; i < options.length; i++) {
      if (options[i].value === selectedValue) {
        options[i].selected = true;
      } else {
        options[i].selected = false;
      }
    }
    document.getElementById('changeLanguage').click();
  }
</script>
```

This script enables Universal Login prompts to render a dynamic language selection menu. Users can access this menu to apply their preferred language to a configured prompt.

To add this script to your page template, use the [Set Template for Universal Login](/docs/docs/api/management/v2/branding/put-universal-login) endpoint.

> [!WARNING]
>
> Be aware that this call will **overwrite any existing configurations** you have made to your Universal Login page template. To avoid any disruptions, ensure you include all necessary page template customizations in this call.

Using the Auth0 CLI? If you haven't already, [set up and authenticate your CLI session](/docs/docs/deploy-monitor/auth0-cli) before running this command.

### Configure individual Universal Login prompts

Next, add language selection to one or more Universal Login prompts by configuring custom prompt partials. Partials refer to custom code inserted into an entry point within a prompt screen, such as the login screen. To learn more, review [Customize Signup and Login Prompts](/docs/docs/customize/internationalization-and-localization/universal-login-internationalization).

To add language selection to a specific prompt, use the Auth0 Management API (Management API: A product to allow customers to perform administrative tasks.) to configure custom prompt partials with the following parameters:

| Parameter | Description | Example Value |
| - | - | - |
| `language` | Required. One or more languages to include in the language selection menu displayed to users. | `es`,`fr`,`en` |
| `persist` | Required. Determines whether the language should persist across the session. | `session` |
| `action` | Optional. Use this parameter in situations where you want users to be able to update their language without advancing the prompt. If the value is provided, the form is **not** automatically submitted when a user changes their language. Otherwise, the prompt automatically advances when a different language is selected. | `change-language` |

Access the sections below to review code samples for different types of Universal Login prompts.

> [!WARNING]
>
> In the code samples below, ensure you replace the placeholders with the appropriate values:
>
> * Replace `{yourDomain}` with `yourdomain.auth0.com`.
> * Replace `{mgmtApiToken}` with your access token.

> [accordion] Signup Prompt: Identifier + Password
>
> To add language selection to the `signup` prompt, use the [Set partials for a prompt](/docs/docs/api/management/v2/prompts/put-partials) endpoint:

> [accordion] Login Prompt: Identifier First
>
> To add language selection to the `login-id` prompt, use the [Set partials for a prompt](/docs/docs/api/management/v2/prompts/put-partials) endpoint:

> [accordion] Login Prompt: Passwordless (Email)
>
> To add language selection to the `login-passwordless-email-code` prompt, use the [Set partials for a prompt](/docs/docs/api/management/v2/prompts/put-partials) endpoint:
