perf: i18n (#4740)

* feat: login limit time config

* doc

* perf: code

* i18n update

* update lock

* fix: ts

* update package
This commit is contained in:
Archer
2025-05-05 16:16:59 +08:00
committed by GitHub
parent fdd4e9edbd
commit 864eff47c7
229 changed files with 1128 additions and 1293 deletions

View File

@@ -5,7 +5,7 @@ import { isProduction } from '@fastgpt/global/common/system/constants';
export const useBeforeunload = (props?: { callback?: () => any; tip?: string }) => {
const { t } = useTranslation();
const { tip = t('common:common.Confirm to leave the page'), callback } = props || {};
const { tip = t('common:comfirm_leave_page'), callback } = props || {};
useEffect(() => {
const listen = isProduction

View File

@@ -18,12 +18,12 @@ export const useConfirm = (props?: {
const map = useMemo(() => {
const map = {
common: {
title: t('common:common.confirm.Common Tip'),
title: t('common:action_confirm'),
variant: 'primary',
iconSrc: 'common/confirm/commonTip'
},
delete: {
title: t('common:common.Delete Warning'),
title: t('common:delete_warning'),
variant: 'dangerFill',
iconSrc: 'common/confirm/deleteTip'
}
@@ -60,8 +60,8 @@ export const useConfirm = (props?: {
const ConfirmModal = useMemoizedFn(
({
closeText = t('common:common.Cancel'),
confirmText = t('common:common.Confirm'),
closeText = t('common:Cancel'),
confirmText = t('common:Confirm'),
isLoading,
bg,
countDown = 0

View File

@@ -20,7 +20,7 @@ export const useCopyData = () => {
const copyData = useCallback(
async (
data: string,
title: string | null | undefined = t('common:common.Copy Successful'),
title: string | null | undefined = t('common:Copy Successful'),
duration = 1000
) => {
data = data.trim();
@@ -59,7 +59,7 @@ export const ManualCopyModal = () => {
isOpen={!!copyContent}
iconSrc="copy"
iconColor="primary.600"
title={t('common:common.Copy')}
title={t('common:Copy')}
maxW={['90vw', '500px']}
w={'100%'}
onClose={() => setCopyContent(undefined)}

View File

@@ -87,7 +87,7 @@ export const useEditTextarea = ({
({
maxLength = 30,
iconSrc = 'modal/edit',
closeBtnText = t('common:common.Close')
closeBtnText = t('common:Close')
}: {
maxLength?: number;
iconSrc?: string;
@@ -118,7 +118,7 @@ export const useEditTextarea = ({
</Button>
)}
<Button onClick={onclickConfirm} px={6}>
{t('common:common.Confirm')}
{t('common:Confirm')}
</Button>
</ModalFooter>
</MyModal>

View File

@@ -212,13 +212,13 @@ export function useLinkedScroll<
<MyBox ref={ref} h={'100%'} overflow={'auto'} isLoading={isLoading} {...props}>
{hasMorePrev && prevLoading && (
<Box mt={2} fontSize={'xs'} color={'blackAlpha.500'} textAlign={'center'}>
{t('common:common.is_requesting')}
{t('common:is_requesting')}
</Box>
)}
{children}
{hasMoreNext && nextLoading && (
<Box mt={2} fontSize={'xs'} color={'blackAlpha.500'} textAlign={'center'}>
{t('common:common.is_requesting')}
{t('common:is_requesting')}
</Box>
)}
</MyBox>

View File

@@ -190,9 +190,9 @@ export function usePagination<DataT, ResT = {}>(
} & BoxProps) => {
const ref = ScrollContainerRef || DefaultRef;
const loadText = (() => {
if (isLoading) return t('common:common.is_requesting');
if (noMore) return t('common:common.request_end');
return t('common:common.request_more');
if (isLoading) return t('common:is_requesting');
if (noMore) return t('common:request_end');
return t('common:request_more');
})();
const scroll = useScroll(ref);
@@ -219,7 +219,7 @@ export function usePagination<DataT, ResT = {}>(
<Box {...props} ref={ref} overflow={'overlay'}>
{scrollLoadType === 'top' && total > 0 && isLoading && (
<Box mt={2} fontSize={'xs'} color={'blackAlpha.500'} textAlign={'center'}>
{t('common:common.is_requesting')}
{t('common:is_requesting')}
</Box>
)}
{children}
@@ -229,9 +229,9 @@ export function usePagination<DataT, ResT = {}>(
fontSize={'xs'}
color={'blackAlpha.500'}
textAlign={'center'}
cursor={loadText === t('common:common.request_more') ? 'pointer' : 'default'}
cursor={loadText === t('common:request_more') ? 'pointer' : 'default'}
onClick={() => {
if (loadText !== t('common:common.request_more')) return;
if (loadText !== t('common:request_more')) return;
fetchData(pageNum + 1);
}}
>

View File

@@ -126,7 +126,7 @@ export function useVirtualScrollPagination<
{children}
{noMore && list.length > 0 && (
<Box py={4} textAlign={'center'} color={'myGray.600'} fontSize={'xs'}>
{t('common:common.No more data')}
{t('common:no_more_data')}
</Box>
)}
</Box>
@@ -282,9 +282,9 @@ export function useScrollPagination<
} & BoxProps) => {
const ref = ScrollContainerRef || ScrollRef;
const loadText = useMemo(() => {
if (isLoading || isLoadingProp) return t('common:common.is_requesting');
if (noMore) return t('common:common.request_end');
return t('common:common.request_more');
if (isLoading || isLoadingProp) return t('common:is_requesting');
if (noMore) return t('common:request_end');
return t('common:request_more');
}, [isLoading, noMore]);
const scroll = useScroll(ref);
@@ -317,7 +317,7 @@ export function useScrollPagination<
>
{scrollLoadType === 'top' && total > 0 && isLoading && (
<Box mt={2} fontSize={'xs'} color={'blackAlpha.500'} textAlign={'center'}>
{t('common:common.is_requesting')}
{t('common:is_requesting')}
</Box>
)}
{children}
@@ -327,9 +327,9 @@ export function useScrollPagination<
fontSize={'xs'}
color={'blackAlpha.500'}
textAlign={'center'}
cursor={loadText === t('common:common.request_more') ? 'pointer' : 'default'}
cursor={loadText === t('common:request_more') ? 'pointer' : 'default'}
onClick={() => {
if (loadText !== t('common:common.request_more')) return;
if (loadText !== t('common:request_more')) return;
loadData(false);
}}
>