feat(web): i18n with react-i18next (sv/en)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import i18n from "i18next";
|
||||
import { initReactI18next } from "react-i18next";
|
||||
import en from "./en.json";
|
||||
import sv from "./sv.json";
|
||||
|
||||
export const LOCALE_KEY = "locale";
|
||||
const stored =
|
||||
typeof localStorage !== "undefined" ? localStorage.getItem(LOCALE_KEY) : null;
|
||||
const fallback = "en";
|
||||
|
||||
void i18n.use(initReactI18next).init({
|
||||
resources: { en: { translation: en }, sv: { translation: sv } },
|
||||
lng: stored ?? fallback,
|
||||
fallbackLng: fallback,
|
||||
interpolation: { escapeValue: false },
|
||||
});
|
||||
|
||||
export default i18n;
|
||||
Reference in New Issue
Block a user