perf: default lang

This commit is contained in:
archer
2023-09-05 11:44:31 +08:00
parent 7a926b7086
commit 64fde42c87
3 changed files with 21 additions and 20 deletions

View File

@@ -1,21 +1,10 @@
import React, { useState } from 'react';
import { Menu, MenuButton, MenuItem, MenuList, MenuButtonProps } from '@chakra-ui/react';
import { getLangStore, LangEnum, setLangStore } from '@/utils/i18n';
import { getLangStore, LangEnum, setLangStore, langMap } from '@/utils/i18n';
import MyIcon from '@/components/Icon';
import { useTranslation } from 'react-i18next';
import { useRouter } from 'next/router';
const langMap = {
[LangEnum.en]: {
label: 'English',
icon: 'language_en'
},
[LangEnum.zh]: {
label: '简体中文',
icon: 'language_zh'
}
};
const Language = (props: MenuButtonProps) => {
const router = useRouter();
const { i18n } = useTranslation();