The Locale API: One Widget, Four Languages
Swiss support means German, French, Italian, and English on top. The widget keeps up with a single line:
zE('messenger:set', 'locale', 'fr'); // de, fr, it, en …
The switch happens live, no reload. Placeholders, buttons, system text, and the privacy banners flip on the spot. Zendesk ships the translations.
What the API does, and what it doesn’t
- Flips instantly: all the widget’s interface text.
- Not translated automatically: bot replies and messages from your team. Those come from the bot configuration, or from a human. A multilingual AI Agent is its own craft. In the reference project, seven agents in four languages were running.
- The widget languages have to be enabled in the Admin Center, or the locale falls back to the default.
The right way to wire it in: onto the site’s language switch
In a real build, the locale call isn’t a button of its own. It hangs off the page’s language switch:
function setzeSprache(locale) {
document.documentElement.lang = locale;
zE('messenger:set', 'locale', locale);
// … Rest des Sprachwechsels der Website
}
Switch to Français and you get support in French too, without anyone setting that up separately. On the initial load, one rule: set the locale before the render, and the widget starts out in the right language.