mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
addition i18n (#2631)
This commit is contained in:
@@ -37,10 +37,10 @@ const PromptTemplate = ({
|
||||
: {})}
|
||||
onClick={() => setSelectTemplateTitle(item)}
|
||||
>
|
||||
<Box color={'myGray.900'}>{item.title}</Box>
|
||||
<Box color={'myGray.900'}>{t(item.title as any)}</Box>
|
||||
|
||||
<Box color={'myGray.500'} fontSize={'xs'} whiteSpace={'pre-wrap'}>
|
||||
{item.desc}
|
||||
{t(item.desc as any)}
|
||||
</Box>
|
||||
</Box>
|
||||
))}
|
||||
|
@@ -415,7 +415,7 @@ const MenuRender = React.memo(function MenuRender({
|
||||
leftIcon={<MyIcon name={item.icon as any} w={'13px'} />}
|
||||
onClick={item.onClick}
|
||||
>
|
||||
{item.label}
|
||||
{t(item.label as any)}
|
||||
</Button>
|
||||
</Box>
|
||||
))}
|
||||
|
@@ -3,14 +3,15 @@ import type { RenderInputProps } from '../type';
|
||||
import { Input } from '@chakra-ui/react';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { WorkflowContext } from '@/pages/app/detail/components/WorkflowComponents/context';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
const TextInput = ({ item, nodeId }: RenderInputProps) => {
|
||||
const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode);
|
||||
|
||||
const { t } = useTranslation();
|
||||
const Render = useMemo(() => {
|
||||
return (
|
||||
<Input
|
||||
placeholder={item.placeholder ?? item.description}
|
||||
placeholder={t(item.placeholder as any) ?? t(item.description as any)}
|
||||
defaultValue={item.value}
|
||||
bg={'white'}
|
||||
px={3}
|
||||
@@ -28,7 +29,7 @@ const TextInput = ({ item, nodeId }: RenderInputProps) => {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}, [item, nodeId, onChangeNode]);
|
||||
}, [item, nodeId, onChangeNode, t]);
|
||||
|
||||
return Render;
|
||||
};
|
||||
|
@@ -3,6 +3,7 @@ import { Box } from '@chakra-ui/react';
|
||||
import { WorkflowIOValueTypeEnum } from '@fastgpt/global/core/workflow/constants';
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
const ValueTypeLabel = ({
|
||||
valueType,
|
||||
@@ -12,7 +13,7 @@ const ValueTypeLabel = ({
|
||||
valueDesc?: string;
|
||||
}) => {
|
||||
const valueTypeData = valueType ? FlowValueTypeMap[valueType] : undefined;
|
||||
|
||||
const { t } = useTranslation();
|
||||
const label = valueTypeData?.label || '';
|
||||
|
||||
return !!label ? (
|
||||
@@ -29,7 +30,7 @@ const ValueTypeLabel = ({
|
||||
alignItems={'center'}
|
||||
fontSize={'11px'}
|
||||
>
|
||||
{label}
|
||||
{t(label as any)}
|
||||
</Box>
|
||||
</MyTooltip>
|
||||
) : null;
|
||||
|
Reference in New Issue
Block a user