mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 03:40:56 +00:00
25 lines
761 B
TypeScript
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;
|