Files
SpecForge/web/client/src/i18n.js
T
notkshitij 8e1348fb63 feat: add react-i18next with English and Hindi locale support.
- Add i18next + react-i18next + i18next-browser-languagedetector.
- EN/HI translation files covering all UI strings across every page and component.
- Language switcher button in Navbar; choice persisted to localStorage.
- document.documentElement.lang synced to active language in App.
- Skip-nav link and #main-content anchor for keyboard accessibility.
- aria-describedby on modal dialog; page title and meta description in index.html.
- Secure page title set to 'BIS SP-21 Standards.'
2026-05-03 00:01:14 +05:30

26 lines
684 B
JavaScript

import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import enTranslation from "./locales/en/translation.json";
import hiTranslation from "./locales/hi/translation.json";
i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
resources: {
en: { translation: enTranslation },
hi: { translation: hiTranslation },
},
fallbackLng: "en",
supportedLngs: ["en", "hi"],
interpolation: { escapeValue: false }, // React handles XSS
detection: {
order: ["localStorage", "navigator"],
caches: ["localStorage"],
},
});
export default i18n;