# Localization

## Set up language

To set up a default language, specify the [`locale`] property in the [Widget Constructor].
Check out the [Widget Constructor tutorial][tutorial-locale] on YouTube for an implementation example.

## Supported languages

The languages that the library supports are listed below.

| Language | `locale` value |
|-|:-:|
| Arabic | `ar` |
| Catalan (Spain) | `ca_ES` |
| Chinese (Taiwan) | `zh_TW` |
| Chinese | `zh` |
| English | `en` |
| French | `fr` |
| German (Germany) | `de` |
| Hebrew (Israel) | `he_IL` |
| Indonesian (Indonesia) | `id_ID` |
| Italian | `it` |
| Japanese | `ja` |
| Korean | `ko` |
| Malay (Malaysia) | `ms_MY` |
| Polish | `pl` |
| Portuguese | `pt` |
| Russian | `ru` |
| Spanish | `es` |
| Swedish | `sv` |
| Thai (Thailand) | `th` |
| Turkish | `tr` |
| Vietnamese | `vi` |

[//]: # (Persian "fa", Czech "cs", Dutch "nl_NL", Greek "el", Hungarian "hu_HU", and Romanian "ro" are no longer supported)

## Multiple languages

To support several languages, create a custom [Widget Constructor] for each of them
and recreate the widget every time users switch the language.

## Unsupported languages

The library only supports the predefined languages listed in the [table above](#supported-languages). It is **not possible** to add support for a completely new language or a custom locale that is not already included in the library.

If you specify an unsupported locale in the [Widget Constructor], the chart falls back to English and logs a console warning: *locale isn't supported*.

## Custom translations

If you want to provide custom translations for specific UI strings,
use the [`custom_translate_function`] property of the [Widget Constructor].
Note that a list of all internal UI strings cannot be provided.

## Right-to-left alignment

The library supports right-to-left (RTL) alignment for RTL languages such as Arabic and Hebrew.
Note that the alignment affects only toolbars, dialogs, and other UI elements except the chart.

[`custom_translate_function`]: https://charting-library-docs.xstaging.tv/latest/api/interfaces/Charting_Library.ChartingLibraryWidgetOptions#custom_translate_function
[`locale`]: https://charting-library-docs.xstaging.tv/latest/api/interfaces/Charting_Library.ChartingLibraryWidgetOptions#locale
[Widget Constructor]: https://charting-library-docs.xstaging.tv/latest/configuration/Widget-Constructor.md
[tutorial-locale]: https://www.youtube.com/watch?v=bdvmM3FNnSY&t=1353s

---

## Sitemap

- [All documentation pages](https://charting-library-docs.xstaging.tv/llms.txt)
- [Full page map with headings](https://charting-library-docs.xstaging.tv/docs_map.md)
