> ## Documentation Index
> Fetch the complete documentation index at: https://developer.watson-orchestrate.ibm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# updateLocale()

Changes the display language of the chat widget at runtime. By default, the locale is English (`en`).

## Syntax

```javascript theme={null}
await instance.updateLocale(locale, savePreference);
```

## Parameters

<ParamField path="locale" type="string" required>
  A locale string representing the desired language and region.

  The following table details the supported locales:

  | Language              | Language Code |
  | --------------------- | ------------- |
  | Chinese - Simplified  | `zh-CN`       |
  | Chinese - Traditional | `zh-TW`       |
  | Dutch                 | `nl`          |
  | English               | `en`          |
  | French                | `fr`          |
  | German                | `de`          |
  | Italian               | `it`          |
  | Japanese              | `ja`          |
  | Korean                | `ko`          |
  | Portuguese - Brazil   | `pt-BR`       |
  | Spanish               | `es`          |
</ParamField>

<ParamField path="savePreference" type="boolean" default="false">
  Determines whether the locale preference must be saved to the platform database. When set to `true`, the system persists the user's locale preference and applies it in future sessions. When set to `false` or omitted, the locale change is temporary and applies only to the current session.
</ParamField>

## Returns

<ResponseField name="Promise<void>">
  A promise that resolves when the system updates the locale.
</ResponseField>

## Examples

The following examples show different ways to change the locale:

```javascript theme={null}
// Change to Japanese
await instance.updateLocale('ja');

// Change to Brazilian Portuguese
await instance.updateLocale('pt-BR');

// Change to French and save the preference to the backend
await instance.updateLocale('fr', true);

// Change based on user selection and persist the preference
const userLanguage = getUserPreferredLanguage();
await instance.updateLocale(userLanguage, true);
```

<Card title="Do you need practical examples?" icon="text-align-start" href="https://www.ibm.com/docs/SSAVQO/deploy/web_chat_agent/tutorials/tutorials_lp.html" arrow="true" cta="Learn with walk-throughs" horizontal>
  Learn how to apply the features available for embedded chat into your implementation with guidance and examples.
</Card>
