Embed Widget

Internationalization

How to configure multilingual support for the Tolki Chat widget.

Tolki Chat has built-in support for 6 languages: English, Italian, Spanish, French, German, and Portuguese.

Setting the Language

Use the lang attribute to set the interface language:

<tolki-chat bot="..." lang="it"></tolki-chat>

The lang attribute is bidirectional: it can be set via HTML and is automatically updated when the user changes language from within the chat.

Limiting Available Languages

Use the locales attribute to restrict the language selector:

<!-- Only Italian and English -->
<tolki-chat bot="..." locales="en,it"></tolki-chat>

Multilingual Text Attributes

Text attributes like name, message-placeholder, welcome-message, toggle-placeholder, suggestions, and toasts support internationalization. There are three formats:

Plain String

A single string used for all languages:

<tolki-chat bot="..." name="Assistant"></tolki-chat>

JSON Format

A JSON object with language keys:

<tolki-chat
  bot="..."
  name='{"en":"Assistant","it":"Assistente","es":"Asistente"}'
></tolki-chat>

Pipe Format

A compact format using lang:value pairs separated by |:

<tolki-chat
  bot="..."
  name="en:Assistant|it:Assistente|es:Asistente"
></tolki-chat>

Multilingual Arrays

Attributes like suggestions and toasts accept arrays with i18n support:

Comma-Separated

<tolki-chat bot="..." suggestions="Pricing,Support,Contact"></tolki-chat>

JSON i18n Array

<tolki-chat
  bot="..."
  suggestions='[{"en":"Pricing","it":"Prezzi"},{"en":"Support","it":"Assistenza"}]'
></tolki-chat>

Pipe Format (Comma-Separated)

<tolki-chat
  bot="..."
  suggestions="en:Pricing|it:Prezzi,en:Support|it:Assistenza"
></tolki-chat>