Skip to content

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.

fix(splat): stamp script-written status text as i18n-owned and announce the loading overlay politely

nirholas93646019ea31
diff --git a/pages/splat.html b/pages/splat.html
index a99cbf957..627350db4 100644
--- a/pages/splat.html
+++ b/pages/splat.html
@@ -204,18 +204,18 @@
</div>
<h3 data-i18n="splat.load_a_splat_to_begin">Load a splat to begin</h3>
<p data-i18n-html="splat.drop_a_here_paste_a_url_or">Drop a <code>.ply</code>, <code>.spz</code>, <code>.splat</code>, <code>.ksplat</code>, or <code>.sog</code> here, paste a URL, or try a sample on the right.</p>
- <button class="sp-btn" id="sp-idle-pick" type="button" style="width:auto">Choose a file</button>
+ <button class="sp-btn" id="sp-idle-pick" type="button" style="width:auto" data-i18n="splat.choose_a_file">Choose a file</button>
</div>
<!-- Loading -->
- <div class="sp-overlay" id="sp-loading" hidden>
+ <div class="sp-overlay" id="sp-loading" role="status" aria-live="polite" hidden>
<div class="sp-spinner"></div>
<h3 id="sp-loading-title" data-i18n="splat.loading_splat_engine">Loading splat engine…</h3>
<p id="sp-loading-sub" data-i18n="splat.fetching_and_decoding_the_radiance_field">Fetching and decoding the radiance field.</p>
</div>
<!-- Error -->
- <div class="sp-overlay" id="sp-error" hidden>
+ <div class="sp-overlay" id="sp-error" role="alert" aria-live="assertive" hidden>
<div class="sp-glyph" style="color:#fca5a5;background:rgba(239,68,68,0.1);border-color:#5b2a2a">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 9v4 M12 17h.01"/><circle cx="12" cy="12" r="9"/></svg>
</div>
@@ -248,13 +248,13 @@
<input class="sp-input" id="sp-url" type="url" placeholder="https://…/avatar.ply" autocomplete="off" />
<button class="sp-btn sp-btn--primary" id="sp-load-url" type="button">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 12h14 M13 5l7 7-7 7"/></svg>
- Render
+ <span data-i18n="splat.render">Render</span>
</button>
</div>
<div class="sp-or">or</div>
<button class="sp-btn" id="sp-pick" type="button">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 3v12 M7 11l5 4 5-4 M5 21h14"/></svg>
- Upload a file
+ <span data-i18n="splat.upload_a_file">Upload a file</span>
</button>
<input id="sp-file" type="file" accept=".ply,.spz,.splat,.ksplat,.sog" hidden />
<p class="sp-hint" data-i18n="splat.files_stay_on_your_device_decoding_runs">Files stay on your device — decoding runs entirely in your browser.</p>
diff --git a/src/splat-viewer.js b/src/splat-viewer.js
index 8803cca7c..f8d42ee80 100644
--- a/src/splat-viewer.js
+++ b/src/splat-viewer.js
@@ -37,21 +37,28 @@ function showOnly(id) {
}
}
+// Write a live value into a node the markup also annotates for translation.
+// `data-i18n-owned` is src/i18n.js's handshake: the catalog pass lands after an
+// async /api/locale fetch, seconds in, and without the flag it reverts whatever
+// the script wrote back to the annotated source string. That is what used to
+// turn "Sorting splats..." back into "Loading splat engine..." mid-load.
+function setText(node, value) {
+ if (!node) return;
+ node.textContent = value;
+ node.dataset.i18nOwned = '1';
+}
+
function setLoading(title, detail) {
showOnly('sp-loading');
- const t = $('#sp-loading-title');
- const d = $('#sp-loading-detail');
- if (t) t.textContent = title;
- if (d) d.textContent = detail || '';
+ setText($('#sp-loading-title'), title);
+ setText($('#sp-loading-sub'), detail || '');
setHud(null);
}
function setError(title, detail) {
showOnly('sp-error');
- const t = $('#sp-error-title');
- const d = $('#sp-error-detail');
- if (t) t.textContent = title;
- if (d) d.textContent = detail || '';
+ setText($('#sp-error-title'), title);
+ setText($('#sp-error-sub'), detail || '');
setHud(null);
}
@@ -60,13 +67,20 @@ function setLive(label) {
setHud(label);
}
+// The label goes in its own node, never on #sp-hud itself: the HUD element also
+// holds the recenter and download controls, so writing textContent on it deletes
+// them from the DOM and every later query for them returns null.
function setHud(label) {
const hud = $('#sp-hud');
if (!hud) return;
hud.hidden = !label;
- if (label) hud.textContent = label;
+ const text = $('#sp-hud-label');
+ if (text) text.textContent = label || '';
const recenter = $('#sp-recenter');
if (recenter) recenter.hidden = !label;
+ // Leaving the live state also retires the previous scene's file: a download
+ // button still pointing at it over a fetch error hands back the wrong bytes.
+ if (!label) setDownload(null);
}
function setDownload(url, filename) {