简体中文、英文、多语言框架、时区、夏令时、公制/英制和区域配置

This commit is contained in:
mmc
2026-10-09 13:30:55 +08:00
parent 0bc900cb5b
commit 5afaf1de75
14 changed files with 595 additions and 23 deletions

View File

@@ -3,9 +3,12 @@ import { Button, Dropdown } from 'antd';
import { GlobalOutlined } from '@ant-design/icons';
import { useTranslation } from 'react-i18next';
import type { MenuProps } from 'antd';
import { useAppDispatch } from '../store';
import { setLocale } from '../store/preferencesSlice';
export default function LanguageSwitcher() {
const { i18n ,t} = useTranslation();
const { i18n, t } = useTranslation();
const dispatch = useAppDispatch();
const currentLng = i18n.language?.startsWith('en') ? 'en' : 'zh';
const items: MenuProps['items'] = [
@@ -28,6 +31,7 @@ export default function LanguageSwitcher() {
const handleChange: MenuProps['onClick'] = ({ key }) => {
i18n.changeLanguage(key);
localStorage.setItem('i18nextLng', key);
dispatch(setLocale(key as 'zh' | 'en'));
};
return (