> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/web/ui-customization/localization/languages-and-internationalization.md).

# Change Language Localization in WebViewer JavaScript PDF Viewer

Enhance your web app's global reach with localization using i18next. Easily add and switch between languages in WebViewer to cater to diverse audiences worldwide. Explore the supported languages and l

WebViewer leverages the [i18next](https://www.i18next.com/) library for languages and internationalization support.

## Default languages

Out of the box, WebViewer supports 30 languages including the following:

* English (en)
* French (fr)
* German (de)
* Dutch (nl)
* Russian (ru)
* Chinese (Simplified) (zh\_cn)
* +24 additional languages

These will come with WebViewer automatically when you download the package. To always find the available languages supported by WebViewer, you can visit the [GitHub project](https://github.com/ApryseSDK/webviewer-ui/tree/master/i18n/).

## Adding languages

It is possible to add additional languages to your WebViewer in a few easy steps. Most of the on-screen text values are stored as JSON language files which you can edit in any text editor. Follow the steps below to start:

1. Begin by creating a copy of any of the language files. They can be found under the **lib/ui/i18n** directory. WebViewer will also use the files from this directory.
2. Rename the new file prefixed with ***translation-*** followed by the desired language code *(ex. translation-es.json)*. The language code can be anything and does not have to match an ISO language code.
3. Open the new file and edit the string values for your new language.
4. Save the file and try out the new language in WebViewer!

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
{
  "action": {
    "apply": "Apply",
    "applyAll": "Apply all",
    "cancel": "Cancel",
    "clear": "Clear",
    "close": "Close",
...
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Changing languages

To change languages in WebViewer, simply set the `defaultLanguage` option in your constructor to the language code that you want. This is without the *translation-* prefix. WebViewer will then instantiate in the language that was set.

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
WebViewerConstructor({
  path: '/path/to/your/webviewer',
  initialDoc: '/path/to/your/document.pdf',
  ui: uiOption,
  defaultLanguage: 'fr', // sets the default language to French
}, document.getElementById('viewer')).then(instance => {

});
```

{% endcode %}
{% endtab %}
{% endtabs %}

After instantiation, you can change the language programmatically by calling `setLanguage` on the instance and passing the corresponding language code from the file name. This method overrides `defaultLanguage` and caches the selection, ensuring the chosen language persists even after a browser refresh.

{% tabs %}
{% tab title="JavaScript (SDK v8.0+)" %}
{% code lineNumbers="true" %}

```js
WebViewer(...)
  .then(instance => {
    // change the language to Spanish
    instance.UI.setLanguage('es');
  });
```

{% endcode %}

[WebViewerInstance.setLanguage](https://sdk.apryse.com/api/web/UI.html#setLanguage__anchor)
{% endtab %}

{% tab title="JavaScript (SDK v6.0+)" %}
{% code lineNumbers="true" %}

```js
WebViewer(...)
  .then(instance => {
    // change the language to Spanish
    instance.setLanguage('es');
  });
```

{% endcode %}

[WebViewerInstance.setLanguage](https://sdk.apryse.com/api/web/UI.html#setLanguage__anchor)
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/web/ui-customization/localization/languages-and-internationalization.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
