Supported Languages
| Language | Code | Language | Code |
|---|---|---|---|
| English | en | Japanese | ja |
| Spanish | es | Korean | ko |
| French | fr | Chinese | zh |
| German | de | Arabic | ar |
| Italian | it | Hindi | hi |
| Portuguese | pt | Turkish | tr |
| Dutch | nl | Vietnamese | vi |
| Polish | pl | Thai | th |
| Russian | ru | Indonesian | id |
| Swedish | sv | Malay | ms |
| Danish | da | Czech | cs |
| Norwegian | no | Ukrainian | uk |
| Finnish | fi | Hebrew | he |
How Language Detection Works
The widget uses a priority-based detection system to determine which language to display:Detection Priority
1
data-lang attribute (Highest Priority)
Explicitly set the language on your embed script:
2
HTML lang attribute
The widget reads your page’s declared language:
3
Browser Language (Lowest Priority)
Falls back to the visitor’s browser language preference (
navigator.language), e.g., en-US, fr-CA.Cascade Fallback
When a language is detected, Ansa uses smart fallback to find the best matching translation:- Exact match —
fr-CA(Canadian French) - Base language —
fr(French) - Default language — Your configured default (e.g.,
en)
Adding Translations
You can customize all visitor-facing messages for each language.Step 1: Navigate to Translations
- Go to your agent’s Embed page
- Scroll down to the Translations section
Step 2: Add a New Language
- Click the language dropdown and select a language
- Click “Add Translation”
Step 3: Customize Messages
For each language, you can customize:| Field | Description |
|---|---|
| Display Name | The assistant’s name shown in the chat header |
| Initial Message | The greeting message when the chat opens |
| Suggested Messages | Quick-reply buttons shown to visitors (one per line) |
| Message Placeholder | Placeholder text in the input field |
| Dismissible Message | Text shown before the chat is opened |
| Welcome Bubbles | Preview messages shown on the chat bubble (one per line) |
Step 4: Set Default Language
Choose which language to use when no translation matches the visitor’s language.Dynamic Language Switching
For websites with language switchers, you can change the widget language at runtime using JavaScript:Set Language
Get Current Language
Example: Sync with Website Language Switcher
Automatic Detection During Onboarding
When you create a new agent via onboarding, Ansa automatically:- Detects your website’s primary language from the
<html lang>attribute - Sets default messages in that language
- Discovers alternate languages from
<link rel="alternate" hreflang="...">tags - Creates translation records for each discovered language
Best Practices
Always Set a Default Language
Always Set a Default Language
Choose a default language that most of your visitors understand. This is used when no translation matches.
Use Regional Variants When Needed
Use Regional Variants When Needed
If you serve specific regions, create translations for regional variants:
es— Spanish (general)es-MX— Mexican Spanishes-AR— Argentinian Spanish
Keep Messages Concise
Keep Messages Concise
Translations may be longer in some languages. Keep your messages concise to ensure they display well across all languages.
Test Each Language
Test Each Language
Preview your widget in each language to ensure messages display correctly and feel natural.
Use data-lang for Multilingual Sites
Use data-lang for Multilingual Sites
If your website has a language switcher, use the
data-lang attribute or window.ansa.setLanguage() to ensure the widget matches the page language: