mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
I18n: Completed i18n&&proofread some translations (#2619)
* i18n-1 * i18n: Completed the remaining parts of i18n and proofread some translations * i18n: add default lang&&add app template i18n
This commit is contained in:
@@ -216,7 +216,7 @@ function AddMemberModal({ onClose }: AddModalPropsType) {
|
||||
borderRadius={'md'}
|
||||
h={'32px'}
|
||||
>
|
||||
{perLabel}
|
||||
{t(perLabel as any)}
|
||||
<ChevronDownIcon fontSize={'md'} />
|
||||
</Flex>
|
||||
}
|
||||
|
@@ -187,7 +187,7 @@ function PermissionSelect({
|
||||
>
|
||||
<Radio isChecked={selectedSingleValue === item.value} />
|
||||
<Box ml={4}>
|
||||
<Box>{item.name}</Box>
|
||||
<Box>{t(item.name as any)}</Box>
|
||||
<Box color={'myGray.500'} fontSize={'mini'}>
|
||||
{t(item.description as any)}
|
||||
</Box>
|
||||
|
@@ -4,6 +4,7 @@ import Tag from '@fastgpt/web/components/common/Tag';
|
||||
import React from 'react';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { CollaboratorContext } from './context';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
export type PermissionTagsProp = {
|
||||
permission: PermissionValueType;
|
||||
@@ -11,7 +12,7 @@ export type PermissionTagsProp = {
|
||||
|
||||
function PermissionTags({ permission }: PermissionTagsProp) {
|
||||
const { getPerLabelList } = useContextSelector(CollaboratorContext, (v) => v);
|
||||
|
||||
const { t } = useTranslation();
|
||||
const perTagList = getPerLabelList(permission);
|
||||
|
||||
return (
|
||||
@@ -26,7 +27,7 @@ function PermissionTags({ permission }: PermissionTagsProp) {
|
||||
px={3}
|
||||
fontSize={'xs'}
|
||||
>
|
||||
{item}
|
||||
{t(item as any)}
|
||||
</Tag>
|
||||
))}
|
||||
</Flex>
|
||||
|
@@ -20,9 +20,9 @@ const PermissionTag = ({
|
||||
|
||||
const commonLabel = (() => {
|
||||
if (permission.isOwner) return t('common:permission.Owner');
|
||||
if (permission.hasManagePer) return PermissionList['manage'].name;
|
||||
if (permission.hasWritePer) return PermissionList['write'].name;
|
||||
if (permission.hasReadPer) return PermissionList['read'].name;
|
||||
if (permission.hasManagePer) return t(PermissionList['manage'].name as any);
|
||||
if (permission.hasWritePer) return t(PermissionList['write'].name as any);
|
||||
if (permission.hasReadPer) return t(PermissionList['read'].name as any);
|
||||
|
||||
return;
|
||||
})();
|
||||
@@ -44,8 +44,10 @@ const PermissionTag = ({
|
||||
permission.hasManagePer,
|
||||
permission.hasReadPer,
|
||||
permission.hasWritePer,
|
||||
permission.isOwner,
|
||||
permission.value,
|
||||
permissionList
|
||||
permissionList,
|
||||
t
|
||||
]);
|
||||
return (
|
||||
<HStack>
|
||||
|
@@ -61,7 +61,7 @@ function PermissionManage() {
|
||||
ml={3}
|
||||
borderRadius={'sm'}
|
||||
>
|
||||
{TeamPermissionList['manage'].description}
|
||||
{t(TeamPermissionList['manage'].description as any)}
|
||||
</Box>
|
||||
</Flex>
|
||||
{userInfo?.team.role === 'owner' && (
|
||||
|
@@ -306,7 +306,7 @@ const MyInfo = ({ onOpenContact }: { onOpenContact: () => void }) => {
|
||||
<strong>{formatStorePrice2Read(userInfo?.team?.balance).toFixed(3)}</strong>{' '}
|
||||
{t('user:bill.yuan')}
|
||||
</Box>
|
||||
{/* TODO:暂时隐藏 */}
|
||||
|
||||
{userInfo?.permission.hasManagePer && !!standardPlan && (
|
||||
<Button variant={'primary'} size={'sm'} ml={5} onClick={onOpenConversionModal}>
|
||||
{t('user:bill.conversion')}
|
||||
|
@@ -83,7 +83,7 @@ const FeiShuEditModal = ({
|
||||
fontSize={'sm'}
|
||||
>
|
||||
<Flex alignItems={'center'}>
|
||||
<MyIcon name="book" mr="1" />
|
||||
<MyIcon w={'17px'} h={'17px'} name="book" mr="1" />
|
||||
{t('common:common.Read document')}
|
||||
</Flex>
|
||||
</Link>
|
||||
|
@@ -85,7 +85,7 @@ const OffiAccountEditModal = ({
|
||||
fontSize={'sm'}
|
||||
>
|
||||
<Flex alignItems={'center'}>
|
||||
<MyIcon name="book" mr="1" />
|
||||
<MyIcon name="book" w={'17px'} h={'17px'} mr="1" />
|
||||
{t('common:common.Read document')}
|
||||
</Flex>
|
||||
</Link>
|
||||
|
@@ -82,7 +82,7 @@ const WecomEditModal = ({
|
||||
fontSize={'sm'}
|
||||
>
|
||||
<Flex alignItems={'center'}>
|
||||
<MyIcon name="book" mr="1" />
|
||||
<MyIcon name="book" w={'17px'} h={'17px'} mr="1" />
|
||||
{t('common:common.Read document')}
|
||||
</Flex>
|
||||
</Link>
|
||||
|
@@ -194,7 +194,11 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => {
|
||||
pt={6}
|
||||
>
|
||||
<MyIcon name="menu" w={5} />
|
||||
<Box ml={2} fontWeight={'semibold'} flex={'1 0 0'}>{`共${tagsTotal}个标签`}</Box>
|
||||
<Box ml={2} fontWeight={'semibold'} flex={'1 0 0'}>
|
||||
{t('dataset:tag.total_tags', {
|
||||
total: tagsTotal
|
||||
})}
|
||||
</Box>
|
||||
<Button
|
||||
size={'sm'}
|
||||
leftIcon={<MyIcon name="common/addLight" w={4} />}
|
||||
|
@@ -4,7 +4,7 @@ import { useTranslation } from 'next-i18next';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import type { FastGPTFeConfigsType } from '@fastgpt/global/common/system/types/index.d';
|
||||
import { change2DefaultLng, setLngStore } from '@/web/common/utils/i18n';
|
||||
import { change2DefaultLng, LangEnum, setLngStore } from '@/web/common/utils/i18n';
|
||||
import { useMemoizedFn, useMount } from 'ahooks';
|
||||
import { TrackEventName } from '../common/system/constants';
|
||||
|
||||
@@ -40,11 +40,13 @@ export const useInitApp = () => {
|
||||
|
||||
const initUserLanguage = useMemoizedFn(() => {
|
||||
// get default language
|
||||
const targetLng = change2DefaultLng(i18n.language);
|
||||
if (targetLng) {
|
||||
setLngStore(targetLng);
|
||||
router.replace(router.asPath, undefined, { locale: targetLng });
|
||||
}
|
||||
|
||||
const targetLng =
|
||||
change2DefaultLng(i18n.language) ||
|
||||
(['zh', 'zh-CN'].includes(navigator.language) ? 'zh' : 'en');
|
||||
|
||||
setLngStore(targetLng);
|
||||
router.replace(router.asPath, undefined, { locale: targetLng });
|
||||
});
|
||||
|
||||
useMount(() => {
|
||||
|
@@ -32,8 +32,8 @@ export const emptyTemplates: Record<
|
||||
nodes: [
|
||||
{
|
||||
nodeId: 'userGuide',
|
||||
name: '系统配置',
|
||||
intro: '可以配置应用的系统参数',
|
||||
name: i18nT('common:core.module.template.system_config'),
|
||||
intro: i18nT('common:core.module.template.config_params'),
|
||||
avatar: 'core/workflow/template/systemConfig',
|
||||
flowNodeType: FlowNodeTypeEnum.systemConfig,
|
||||
position: {
|
||||
@@ -95,7 +95,7 @@ export const emptyTemplates: Record<
|
||||
},
|
||||
{
|
||||
nodeId: '448745',
|
||||
name: '流程开始',
|
||||
name: i18nT('common:core.module.template.work_start'),
|
||||
intro: '',
|
||||
avatar: 'core/workflow/template/workflowStart',
|
||||
flowNodeType: FlowNodeTypeEnum.workflowStart,
|
||||
@@ -109,9 +109,9 @@ export const emptyTemplates: Record<
|
||||
key: 'userChatInput',
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference, FlowNodeInputTypeEnum.textarea],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
label: '用户问题',
|
||||
label: i18nT('common:core.module.input.label.user question'),
|
||||
required: true,
|
||||
toolDescription: '用户问题'
|
||||
toolDescription: i18nT('common:core.module.input.label.user question')
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
@@ -126,8 +126,8 @@ export const emptyTemplates: Record<
|
||||
},
|
||||
{
|
||||
nodeId: 'loOvhld2ZTKa',
|
||||
name: 'AI 对话',
|
||||
intro: 'AI 大模型对话',
|
||||
name: i18nT('common:core.module.template.ai_chat'),
|
||||
intro: i18nT('common:core.module.template.ai_chat_intro'),
|
||||
avatar: 'core/workflow/template/aiChat',
|
||||
flowNodeType: FlowNodeTypeEnum.chatNode,
|
||||
showStatus: true,
|
||||
@@ -210,16 +210,16 @@ export const emptyTemplates: Record<
|
||||
key: 'userChatInput',
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference, FlowNodeInputTypeEnum.textarea],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
label: '用户问题',
|
||||
label: i18nT('common:core.module.input.label.user question'),
|
||||
required: true,
|
||||
toolDescription: '用户问题',
|
||||
toolDescription: i18nT('common:core.module.input.label.user question'),
|
||||
value: ['448745', 'userChatInput']
|
||||
},
|
||||
{
|
||||
key: 'quoteQA',
|
||||
renderTypeList: [FlowNodeInputTypeEnum.settingDatasetQuotePrompt],
|
||||
label: '',
|
||||
debugLabel: '知识库引用',
|
||||
debugLabel: i18nT('common:core.module.Dataset quote.label'),
|
||||
description: '',
|
||||
valueType: WorkflowIOValueTypeEnum.datasetQuote
|
||||
}
|
||||
@@ -255,12 +255,12 @@ export const emptyTemplates: Record<
|
||||
},
|
||||
[AppTypeEnum.workflow]: {
|
||||
avatar: 'core/app/type/workflowFill',
|
||||
name: '空白工作流',
|
||||
name: i18nT('common:core.module.template.empty_workflow'),
|
||||
nodes: [
|
||||
{
|
||||
nodeId: 'userGuide',
|
||||
name: '系统配置',
|
||||
intro: '可以配置应用的系统参数',
|
||||
name: i18nT('common:core.module.template.system_config'),
|
||||
intro: i18nT('common:core.module.template.system_config_info'),
|
||||
avatar: 'core/workflow/template/systemConfig',
|
||||
flowNodeType: 'userGuide',
|
||||
position: {
|
||||
@@ -322,7 +322,7 @@ export const emptyTemplates: Record<
|
||||
},
|
||||
{
|
||||
nodeId: '448745',
|
||||
name: '流程开始',
|
||||
name: i18nT('common:core.module.template.work_start'),
|
||||
intro: '',
|
||||
avatar: 'core/workflow/template/workflowStart',
|
||||
flowNodeType: 'workflowStart',
|
||||
@@ -336,9 +336,9 @@ export const emptyTemplates: Record<
|
||||
key: 'userChatInput',
|
||||
renderTypeList: ['reference', 'textarea'],
|
||||
valueType: 'string',
|
||||
label: '用户问题',
|
||||
label: i18nT('common:core.module.input.label.user question'),
|
||||
required: true,
|
||||
toolDescription: '用户问题'
|
||||
toolDescription: i18nT('common:core.module.input.label.user question')
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
@@ -356,11 +356,11 @@ export const emptyTemplates: Record<
|
||||
},
|
||||
[AppTypeEnum.plugin]: {
|
||||
avatar: 'core/app/type/pluginFill',
|
||||
name: '空白插件',
|
||||
name: i18nT('common:core.module.template.empty_plugin'),
|
||||
nodes: [
|
||||
{
|
||||
nodeId: 'pluginInput',
|
||||
name: '自定义插件输入',
|
||||
name: i18nT('common:core.module.template.self_input'),
|
||||
avatar: 'core/workflow/template/workflowStart',
|
||||
flowNodeType: FlowNodeTypeEnum.pluginInput,
|
||||
showStatus: false,
|
||||
@@ -374,7 +374,7 @@ export const emptyTemplates: Record<
|
||||
},
|
||||
{
|
||||
nodeId: 'pluginOutput',
|
||||
name: '自定义插件输出',
|
||||
name: i18nT('common:core.module.template.self_output'),
|
||||
avatar: '/imgs/workflow/output.png',
|
||||
flowNodeType: FlowNodeTypeEnum.pluginOutput,
|
||||
showStatus: false,
|
||||
|
@@ -162,16 +162,16 @@ export function form2AppWorkflow(
|
||||
key: 'userChatInput',
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference, FlowNodeInputTypeEnum.textarea],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
label: '用户问题',
|
||||
label: i18nT('common:core.module.input.label.user question'),
|
||||
required: true,
|
||||
toolDescription: '用户问题',
|
||||
toolDescription: i18nT('common:core.module.input.label.user question'),
|
||||
value: [workflowStartNodeId, 'userChatInput']
|
||||
},
|
||||
{
|
||||
key: 'quoteQA',
|
||||
renderTypeList: [FlowNodeInputTypeEnum.settingDatasetQuotePrompt],
|
||||
label: '',
|
||||
debugLabel: '知识库引用',
|
||||
debugLabel: i18nT('common:core.module.Dataset quote.label'),
|
||||
description: '',
|
||||
valueType: WorkflowIOValueTypeEnum.datasetQuote,
|
||||
value: selectedDatasets ? [datasetNodeId, 'quoteQA'] : undefined
|
||||
@@ -467,7 +467,7 @@ export function form2AppWorkflow(
|
||||
key: 'userChatInput',
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference, FlowNodeInputTypeEnum.textarea],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
label: '用户问题',
|
||||
label: i18nT('common:core.module.input.label.user question'),
|
||||
required: true,
|
||||
value: [workflowStartNodeId, 'userChatInput']
|
||||
},
|
||||
|
Reference in New Issue
Block a user