Repository navigation
feat(widget): German localization (data-lang="de") - #6
Open
stigdreyer wants to merge 1 commit into
Open
stigdreyer wants to merge 1 commit into
stigdreyer wants to merge 1 commit into
Conversation
Add a full German dictionary for the widget (comments, reactions, polls) and generalize auto-detection to a SUPPORTED_LANGS list matched on the primary language subtag, so de-DE/de-AT/de-CH resolve to German. English remains the fallback; data-text overrides still take precedence. Also: 'Deutsch' option in the admin embed builder, lang type/docs in integrations, and widget-i18n tests incl. a key-parity check across locales. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Adds German as a third built-in widget language alongside English and Italian.
dedictionary inpackages/widget/src/widget.jscovering every key ofthe English dictionary (comments, replies, reactions, polls, relative
timestamps). It uses the formal register ("Sie"), the usual default for
German website UI.
SUPPORTED_LANGSlist, matched on theprimary subtag of
navigator.language(sode-DE,de-AT,de-CHall resolveto German). Italian detection behaves as before; everything else still
falls back to English. Adding a future locale is now just a dictionary entry
plus one list item.
langtype/docs updated (en | it | de | auto).static-content.tsregenerated vianpm run build, as CONTRIBUTING.md asks.No runtime/server changes and no new dependencies. The widget's security
invariants (textContent-only rendering, no cookies, no external requests) are
untouched.
Tests
New
tests/security/widget-i18n.test.ts(7 tests):data-lang="de"renders German copyde-AT, still detects Italian fromit-ITfr-FR) falls back to Englishdata-textoverrides still win over the German dictionaryitanddemust define exactly the English keys, so afuture key added only to
enfails CI instead of silently showing Englishor the raw key name. I checked it fails when a German key is removed.
Local results:
npx vitest run: 36 files passed, 1 skipped; 292 tests passed, 2 skippednpm run typecheck: cleannpm run build:site && npm run check:size: all budgets passContext
We're integrating StaticLayer on a German-language memorial/history site and
had been passing every string through
data-text. Upstreaming the locale letsother German-speaking sites use it directly, and means new UI strings arrive
translated instead of falling back to English.
🤖 Generated with Claude Code