refactor i18n

This commit is contained in:
Alex Holliday committed 2025-05-30 15:03:32 -07:00
1 parent 4f678827f3
commit 70055c712b
12 files changed
+38 -27

No files matched your search

+4 -3
View File
@@ -3,15 +3,17 @@ import { Box, MenuItem, Select, Stack } from "@mui/material";
import { useTheme } from "@emotion/react";
import "flag-icons/css/flag-icons.min.css";
import { useSelector } from "react-redux";
import { useDispatch } from "react-redux";
import { setLanguage } from "../Features/UI/uiSlice";
const LanguageSelector = () => {
const { i18n } = useTranslation();
const theme = useTheme();
const { language } = useSelector((state) => state.ui);
const dispatch = useDispatch();
const handleChange = (event) => {
const newLang = event.target.value;
i18n.changeLanguage(newLang);
dispatch(setLanguage(newLang));
};
const languages = Object.keys(i18n.options.resources || {});
@@ -32,7 +34,6 @@ const LanguageSelector = () => {
}
if (parsedLang.includes("-")) {
parsedLang = parsedLang.split("-")[1].toLowerCase();
console.log("parsedLang", parsedLang);
}
const flag = parsedLang ? `fi fi-${parsedLang}` : null;