Perf: i18n change and captcha code. (#2625)

* perf: send captcha check

* perf: back router

* perf: i18n init

* perf: ui

* i18n

* perf: ui duration
This commit is contained in:
Archer
2024-09-05 23:01:12 +08:00
committed by GitHub
parent 478386c612
commit c614f8b9ca
43 changed files with 259 additions and 793 deletions

View File

@@ -7,8 +7,10 @@ import { UserType } from '@fastgpt/global/support/user/type';
import { useToast } from '@fastgpt/web/hooks/useToast';
import { useForm } from 'react-hook-form';
import { UserUpdateParams } from '@/types/user';
import { langMap, setLngStore } from '@/web/common/utils/i18n';
import { langMap } from '@/web/common/utils/i18n';
import { useRouter } from 'next/router';
import { useI18nLng } from '@fastgpt/web/hooks/useI18n';
import MySelect from '@fastgpt/web/components/common/MySelect';
import TimezoneSelect from '@fastgpt/web/components/common/MySelect/TimezoneSelect';
@@ -16,7 +18,7 @@ const Individuation = () => {
const { t, i18n } = useTranslation();
const { userInfo, updateUserInfo } = useUserStore();
const { toast } = useToast();
const router = useRouter();
const { onChangeLng } = useI18nLng();
const { reset } = useForm<UserUpdateParams>({
defaultValues: userInfo as UserType
@@ -55,14 +57,7 @@ const Individuation = () => {
}))}
onchange={(val: any) => {
const lang = val;
setLngStore(lang);
router.replace(
{
query: router.query
},
router.asPath,
{ locale: lang }
);
onChangeLng(lang);
}}
/>
</Box>

View File

@@ -40,14 +40,14 @@ const Account = ({ currentTab }: { currentTab: TabEnum }) => {
const tabList = [
{
icon: 'support/user/userLight',
label: t('common:user.Personal Information'),
label: t('user:personal_information'),
value: TabEnum.info
},
...(feConfigs?.isPlus
? [
{
icon: 'support/usage/usageRecordLight',
label: t('common:user.Usage Record'),
label: t('user:usage_record'),
value: TabEnum.usage
}
]
@@ -57,7 +57,7 @@ const Account = ({ currentTab }: { currentTab: TabEnum }) => {
? [
{
icon: 'support/bill/payRecordLight',
label: t('common:support.wallet.Bills'),
label: t('user:bill_and_invoices'),
value: TabEnum.bill
}
]
@@ -67,7 +67,7 @@ const Account = ({ currentTab }: { currentTab: TabEnum }) => {
? [
{
icon: 'support/account/promotionLight',
label: t('common:user.Promotion Record'),
label: t('user:promotion_records'),
value: TabEnum.promotion
}
]
@@ -83,14 +83,14 @@ const Account = ({ currentTab }: { currentTab: TabEnum }) => {
: []),
{
icon: 'support/user/individuation',
label: t('common:support.account.Individuation'),
label: t('user:personalization'),
value: TabEnum.individuation
},
...(feConfigs.isPlus
? [
{
icon: 'support/user/informLight',
label: t('common:user.Notice'),
label: t('user:notice'),
value: TabEnum.inform
}
]
@@ -98,7 +98,7 @@ const Account = ({ currentTab }: { currentTab: TabEnum }) => {
{
icon: 'support/account/loginoutLight',
label: t('common:user.Sign Out'),
label: t('user:sign_out'),
value: TabEnum.loginout
}
];