fix translation length + repair localized /data/
Merged
RI
2mo ago+315+315+012345678901234567890123456789-44-44-01234567890123456789
Summary
- Instruct the edge translation worker to keep translations roughly the same length as the source (±30%) so UI layouts stay intact.
- Honor
translate="no"andclass="notranslate"when collecting HTML segments. - Protect the
Live Updateproduct name and bumpTRANSLATION_CACHE_VERSIONso stale locale caches refresh. - Fix
/data/: bootstrap metrics live in an inline JSON script (not a huge attribute), and live metric regions are markedtranslate="no". - Escape bootstrap JSON for script embeds (
jsonForInlineScript) so</script>cannot break out of the tag.
Why /fr/data/ was broken
Localized /data/ pages were still serving the pre-#947 loading shell (spinner + empty tables, no bootstrap metrics). English already SSR-boots metrics. All locales (fr, de, es, …) were stuck on that stale translated HTML.
After deploy of web + translation worker, the cache version bump forces a fresh translation of the fixed English page.
Test plan
-
bun run checkinapps/translation-worker(parser tests includetranslate=no) -
jsonForInlineScriptround-trips and blocks</script>breakouts - Deploy translation worker, then hit
/fr/data/and confirm SSR tables + no loading shell - Confirm chrome copy is translated, metric rows stay English/stable
- Spot-check that short nav/labels are not expanded into long sentences


Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by CodeRabbit
-
New Features
- Improved translation handling for excluded content, markup, attributes, and protected terms such as “Live Update.”
- Added safeguards for translation length, with retries and source-text fallback when needed.
- Improved loading and display of data metrics, charts, and tables.
- Added clearer screen-reader status updates for dynamic data.
-
Bug Fixes
- Prevented dynamic data and marked content from being translated unintentionally.
- Improved safe handling of metrics embedded in the data page.