# Internationalized configuration

## Multi-language code comparison

| Code | Language   |
|------|------------|
| zh   | Chinese    |
| en   | English    |
| de   | German     |
| pt   | Portuguese |
| es   | Spanish    |
| hi   | Hindi      |
| id   | Indonesian |
| ja   | Japanese   |
| ko   | Korean     |
| th   | Thai       |
| vi   | Vietnamese |

## Samples

```typescript
new LinwitDocEditor({
    element: "#aiEditor",
    lang: "zh",
    i18n: {
        zh :{
            "undo": "Undo (Custom)",
            "redo": "Redo (Customize...)",
        },
        en:{
            "undo": "Undo",
            "redo": "Redo",
        }
    }
})
```


- **lang**：The language setting used by the editor.
- **i18n**： custom internationalization configuration.

::: warning
LinwitDocEditor has built-in internationalization content for `zh` (Chinese) and `en` (English). You only need to configure the `lang` attribute. However, you can override the built-in content using the `i18n` configuration or add additional languages.
:::

## Add support for other languages


```typescript
new LinwitDocEditor({
    element: "#aiEditor",
    lang: "otherLang",
    i18n: {
        otherLang :{
            "undo": "xxx",
            "redo": "xxx",
        },
    }
})
```

## Switch language

```typescript
const aiEditor = new LinwitDocEditor({
    element: "#aiEditor",
    lang: "zh",
    i18n: {
        zh :{
            "undo": "Undo (Custom)",
            "redo": "Redo (Customize...)",
        },
        en:{
            "undo": "Undo",
            "redo": "Redo",
        }
    }
})

//Switch the current language to English.
aiEditor.changeLang("en")
```

