mirror of
https://github.com/apache/superset.git
synced 2026-07-15 03:05:43 +00:00
Follow-up to #39357, which inlined the Jed language pack into the bootstrap HTML to fix the code-split translation race (#35330). That made non-English full-page loads carry ~67KB (gzipped) of pack on every request since HTML is uncacheable. This keeps the synchronous-configuration guarantee but moves the pack to a content-addressed script: spa.html emits <script src="/language_pack/<lang>/<version>/script.js"> before the entry bundle, where <version> is a short content hash of the pack file. The endpoint serves window.__SUPERSET_LANGUAGE_PACK__ = {...} with Cache-Control: public, max-age=31536000, immutable, so browsers fetch the pack once per translation change instead of once per page load, and cache-bust automatically on upgrade (fixing the stale-pack window the unversioned /language_pack/<lang>/ fetch had under the 1-year SEND_FILE_MAX_AGE_DEFAULT). Details: - English emits no tag and pays nothing. - A stale version in a cached HTML page still gets current content, served no-cache so it can't pin under the wrong address. - Packs provided via COMMON_BOOTSTRAP_OVERRIDES_FUNC still ride the bootstrap payload and suppress the script tag (spa.html stashes them on window instead), preserving the historical workaround. - The endpoint is deliberately unauthenticated: catalogs are static public repo content with no user data, and must load for anonymous principals (login page, embedded). - preamble.ts fallback chain unchanged: bootstrap pack, window global, then async fetch if the script failed to load. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>