mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-01 03:48:24 +00:00
I18n Translations (#2267)
* rebase * i18n-1 * add error info i18n * fix * fix * refactor: 删除error.json * delete useI18n
This commit is contained in:
@@ -18,7 +18,7 @@ export const langMap = {
|
||||
};
|
||||
|
||||
export const serviceSideProps = (content: any, ns: I18nNsType = []) => {
|
||||
return serverSideTranslations(content.locale, ['common', ...ns], null, content.locales);
|
||||
return serverSideTranslations(content.locale, ['common', 'error', ...ns], null, content.locales);
|
||||
};
|
||||
|
||||
export const getLng = (lng: string) => {
|
||||
|
@@ -3,10 +3,10 @@ import { AppDetailType } from '@fastgpt/global/core/app/type.d';
|
||||
import type { FeishuType, OutLinkEditType } from '@fastgpt/global/support/outLink/type.d';
|
||||
import { AppPermission } from '@fastgpt/global/support/permission/app/controller';
|
||||
import { NullPermission } from '@fastgpt/global/support/permission/constant';
|
||||
|
||||
import { i18nT } from '@fastgpt/web/i18n/utils';
|
||||
export const defaultApp: AppDetailType = {
|
||||
_id: '',
|
||||
name: '应用加载中',
|
||||
name: i18nT('common:core.app.loading'),
|
||||
type: AppTypeEnum.simple,
|
||||
avatar: '/icon/logo.svg',
|
||||
intro: '',
|
||||
|
@@ -4,7 +4,7 @@ import { UserAuthTypeEnum } from '@fastgpt/global/support/user/auth/constants';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
|
||||
import { i18nT } from '@fastgpt/web/i18n/utils';
|
||||
let timer: NodeJS.Timeout;
|
||||
|
||||
export const useSendCode = () => {
|
||||
@@ -29,8 +29,8 @@ export const useSendCode = () => {
|
||||
}, 1000);
|
||||
},
|
||||
{
|
||||
successToast: '验证码已发送',
|
||||
errorToast: '验证码发送异常',
|
||||
successToast: i18nT('user:password.code_sended'),
|
||||
errorToast: i18nT('user:password.code_send_error'),
|
||||
refreshDeps: [codeCountDown, feConfigs?.googleClientVerKey]
|
||||
}
|
||||
);
|
||||
@@ -38,12 +38,12 @@ export const useSendCode = () => {
|
||||
const sendCodeText = useMemo(() => {
|
||||
if (codeSending) return t('common:support.user.auth.Sending Code');
|
||||
if (codeCountDown >= 10) {
|
||||
return `${codeCountDown}s后重新获取`;
|
||||
return `${codeCountDown}${t('user:password.get_code_again')}`;
|
||||
}
|
||||
if (codeCountDown > 0) {
|
||||
return `0${codeCountDown}s后重新获取`;
|
||||
return `0${codeCountDown}${t('user:password.get_code_again')}`;
|
||||
}
|
||||
return '获取验证码';
|
||||
return t('user:password.get_code');
|
||||
}, [codeCountDown, codeSending, t]);
|
||||
|
||||
return {
|
||||
|
Reference in New Issue
Block a user