user timezone

This commit is contained in:
archer
2023-09-05 11:30:52 +08:00
parent 562fd2692d
commit 7a926b7086
18 changed files with 166 additions and 65 deletions

View File

@@ -3,6 +3,7 @@ import { Menu, MenuButton, MenuItem, MenuList, MenuButtonProps } from '@chakra-u
import { getLangStore, LangEnum, setLangStore } from '@/utils/i18n';
import MyIcon from '@/components/Icon';
import { useTranslation } from 'react-i18next';
import { useRouter } from 'next/router';
const langMap = {
[LangEnum.en]: {
@@ -16,6 +17,7 @@ const langMap = {
};
const Language = (props: MenuButtonProps) => {
const router = useRouter();
const { i18n } = useTranslation();
const [language, setLanguage] = useState<`${LangEnum}`>(getLangStore());
@@ -43,6 +45,7 @@ const Language = (props: MenuButtonProps) => {
setLangStore(lang);
setLanguage(lang);
i18n?.changeLanguage?.(lang);
router.reload();
}}
>
{lang.label}