feat: i18n system - French/English internationalization
CI / lint (push) Failing after 20s
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / e2e (push) Has been skipped
CI / security (push) Failing after 9s

Core: i18n.js module with t(), setLocale(), initI18n()
- Flat key→string JSON locale files (fr.json + en.json, 165 keys)
- data-i18n / data-i18n-placeholder / data-i18n-attr DOM attributes
- Live locale switch via setLocale() - no page reload
- Language detection: localStorage > navigator.language > 'fr'
- Fallback: missing key → French → raw key

Wired into:
- app.js: await initI18n() early in init()
- config.js: profile save → await setLocale(), toasts + confirm via t()
- auth.js: network error toast via t()
- index.html: data-i18n on login form, profile section, search placeholder
This commit is contained in:
2026-06-18 13:31:11 -04:00
parent daab917ed1
commit f85482214e
7 changed files with 718 additions and 24 deletions
+2 -1
View File
@@ -2,6 +2,7 @@
import { state } from './state.js';
import { safeCreateIcons } from './utils.js';
import { showToast, closeHeaderMenu } from './ui.js';
import { t } from './i18n.js';
import { showWelcome } from './viewer.js';
// ---------------------------------------------------------------------------
@@ -33,7 +34,7 @@ async function api(path, opts) {
res = await fetch(path, mergedOpts);
} catch (err) {
if (err.name === "AbortError") throw err; // let callers handle abort
showToast("Erreur réseau — vérifiez votre connexion", "error");
showToast(t("auth.network_error"), "error");
throw err;
}
if (res.status === 401 && AuthManager._authEnabled) {