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

@@ -112,7 +112,7 @@ const AccountContainer = ({
: []),
{
icon: 'common/settingLight',
label: t('common:common.Setting'),
label: t('common:Setting'),
value: TabEnum.setting
},
{

View File

@@ -22,7 +22,7 @@ const RedeemCouponModal = ({
onSuccess();
onClose();
},
successToast: t('common:common.Success')
successToast: t('common:Success')
});
return (

View File

@@ -153,7 +153,7 @@ export const ModelEditModal = ({
onSuccess: () => {
onClose();
},
successToast: t('common:common.Success')
successToast: t('common:Success')
}
);
@@ -741,10 +741,10 @@ export const ModelEditModal = ({
</Button>
)}
<Button variant={'whiteBase'} mr={4} onClick={onClose}>
{t('common:common.Cancel')}
{t('common:Cancel')}
</Button>
<Button isLoading={updatingModel} onClick={handleSubmit(updateModel)}>
{t('common:common.Confirm')}
{t('common:Confirm')}
</Button>
</ModalFooter>
</MyModal>

View File

@@ -158,7 +158,7 @@ const EditChannelModal = ({
onSuccess();
onClose();
},
successToast: isEdit ? t('common:common.Update Success') : t('common:common.Create Success'),
successToast: isEdit ? t('common:update_success') : t('common:create_success'),
manual: true
}
);
@@ -285,10 +285,10 @@ const EditChannelModal = ({
</ModalBody>
<ModalFooter>
<Button variant={'outline'} onClick={onClose} mr={4}>
{t('common:common.Cancel')}
{t('common:Cancel')}
</Button>
<Button variant={'primary'} onClick={handleSubmit(onSubmit)}>
{isEdit ? t('common:common.Update') : t('common:new_create')}
{isEdit ? t('common:Update') : t('common:new_create')}
</Button>
</ModalFooter>
</MyModal>

View File

@@ -59,11 +59,11 @@ const ModelTest = ({
colorSchema: 'blue'
},
success: {
label: t('common:common.Success'),
label: t('common:Success'),
colorSchema: 'green'
},
error: {
label: t('common:common.failed'),
label: t('common:failed'),
colorSchema: 'red'
}
});
@@ -246,7 +246,7 @@ const ModelTest = ({
</ModalBody>
<ModalFooter>
<Button mr={4} variant={'whiteBase'} onClick={onClose}>
{t('common:common.Cancel')}
{t('common:Cancel')}
</Button>
<Button isLoading={isTesting} variant={'primary'} onClick={onStartTest}>
{t('account_model:start_test', { num: testModelList.length })}

View File

@@ -215,7 +215,7 @@ const ChannelTable = ({ Tab }: { Tab: React.ReactNode }) => {
{
type: 'danger',
icon: 'delete',
label: t('common:common.Delete'),
label: t('common:Delete'),
onClick: () =>
openConfirm(
() => onDeleteChannel(item.id),

View File

@@ -89,7 +89,7 @@ const ChannelLog = ({ Tab }: { Tab: React.ReactNode }) => {
);
return [
{
label: t('common:common.All'),
label: t('common:All'),
value: ''
},
...res
@@ -118,7 +118,7 @@ const ChannelLog = ({ Tab }: { Tab: React.ReactNode }) => {
.sort((a, b) => a.order - b.order);
return [
{
label: t('common:common.All'),
label: t('common:All'),
value: ''
},
...res
@@ -229,9 +229,9 @@ const ChannelLog = ({ Tab }: { Tab: React.ReactNode }) => {
<MySelect<'all' | 'success' | 'error'>
bg={'myGray.50'}
list={[
{ label: t('common:common.All'), value: 'all' },
{ label: t('common:common.Success'), value: 'success' },
{ label: t('common:common.failed'), value: 'error' }
{ label: t('common:All'), value: 'all' },
{ label: t('common:Success'), value: 'success' },
{ label: t('common:failed'), value: 'error' }
]}
value={filterProps.code_type}
onChange={(val) => setFilterProps({ ...filterProps, code_type: val })}

View File

@@ -67,7 +67,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
const [provider, setProvider] = useState<ModelProviderIdType | ''>('');
const providerList = useRef<{ label: any; value: ModelProviderIdType | '' }[]>([
{ label: t('common:common.All'), value: '' },
{ label: t('common:All'), value: '' },
...ModelProviderList.map((item) => ({
label: (
<HStack>
@@ -81,7 +81,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
const [modelType, setModelType] = useState<ModelTypeEnum | ''>('');
const selectModelTypeList = useRef<{ label: string; value: ModelTypeEnum | '' }[]>([
{ label: t('common:common.All'), value: '' },
{ label: t('common:All'), value: '' },
...modelTypeList.map((item) => ({ label: t(item.label), value: item.value }))
]);
@@ -110,14 +110,14 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
typeof item.inputPrice === 'number' ? (
<Box>
<Flex>
{`${t('common:common.Input')}:`}
{`${t('common:Input')}:`}
<Box fontWeight={'bold'} color={'myGray.900'} mr={0.5} ml={2}>
{item.inputPrice || 0}
</Box>
{`${t('common:support.wallet.subscription.point')} / 1K Tokens`}
</Flex>
<Flex>
{`${t('common:common.Output')}:`}
{`${t('common:Output')}:`}
<Box fontWeight={'bold'} color={'myGray.900'} mr={0.5} ml={2}>
{item.outputPrice || 0}
</Box>
@@ -141,7 +141,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
typeLabel: t('common:model.type.embedding'),
priceLabel: (
<Flex color={'myGray.700'}>
{`${t('common:common.Input')}: `}
{`${t('common:Input')}: `}
<Box fontWeight={'bold'} color={'myGray.900'} mr={0.5}>
{item.charsPointsPrice || 0}
</Box>
@@ -187,7 +187,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
typeLabel: t('common:model.type.reRank'),
priceLabel: item.charsPointsPrice ? (
<Flex color={'myGray.700'}>
{`${t('common:common.Input')}: `}
{`${t('common:Input')}: `}
<Box fontWeight={'bold'} color={'myGray.900'} mr={0.5}>
{item.charsPointsPrice}
</Box>
@@ -254,7 +254,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => {
const { runAsync: onTestModel, loading: testingModel } = useRequest2(getTestModel, {
manual: true,
successToast: t('common:common.Success')
successToast: t('common:Success')
});
const { runAsync: updateModel, loading: updatingModel } = useRequest2(putSystemModel, {
onSuccess: refreshModels
@@ -540,7 +540,7 @@ const JsonConfigModal = ({
</ModalBody>
<ModalFooter>
<Button variant={'whiteBase'} mr={4} onClick={onClose}>
{t('common:common.Cancel')}
{t('common:Cancel')}
</Button>
<Button
onClick={() =>
@@ -549,7 +549,7 @@ const JsonConfigModal = ({
})()
}
>
{t('common:common.Confirm')}
{t('common:Confirm')}
</Button>
</ModalFooter>
@@ -591,7 +591,7 @@ const DefaultModelModal = ({
onSuccess();
onClose();
},
successToast: t('common:common.Update Success')
successToast: t('common:update_success')
});
return (
@@ -745,7 +745,7 @@ const DefaultModelModal = ({
</ModalBody>
<ModalFooter>
<Button variant={'whiteBase'} mr={4} onClick={onClose}>
{t('common:common.Cancel')}
{t('common:Cancel')}
</Button>
<Button
isLoading={loading}
@@ -761,7 +761,7 @@ const DefaultModelModal = ({
})
}
>
{t('common:common.Confirm')}
{t('common:Confirm')}
</Button>
</ModalFooter>
</MyModal>

View File

@@ -67,8 +67,8 @@ function EditModal({
onSuccess();
onClose();
},
successToast: t('common:common.Create Success'),
errorToast: t('common:common.Create Failed')
successToast: t('common:create_success'),
errorToast: t('common:create_failed')
});
const { mutate: onclickUpdate, isLoading: updating } = useRequest({
mutationFn: async (data: EditTeamFormDataType) => {
@@ -82,8 +82,8 @@ function EditModal({
onSuccess();
onClose();
},
successToast: t('common:common.Update Success'),
errorToast: t('common:common.Update Failed')
successToast: t('common:update_success'),
errorToast: t('common:update_failed')
});
const { isOpen: isOpenContact, onClose: onCloseContact, onOpen: onOpenContact } = useDisclosure();
@@ -101,7 +101,7 @@ function EditModal({
{t('account_team:set_name_avatar')}
</Box>
<Flex mt={3} alignItems={'center'}>
<MyTooltip label={t('common:common.Set Avatar')}>
<MyTooltip label={t('common:set_avatar')}>
<Avatar
flexShrink={0}
src={avatar}
@@ -120,7 +120,7 @@ function EditModal({
maxLength={100}
placeholder={t('user:team.Team Name')}
{...register('name', {
required: t('common:common.Please Input Name')
required: t('common:Please Input Name')
})}
/>
</Flex>
@@ -153,7 +153,7 @@ function EditModal({
onOpenContact();
}}
>
{t('common:common.Setting')}
{t('common:Setting')}
</Button>
</HStack>
</ModalBody>
@@ -163,10 +163,10 @@ function EditModal({
<>
<Box flex={1} />
<Button variant={'whiteBase'} mr={3} onClick={onClose}>
{t('common:common.Close')}
{t('common:Close')}
</Button>
<Button isLoading={updating} onClick={handleSubmit((data) => onclickUpdate(data))}>
{t('common:common.Confirm Update')}
{t('common:confirm_update')}
</Button>
</>
) : (
@@ -175,7 +175,7 @@ function EditModal({
isLoading={creating}
onClick={handleSubmit((data) => onclickCreate(data))}
>
{t('common:common.Confirm Create')}
{t('common:comfirn_create')}
</Button>
)}
</ModalFooter>

View File

@@ -118,7 +118,7 @@ function GroupInfoModal({
}
})}
>
{editGroup ? t('common:common.Save') : t('common:new_create')}
{editGroup ? t('common:Save') : t('common:new_create')}
</Button>
</ModalFooter>
<AvatarSelect onSelect={onSelectAvatar} />

View File

@@ -294,10 +294,10 @@ function GroupEditModal({
</ModalBody>
<ModalFooter>
<Button variant={'whiteBase'} mr={3} onClick={onClose}>
{t('common:common.Close')}
{t('common:Close')}
</Button>
<Button isLoading={isLoading} onClick={onUpdate}>
{t('common:common.Save')}
{t('common:Save')}
</Button>
</ModalFooter>
</MyModal>

View File

@@ -180,10 +180,10 @@ export function ChangeOwnerModal({
<ModalFooter>
<HStack>
<Button onClick={onClose} variant={'whiteBase'}>
{t('common:common.Cancel')}
{t('common:Cancel')}
</Button>
<Button isLoading={loading} isDisabled={!selectedMember} onClick={onConfirm}>
{t('common:common.Confirm')}
{t('common:Confirm')}
</Button>
</HStack>
</ModalFooter>

View File

@@ -116,7 +116,7 @@ function MemberTable({ Tabs }: { Tabs: React.ReactNode }) {
<Th bg="myGray.100">{t('account_team:owner')}</Th>
<Th bg="myGray.100">{t('account_team:member')}</Th>
<Th bg="myGray.100" borderRightRadius="6px">
{t('common:common.Action')}
{t('common:Action')}
</Th>
</Tr>
</Thead>
@@ -185,7 +185,7 @@ function MemberTable({ Tabs }: { Tabs: React.ReactNode }) {
type: 'primary' as MenuItemType
},
{
label: t('common:common.Delete'),
label: t('common:Delete'),
icon: 'delete',
onClick: () => {
openDeleteGroupModal(() => delDeleteGroup(group._id))();

View File

@@ -49,7 +49,7 @@ function CreateInvitationModal({
const { runAsync: createInvitationLink, loading } = useRequest2(postCreateInvitationLink, {
manual: true,
errorToast: t('common:common.Create Failed'),
errorToast: t('common:create_failed'),
onSuccess: (data) => {
onSuccess(data);
onClose();
@@ -100,10 +100,10 @@ function CreateInvitationModal({
</ModalBody>
<ModalFooter>
<Button isLoading={loading} onClick={() => onClose()} variant="outline">
{t('common:common.Cancel')}
{t('common:Cancel')}
</Button>
<Button isLoading={loading} onClick={handleSubmit(createInvitationLink)} ml="4">
{t('common:common.Confirm')}
{t('common:Confirm')}
</Button>
</ModalFooter>
</MyModal>

View File

@@ -27,7 +27,7 @@ function Invite({ invitelinkid }: { invitelinkid: string }) {
() => postAcceptInvitationLink(invitelinkid),
{
manual: true,
successToast: t('common:common.Success'),
successToast: t('common:Success'),
onSuccess: async () => {
onSwitchTeam(invitationInfo!.teamId);
onClose();

View File

@@ -110,7 +110,7 @@ const InviteModal = ({ onClose }: { onClose: () => void }) => {
<Th bgColor="myGray.100">{t('account_team:used_times_limit')}</Th>
<Th bgColor="myGray.100">{t('account_team:invited')}</Th>
<Th bgColor="myGray.100" borderRightRadius="6px">
{t('common:common.Action')}
{t('common:Action')}
</Th>
</Tr>
</Thead>
@@ -213,7 +213,7 @@ const InviteModal = ({ onClose }: { onClose: () => void }) => {
</Box>
<Flex gap={2} mt={2} justifyContent={'flex-end'}>
<Button variant="outline" onClick={onClosePopover}>
{t('common:common.Cancel')}
{t('common:Cancel')}
</Button>
<Button
isLoading={forbiding}

View File

@@ -66,7 +66,7 @@ function MemberTable({ Tabs }: { Tabs: React.ReactNode }) {
// Member status selector
const statusOptions = [
{
label: t('common:common.All'),
label: t('common:All'),
value: undefined
},
{
@@ -147,7 +147,7 @@ function MemberTable({ Tabs }: { Tabs: React.ReactNode }) {
});
const { runAsync: onRestore } = useRequest2(postRestoreMember, {
onSuccess: onRefreshMembers,
successToast: t('common:common.Success'),
successToast: t('common:Success'),
errorToast: t('common:user.team.invite.Reject')
});
@@ -276,7 +276,7 @@ function MemberTable({ Tabs }: { Tabs: React.ReactNode }) {
</Th>
<Th bgColor="myGray.100">{t('account_team:join_update_time')}</Th>
<Th borderRightRadius="6px" bgColor="myGray.100">
{t('common:common.Action')}
{t('common:Action')}
</Th>
</Tr>
</Thead>

View File

@@ -62,7 +62,7 @@ function OrgInfoModal({
});
},
{
successToast: t('common:common.Create Success'),
successToast: t('common:create_success'),
onSuccess: () => {
onClose();
onSuccess();
@@ -81,7 +81,7 @@ function OrgInfoModal({
});
},
{
successToast: t('common:common.Update Success'),
successToast: t('common:update_success'),
onSuccess: () => {
onClose();
onSuccess();
@@ -155,7 +155,7 @@ function OrgInfoModal({
}
})}
>
{isEdit ? t('common:common.Save') : t('common:new_create')}
{isEdit ? t('common:Save') : t('common:new_create')}
</Button>
</ModalFooter>
<AvatarSelect onSelect={onSelectAvatar} />

View File

@@ -79,7 +79,7 @@ function OrgMemberManageModal({
});
},
{
successToast: t('common:common.Update Success'),
successToast: t('common:update_success'),
onSuccess() {
refetchOrgs();
onClose();
@@ -193,10 +193,10 @@ function OrgMemberManageModal({
</ModalBody>
<ModalFooter>
<Button variant={'whiteBase'} mr={3} onClick={onClose}>
{t('common:common.Close')}
{t('common:Close')}
</Button>
<Button isLoading={isLoading} onClick={onUpdate}>
{t('common:common.Save')}
{t('common:Save')}
</Button>
</ModalFooter>
</MyModal>

View File

@@ -51,7 +51,7 @@ function OrgMoveModal({
});
}}
>
{t('common:common.Confirm')}
{t('common:Confirm')}
</Button>
</ModalFooter>
</MyModal>

View File

@@ -150,7 +150,7 @@ function OrgTable({ Tabs }: { Tabs: React.ReactNode }) {
{t('common:Name')}
</Th>
<Th bg="myGray.100" borderRightRadius="6px">
{t('common:common.Action')}
{t('common:Action')}
</Th>
</Tr>
</Thead>
@@ -298,13 +298,13 @@ function OrgTable({ Tabs }: { Tabs: React.ReactNode }) {
)}
</HStack>
{currentOrg?.path !== '' && (
<Box fontSize={'xs'}>{currentOrg?.description || t('common:common.no_intro')}</Box>
<Box fontSize={'xs'}>{currentOrg?.description || t('common:no_intro')}</Box>
)}
<Divider my={'20px'} />
<Box fontWeight={500} fontSize="sm" color="myGray.900">
{t('common:common.Action')}
{t('common:Action')}
</Box>
{isTeamAdmin && (
<VStack gap="13px" w="100%">

View File

@@ -239,7 +239,7 @@ function PermissionManage({
</Th>
<Th bg="myGray.100" borderRightRadius="md">
<Box mx="auto" w="fit-content">
{t('common:common.Action')}
{t('common:Action')}
</Box>
</Th>
</Tr>

View File

@@ -33,8 +33,8 @@ const OpenAIAccountModal = ({
initUserInfo();
onClose();
},
successToast: t('common:common.Update Success'),
errorToast: t('common:common.Update Failed')
successToast: t('common:update_success'),
errorToast: t('common:update_failed')
}
);
@@ -64,10 +64,10 @@ const OpenAIAccountModal = ({
</ModalBody>
<ModalFooter>
<Button mr={3} variant={'whiteBase'} onClick={onClose}>
{t('common:common.Cancel')}
{t('common:Cancel')}
</Button>
<Button isLoading={loading} onClick={handleSubmit(onSubmit)}>
{t('common:common.Confirm')}
{t('common:Confirm')}
</Button>
</ModalFooter>
</MyModal>

View File

@@ -38,8 +38,8 @@ const WorkflowVariableModal = ({
initUserInfo();
onClose();
},
successToast: t('common:common.Update Success'),
errorToast: t('common:common.Update Failed')
successToast: t('common:update_success'),
errorToast: t('common:update_failed')
}
);
@@ -68,10 +68,10 @@ const WorkflowVariableModal = ({
</ModalBody>
<ModalFooter>
<Button mr={3} variant={'whiteBase'} onClick={onClose}>
{t('common:common.Cancel')}
{t('common:Cancel')}
</Button>
<Button isLoading={loading} onClick={handleSubmit(onSubmit)}>
{t('common:common.Confirm')}
{t('common:Confirm')}
</Button>
</ModalFooter>
</MyModal>