Files
edr-platform/apps/edr-hr-web/src/i18n/index.ts
2026-08-25 00:11:39 +03:00

25 lines
761 B
TypeScript

import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import en from "./en.json";
import am from "./am.json";
/**
* The UI ships English and Amharic. Most user-visible DATA is already bilingual
* `{am, en}` and rendered through `localized()`, which reads the active language
* — so switching here changes names and titles as well as chrome.
*/
void i18n.use(initReactI18next).init({
resources: { en: { translation: en }, am: { translation: am } },
lng: localStorage.getItem("hr-lang") ?? "en",
fallbackLng: "en",
interpolation: { escapeValue: false },
});
export const setLanguage = (language: "en" | "am") => {
localStorage.setItem("hr-lang", language);
void i18n.changeLanguage(language);
};
export default i18n;