---
title: "JavaScript SDK: Translations"
description: "Configure widget language and translations with the Gleap JavaScript SDK. Follow the integration code examples."
url: https://docs.gleap.ai/en/articles/417-javascript-sdk-translations
collection: "JavaScript"
updated: 2026-11-01
language: en
---

# JavaScript SDK: Translations

Configure widget language and translations with the Gleap JavaScript SDK. Follow the integration code examples.

Gleap supports multiple languages. Add a language under Settings → Project → Languages and edit the widget’s built-in text under Settings → Project → Static translations. Use the SDK method below to select the language for the current user.

Gleap automatically picks the device language as default language. If the device language is not available it will switch to English as a fallback. In some situations you might want to overwrite the device language with a custom language. This can be achieved with the following method.

### Overwrite the default language

```javascript
// 2 digit ISO code
Gleap.setLanguage("es");

// 5 digit ISO code with lang - country
Gleap.setLanguage("en-US");
```

> **Info:** Please use the `setLanguage` method only before the initialization of the Gleap SDK (before calling `Gleap.initialize()`) OR when users perform a language change in your application. Note that setting the language reloads the whole widget, which might lead to unwanted behaviour, so it's recommended to stick to the two use-cases above.

## Related

- [JavaScript SDK setup](https://docs.gleap.ai/en/articles/393-javascript-sdk-setup.md)
- [JavaScript SDK: Code snippet](https://docs.gleap.ai/en/articles/394-javascript-sdk-code-snippet.md)
- [JavaScript SDK: User identity](https://docs.gleap.ai/en/articles/395-javascript-sdk-user-identity.md)
- [JavaScript SDK: Callbacks](https://docs.gleap.ai/en/articles/396-javascript-sdk-callbacks.md)
- [JavaScript SDK: AI chatbar](https://docs.gleap.ai/en/articles/397-javascript-sdk-ai-chatbar.md)
