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,13 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import i18n, { LOCALE_KEY } from "./index";
|
||||
|
||||
export function useLocale() {
|
||||
const { i18n: instance } = useTranslation();
|
||||
|
||||
const setLocale = (lng: "en" | "sv") => {
|
||||
localStorage.setItem(LOCALE_KEY, lng);
|
||||
void i18n.changeLanguage(lng);
|
||||
};
|
||||
|
||||
return { locale: instance.language, setLocale };
|
||||
}
|
||||
Reference in New Issue
Block a user