Set up i18next with lazy per-route catalogs

Wire i18next into the compliance portal with a custom backend built on
import.meta.glob, so each _locales/*.json becomes its own lazily loaded
chunk keyed by a namespace derived from the folder path. The active
language is resolved from the browser, collapsing any fr*/en* tag to
fr-FR/en-US with en-US as the ultimate fallback; fallbackLng then only
covers individual missing keys.

Add an app-level default namespace catalog and switch the documents
page title to a translation key to exercise the lazy-loading path.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-06-28 13:54:24 +02:00
parent 6ec7efb4fc
commit 86077e6c27
8 changed files with 180 additions and 1 deletions

View File

@@ -63,6 +63,12 @@ export default defineConfig([
message:
"Use useMutation from #/lib/relay/useMutation, not react-relay.",
},
{
name: "i18next",
importNames: ["default"],
message:
"Don't import i18next's default (global singleton). Build a dedicated instance via `import { createInstance } from \"i18next\"`.",
},
],
},
],