Repository navigation
Conversation
About twenty UI strings were hard-coded in English with no prop to set
them: the header status line ("Type a message below", "Chat active",
"Assistant is typing...", ...), the End Chat and Reset controls, the
buttons after a chat has ended, the consent form's Accept / Cancel and
the control tooltips. A non-English site could not change them.
`labels?: Partial<WidgetLabels>` overrides any subset; keys left out keep
their English default (`defaultLabels`), so existing integrations render
exactly as before. The embed parses `labels` / `data-labels` as JSON like
`assistant-overrides`. While touching these buttons, the chat-mode send
button gets the tooltip the hybrid one already had, and the header's
close button gets an accessible title.
Covered by tests/widget-labels.spec.ts on a new fixture page with both
embed mechanisms, plus a control test on the existing fixture asserting
the English defaults are unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Sep 25, 2026
blaab2
added a commit
to blaab2/client-sdk-react
that referenced
this pull request
Sep 25, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Most of the widget's text can be set from props, but about twenty UI strings are hard-coded in English with no way to change them, so a non-English site always shows them in English:
Type a message below,Chat active,Assistant is typing...,Connecting...,Listening...,Assistant Speaking...,Ready to assist,Connected,Click the microphone to start,Choose voice or textEnd Chat(label + tooltip),Reset conversation(tooltip)Start new chat,CloseAccept,CancelSend message,Mute microphone,Unmute microphone,Start voice call,Stop voice callWe ship the widget on a German/French/English site and currently have to rewrite these strings in the DOM with a
MutationObserver, which is fragile. This PR adds the missing API.Change
A
labelsprop —Partial<WidgetLabels>— that overrides any subset of those strings. Keys left out keep their English default, so existing integrations render exactly as before.WidgetLabels(exported type) anddefaultLabels(English defaults,src/components/constants.ts);VapiWidgetmerges{ ...defaultLabels, ...labels }and passes the result toWidgetHeader,ConsentForm,ChatControls,HybridControls,VoiceControlsand the chat-ended screen.<vapi-widget labels='{"consentAccept":"Akzeptieren",…}'>anddata-labels='{…}'are parsed as JSON, the same wayassistant-overridesalready is (a smallJSON_PROPSlist replaces the two inlineassistantOverrides || assistantchecks).titlethe hybrid one already had, and the header's close button gets atitle(it had no accessible name at all).labelsrow in the props table and a Localization section listing every key with its default and where it shows, plus React, custom-element and data-attribute examples.No behaviour changes without the prop. I went with one object rather than ~20 individual props to keep the props table readable and so a translation table can be typed with
WidgetLabels; happy to switch to individual…Textprops if you prefer that style for attribute users.Tests
tests/widget-labels.spec.tson a new fixture page (test-widget-labels.html) — one<vapi-widget>with alabelsJSON attribute and one data-attribute embed withdata-labels:labels, the English defaults are unchanged (control group).Locally:
npm run lint,npm run type-check,npm run format:check,npm run build,npm run build:widgetandnpm run test:ciall pass.