From 15de9d738c4a85be1a96726c6114181caef87eeb Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Mon, 26 Oct 2026 16:54:01 -0700 Subject: [PATCH] fix(i18n): mark style labels without loading the catalogs (#1421) The style shaders and visualPresets imported msg() from src/i18n/index.js, which loads every locale catalog. The share-view codec reads the styles' defaults, so a server bundling the codec carried about 0.9 MB of translations it never uses. They now import the catalog-free marker, as other portable modules do; the codec's bundle drops from about 1 MB to 130 KB. --- changelog.d/1421-style-modules-skip-catalogs.md | 3 +++ scripts/package-boundaries.json | 13 +++---------- src/styles/anime.js | 2 +- src/styles/noir.js | 2 +- src/styles/retro.js | 2 +- src/styles/snow.js | 2 +- src/styles/surveillance.js | 2 +- src/styles/thermal.js | 2 +- src/ui/visualPresets.js | 2 +- 9 files changed, 13 insertions(+), 17 deletions(-) create mode 100644 changelog.d/1421-style-modules-skip-catalogs.md diff --git a/changelog.d/1421-style-modules-skip-catalogs.md b/changelog.d/1421-style-modules-skip-catalogs.md new file mode 100644 index 000000000..bc79c5cd6 --- /dev/null +++ b/changelog.d/1421-style-modules-skip-catalogs.md @@ -0,0 +1,3 @@ +- The visual styles and their presets mark their labels with the catalog-free + `msg()`, so the share-link codec, and any server that loads it, no longer + bundles every translation catalog (about 0.9 MB) (samehkhamis, #1421). diff --git a/scripts/package-boundaries.json b/scripts/package-boundaries.json index d32997d5c..b42d90fdc 100644 --- a/scripts/package-boundaries.json +++ b/scripts/package-boundaries.json @@ -463,11 +463,7 @@ "src/styles/anime.js", "src/styles/noir.js", "src/styles/snow.js", - "src/i18n/index.js", - "src/i18n/locale.js", - "src/i18n/locales/es.json", - "src/i18n/locales/ru.json", - "src/i18n/locales/zh-CN.json" + "src/i18n/marker.js" ], "external": ["cesium"] }, @@ -3330,6 +3326,7 @@ "src/ui/visualPresets.js", "src/ui/visualSettings.js", "src/ui/segmentedControl.js", + "src/i18n/marker.js", "src/i18n/index.js", "src/i18n/locale.js", "src/i18n/locales/es.json", @@ -3907,11 +3904,7 @@ "src/data/idSwitches.js", "src/data/detectionPolicy.js", "src/scopeMaskPolicy.js", - "src/i18n/index.js", - "src/i18n/locale.js", - "src/i18n/locales/es.json", - "src/i18n/locales/ru.json", - "src/i18n/locales/zh-CN.json" + "src/i18n/marker.js" ], "external": [] }, diff --git a/src/styles/anime.js b/src/styles/anime.js index deb79c355..4097ecc48 100644 --- a/src/styles/anime.js +++ b/src/styles/anime.js @@ -1,4 +1,4 @@ -import { msg } from '../i18n/index.js'; +import { msg } from '../i18n/marker.js'; /** * Anime / Studio Ghibli Style — Cel-shading + Saturation boost diff --git a/src/styles/noir.js b/src/styles/noir.js index 5ea458859..472dde990 100644 --- a/src/styles/noir.js +++ b/src/styles/noir.js @@ -1,4 +1,4 @@ -import { msg } from '../i18n/index.js'; +import { msg } from '../i18n/marker.js'; /** * Noir Style — Desaturation + High Contrast + Vignette diff --git a/src/styles/retro.js b/src/styles/retro.js index 396f95853..f4e2d8f62 100644 --- a/src/styles/retro.js +++ b/src/styles/retro.js @@ -1,4 +1,4 @@ -import { msg } from '../i18n/index.js'; +import { msg } from '../i18n/marker.js'; /** * CRT Terminal — Dynamic CRT Monitor Aesthetic diff --git a/src/styles/snow.js b/src/styles/snow.js index 569f6cbbc..a4db0a029 100644 --- a/src/styles/snow.js +++ b/src/styles/snow.js @@ -1,4 +1,4 @@ -import { msg } from '../i18n/index.js'; +import { msg } from '../i18n/marker.js'; /** * Snow Style — White overlay + Desaturation + Falling particles diff --git a/src/styles/surveillance.js b/src/styles/surveillance.js index 810ac7e4f..5eae7fdd3 100644 --- a/src/styles/surveillance.js +++ b/src/styles/surveillance.js @@ -1,4 +1,4 @@ -import { msg } from '../i18n/index.js'; +import { msg } from '../i18n/marker.js'; /** * Night Vision / NVG — PVS-14 Image Intensifier Emulation diff --git a/src/styles/thermal.js b/src/styles/thermal.js index 90aff5312..f62327507 100644 --- a/src/styles/thermal.js +++ b/src/styles/thermal.js @@ -1,4 +1,4 @@ -import { msg } from '../i18n/index.js'; +import { msg } from '../i18n/marker.js'; /** * FLIR — Forward Looking Infrared diff --git a/src/ui/visualPresets.js b/src/ui/visualPresets.js index 48a758a33..e3830601a 100644 --- a/src/ui/visualPresets.js +++ b/src/ui/visualPresets.js @@ -5,7 +5,7 @@ import { snowShader } from '../styles/snow.js'; import { nightVisionShader } from '../styles/surveillance.js'; import { thermalShader } from '../styles/thermal.js'; import { BLOOM_INTENSITY_DEFAULT } from '../bloom.js'; -import { msg } from '../i18n/index.js'; +import { msg } from '../i18n/marker.js'; /** Duration (ms) for shader intensity crossfade between style presets. */ export const TRANSITION_DURATION_MS = 500;