Skip to Content
WidgetSetupsTranslate the widget

Translate the widget

Use data-language to set the widget UI language. Built-in UI strings change automatically; your custom strings do not.

Set a language

<script async src="https://cdn.knoku.com/widget.js" data-project-id="YOUR_PROJECT_ID" data-language="en" data-greeting="How can I help?" data-launcher-text="Ask Docs" data-suggested-questions="How do I get started?,How does pricing work?" ></script>

When data-language is omitted, the widget reads the browser language and picks the first supported match. Unsupported languages fall back to English.

Supported languages

CodeLanguage
enEnglish
trTurkish
deGerman
esSpanish
frFrench
itItalian
ptPortuguese
nlDutch
jaJapanese
koKorean
zhChinese
ruRussian
csCzech

Auto-translated strings

The widget translates built-in UI strings such as:

  • Input placeholder and send label
  • Close and attachment labels
  • Feedback hover labels
  • Tool status text
  • AI disclaimer line above the composer
  • Default consent copy
  • Connection and error messages

Strings you provide yourself

These values are used exactly as you provide them:

  • data-greeting
  • data-suggested-questions
  • data-launcher-text
  • data-launcher-subtitle
  • Custom data-consent-* overrides

The panel header label is currently fixed as Ask AI.

Multi-language sites

Use the npm package when language, greeting, and suggestions come from app state:

import { initKnokuWidget } from '@knoku/widget' await initKnokuWidget({ projectId: 'YOUR_PROJECT_ID', language: currentLocale, greeting: dictionary.widgetGreeting, suggestedQuestions: dictionary.widgetSuggestions, })

Calling initKnokuWidget() again replaces the previous instance, which works well for locale route changes.

Suggested questions with commas

The CDN attribute is comma-separated. Commas inside a question must be escaped as \, (the dashboard does this when generating the snippet). Or use npm:

suggestedQuestions: [ 'How do I install, configure, and verify the widget?', 'What is the pricing model?', ]
Last updated on