From 9b395b6aa5b9b1a81e654c56e6970727019f0687 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 18 Mar 2026 08:36:48 +0100 Subject: [PATCH] feat(i18n): Add internationalization support - Add i18n module with locale loading and translation helpers - Add English (en) and French (fr) locale files with comprehensive translations - Inject locale data into dashboard HTML via server - Add /api/locales endpoint for locale info - Add t() translation function to dashboard Translated elements: - Boot sequence (initialization, connecting, sweep complete) - Header pills (sweep, sources, delta, risk indicators) - Left rail panels (sensor grid, nuclear watch, risk gauges, space watch) - Layer names and descriptions - Map legend items - Lower panels (news ticker, sweep delta, macro+markets, trade ideas) - Right rail (OSINT stream) - Badges and status indicators Supported languages: English (default), French Set CRUCIX_LANG=fr to switch to French --- dashboard/public/jarvis.html | 121 +++++++----- lib/i18n.mjs | 137 +++++++++++++ locales/en.json | 359 +++++++++++++++++++++++++++++++++++ locales/fr.json | 359 +++++++++++++++++++++++++++++++++++ server.mjs | 22 ++- 5 files changed, 944 insertions(+), 54 deletions(-) create mode 100644 lib/i18n.mjs create mode 100644 locales/en.json create mode 100644 locales/fr.json diff --git a/dashboard/public/jarvis.html b/dashboard/public/jarvis.html index d83955a..aab4025 100644 --- a/dashboard/public/jarvis.html +++ b/dashboard/public/jarvis.html @@ -363,6 +363,22 @@ body.low-perf .ticker-wrap::-webkit-scrollbar-thumb{background:rgba(100,240,200, `; + html = html.replace('', `${localeScript}\n`); + + res.type('html').send(html); } }); @@ -263,6 +272,15 @@ app.get('/api/health', (req, res) => { llmProvider: config.llm.provider, telegramEnabled: !!(config.telegram.botToken && config.telegram.chatId), refreshIntervalMinutes: config.refreshIntervalMinutes, + language: currentLanguage, + }); +}); + +// API: available locales +app.get('/api/locales', (req, res) => { + res.json({ + current: currentLanguage, + supported: getSupportedLocales(), }); });