Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
i18n: ?lang= deep links outrank stored preference; switcher joins corner stack
nirholas86a9a72105ad
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex bcf407298..bdb13c048 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Docs · Assistant widget** (`/docs/assistant-widget`) — Add a 3D avatar assistant to any website: the one-tag script, the @three-ws/assistant npm package, and the assistant-widget MCP server for AI agents.- **Tutorial · Add a 3D Avatar Assistant** (`/tutorials/add-a-3d-assistant`) — Step-by-step: add a floating 3D avatar assistant to any website with one script tag, configure the avatar, background, and brand, drive it from your own code, or have an AI agent generate the embed via MCP.- **Concierge ships to npm and the MCP registry, with a full examples set** — The Concierge chat widget is now installable as the @three-ws/concierge npm package, and there is a companion Model Context Protocol server, @three-ws/concierge-mcp, on the official MCP registry. That server lets any AI assistant ask a website's concierge a question (it fetches the page and answers grounded in the real content), generate the copy-paste embed code for a site, and list the available 3D avatars. Six runnable examples now ship with the SDK, covering the one-tag install, the web component, the imperative API, a custom GLB avatar, a React wrapper, and pointing the widget at your own answer backend. (`/docs/concierge`) `[sdk, docs]`+- **Language links now always win, and the switcher stays out of the way** — Two fixes for the new 41-language experience. Opening a link with a language in the URL (like ?lang=te for Telugu) now always shows that language, even if you had previously browsed in another one; before, your first visit's language silently overrode every shared link. The floating language switcher also joins the site's shared bottom-corner layout, so it no longer overlaps the Getting Started guide. (`/what-is?lang=te`) `[fix, improvement]`- **The assistant widget ships as an npm package and an MCP server** — The 3D avatar assistant widget is now installable three ways. Beyond the one-tag script, there is an npm package, @three-ws/assistant, for bundler projects (the one-tag build is generated from it, so they never drift), and a free MCP server, @three-ws/assistant-mcp, published to the official Model Context Protocol registry as io.github.nirholas/assistant-widget. Any AI agent (Claude Code, Cursor, Claude Desktop) can now ask for a widget in plain language and get back a paste-ready embed: build_assistant_widget turns a config into a script tag, a frame URL, and a ThreeAssistant.init() call, and list_assistant_options returns every avatar, background, and mode. Full developer docs at /docs/assistant-widget and a step-by-step tutorial walk through every option, the JavaScript API, and the agent workflow. (`/docs/assistant-widget`) `[sdk, feature, docs]`## 2026-07-18diff --git a/data/changelog.json b/data/changelog.jsonindex c8cbf9127..2763c47ff 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -14777,6 +14777,16 @@"feature"],"link": "/"+ },+ {+ "date": "2026-07-19",+ "title": "Language links now always win, and the switcher stays out of the way",+ "summary": "Two fixes for the new 41-language experience. Opening a link with a language in the URL (like ?lang=te for Telugu) now always shows that language, even if you had previously browsed in another one; before, your first visit's language silently overrode every shared link. The floating language switcher also joins the site's shared bottom-corner layout, so it no longer overlaps the Getting Started guide.",+ "tags": [+ "fix",+ "improvement"+ ],+ "link": "/what-is?lang=te"}]}diff --git a/docs/i18n.md b/docs/i18n.mdindex 98aebb220..6b179501c 100644--- a/docs/i18n.md+++ b/docs/i18n.md@@ -161,7 +161,7 @@ on any page that includes it:<!-- accessible language picker -->```-It detects the locale (`localStorage` → `?lang=` → `navigator.languages` →+It detects the locale (`?lang=` → `localStorage` → `navigator.languages` →default), fetches `/locales/<code>.json` once, rewrites the annotated DOM, sets`<html lang>`/`dir` (RTL-aware), and persists the choice. Missing translationsfall back to English, so partial locales degrade gracefully. `window.threewsI18n`diff --git a/public/changelog.json b/public/changelog.jsonindex 8b4e75a1b..a934fcf8c 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-19T00:15:05.289Z",+ "generated_at": "2026-07-19T02:04:17.753Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -37,6 +37,17 @@"docs"]},+ {+ "date": "2026-07-19",+ "type": "update",+ "title": "Language links now always win, and the switcher stays out of the way",+ "summary": "Two fixes for the new 41-language experience. Opening a link with a language in the URL (like ?lang=te for Telugu) now always shows that language, even if you had previously browsed in another one; before, your first visit's language silently overrode every shared link. The floating language switcher also joins the site's shared bottom-corner layout, so it no longer overlaps the Getting Started guide.",+ "link": "/what-is?lang=te",+ "tags": [+ "fix",+ "improvement"+ ]+ },{"date": "2026-07-19","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex f170da9fb..fb9016546 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -30,6 +30,14 @@<category>sdk</category><description>The Concierge chat widget is now installable as the @three-ws/concierge npm package, and there is a companion Model Context Protocol server, @three-ws/concierge-mcp, on the official MCP registry. That server lets any AI assistant ask a website's concierge a question (it fetches the page and answers grounded in the real content), generate the copy-paste embed code for a site, and list the available 3D avatars. Six runnable examples now ship with the SDK, covering the one-tag install, the web component, the imperative API, a custom GLB avatar, a React wrapper, and pointing the widget at your own answer backend.</description></item>+ <item>+ <title>Language links now always win, and the switcher stays out of the way</title>+ <link>https://three.ws/what-is?lang=te</link>+ <guid isPermaLink="false">2026-07-19:Language links now always win, and the switcher stays out of the way</guid>+ <pubDate>Sun, 19 Jul 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Two fixes for the new 41-language experience. Opening a link with a language in the URL (like ?lang=te for Telugu) now always shows that language, even if you had previously browsed in another one; before, your first visit's language silently overrode every shared link. The floating language switcher also joins the site's shared bottom-corner layout, so it no longer overlaps the Getting Started guide.</description>+ </item><item><title>The assistant widget ships as an npm package and an MCP server</title><link>https://three.ws/docs/assistant-widget</link>diff --git a/public/features.json b/public/features.jsonindex f5e299c09..33fe7cff4 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-19T00:15:05.276Z",+ "generated_at": "2026-07-19T02:04:17.739Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/i18n.js b/src/i18n.jsindex baba3105e..e62c221e4 100644--- a/src/i18n.js+++ b/src/i18n.js@@ -139,14 +139,16 @@ function supported(code, manifest) {return manifest.locales.find((l) => l.code === code);}-// localStorage → ?lang= → navigator languages → manifest default.-function detectLocale(manifest) {- if (!hasDOM) return manifest.default;- const stored = safeStorage.get(STORAGE_KEY);+// ?lang= → localStorage → navigator languages → manifest default.+// The URL param must outrank the stored preference: sitemap hreflang entries+// and shared links all carry ?lang=xx, and a returning visitor (whose first+// visit stored a locale) would otherwise see every one of those deep links+// silently ignored. Honoring the param also stores it, so the choice sticks.+// Pure and exported for tests; detectLocale feeds it the browser's values.+export function pickLocale({ query, stored, navLangs }, manifest) {+ if (query && supported(query, manifest)) return query;if (stored && supported(stored, manifest)) return stored;- const q = new URLSearchParams(location.search).get('lang');- if (q && supported(q, manifest)) return q;- for (const nav of navigator.languages || [navigator.language || '']) {+ for (const nav of navLangs || []) {if (!nav) continue;if (supported(nav, manifest)) return nav;const base = nav.split('-')[0];@@ -158,6 +160,18 @@ function detectLocale(manifest) {return manifest.default;}+function detectLocale(manifest) {+ if (!hasDOM) return manifest.default;+ return pickLocale(+ {+ query: new URLSearchParams(location.search).get('lang'),+ stored: safeStorage.get(STORAGE_KEY),+ navLangs: navigator.languages || [navigator.language || ''],+ },+ manifest,+ );+}+async function loadCatalog(code) {return fetchJSON(`${LOCALES_BASE}/${code}.json`).catch(() => ({}));}@@ -284,7 +298,14 @@ async function mountFloatingSwitcher() {@media print { .twx-i18n-fab { display: none; } }`;document.head.appendChild(style);host.appendChild(document.createElement('lang-switcher'));- document.body.appendChild(host);+ // Flow into the shared bottom-right corner stack (public/corner-stack.js) so+ // the switcher never piles onto the "Getting started" pill or other corner+ // cards. The stack's #id CSS overrides the fixed positioning above, which+ // remains the standalone fallback on pages that don't ship the stack (embeds,+ // generated shells). Priority 10 sits above the pill (30 = owns the corner).+ host.setAttribute('data-corner-priority', '10');+ if (window.twsCornerStack) window.twsCornerStack.mount(host);+ else document.body.appendChild(host);}// Inject <link rel="alternate" hreflang> tags into <head> for the current path,diff --git a/tests/i18n.test.js b/tests/i18n.test.jsindex dad5eed65..54616cc0b 100644--- a/tests/i18n.test.js+++ b/tests/i18n.test.js@@ -21,7 +21,7 @@ import {setDeep,getDeep,} from '../scripts/lib/i18n-shared.mjs';-import { resolveKey, interpolate, translate } from '../src/i18n.js';+import { resolveKey, interpolate, translate, pickLocale } from '../src/i18n.js';describe('extractFromHtml', () => {it('pulls text, html, and attribute keys with their English source values', () => {@@ -95,6 +95,39 @@ describe('lintLocale', () => {});});+describe('locale detection priority', () => {+ const manifest = {+ default: 'en',+ locales: [+ { code: 'en', name: 'English', dir: 'ltr' },+ { code: 'te', name: 'తెలుగు', dir: 'ltr' },+ { code: 'pt-BR', name: 'Português (BR)', dir: 'ltr' },+ ],+ };++ it('honors an explicit ?lang= over a stored preference (deep links win)', () => {+ // Regression: a returning visitor's stored 'en' used to silently override+ // every ?lang= deep link from the sitemap's hreflang alternates.+ expect(pickLocale({ query: 'te', stored: 'en', navLangs: ['en-US'] }, manifest)).toBe('te');+ });++ it('falls back to the stored preference when the URL has no ?lang=', () => {+ expect(pickLocale({ query: null, stored: 'te', navLangs: ['en-US'] }, manifest)).toBe('te');+ });++ it('ignores an unsupported ?lang= value', () => {+ expect(pickLocale({ query: 'xx', stored: 'te', navLangs: [] }, manifest)).toBe('te');+ });++ it('matches navigator languages by base code (pt → pt-BR)', () => {+ expect(pickLocale({ query: null, stored: null, navLangs: ['pt'] }, manifest)).toBe('pt-BR');+ });++ it('returns the manifest default when nothing matches', () => {+ expect(pickLocale({ query: null, stored: null, navLangs: ['xx-YY'] }, manifest)).toBe('en');+ });+});+describe('runtime resolution', () => {const catalog = { home: { hi: 'Hola {{name}}' } };const fallback = { home: { hi: 'Hi {{name}}', only_en: 'English only' } };