feat: i18n

This commit is contained in:
Joel 2025-07-25 17:53:48 +08:00
parent a6d2392c6c
commit ab373197f9
3 changed files with 39 additions and 12 deletions

View File

@ -6,36 +6,37 @@ import Button from '../../../button'
import { useTranslation } from 'react-i18next'
import { getKeyboardKeyNameBySystem } from '@/app/components/workflow/utils'
const i18nPrefix = 'workflow.nodes.humanInput.insertInputField'
const InputField: React.FC = () => {
const { t } = useTranslation()
return (
<div className="w-[372px] rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-3 shadow-lg backdrop-blur-[5px]">
<div className='system-md-semibold text-text-primary'>Insert input field</div>
<div className='system-md-semibold text-text-primary'>{t(`${i18nPrefix}.title`)}</div>
<div className="mt-3">
<div className='system-xs-medium text-text-secondary'>
Save response as<span className='system-xs-regular relative text-text-destructive-secondary'>*</span>
{t(`${i18nPrefix}.saveResponseAs`)}<span className='system-xs-regular relative text-text-destructive-secondary'>*</span>
</div>
<Input
className="mt-1.5"
placeholder="Name this variable for later reference"
placeholder={t(`${i18nPrefix}.saveResponseAsPlaceholder`)}
/>
</div>
<div className='mt-4'>
<div className='system-xs-medium text-text-secondary'>
Pre-populate field
{t(`${i18nPrefix}.prePopulateField`)}
</div>
<PromptEditor
className='mt-1.5 h-[72px] rounded-lg bg-components-input-bg-normal px-3 py-1'
placeholder={
<div className='system-sm-regular mt-1 px-3 text-text-tertiary'>
<div className="flex h-5 items-center space-x-1">
<span>Add</span>
<TagLabel type='edit' text='static content' />
<span>or</span>
<TagLabel type='variable' text='variable' />
<span>users</span>
<span>{t(`${i18nPrefix}.add`)}</span>
<TagLabel type='edit' text={t(`${i18nPrefix}.staticContent`)} />
<span>{t(`${i18nPrefix}.or`)}</span>
<TagLabel type='variable' text={t(`${i18nPrefix}.variable`)} />
<span>{t(`${i18nPrefix}.users`)}</span>
</div>
<div className="flex h-5 items-center">will see initially, or leave empty.</div>
<div className="flex h-5 items-center">{t(`${i18nPrefix}.prePopulateFieldPlaceholderEnd`)}</div>
</div>}
/>
</div>
@ -45,9 +46,9 @@ const InputField: React.FC = () => {
className='flex'
variant='primary'
>
<span className='mr-1'>Insert</span>
<span className='mr-1'>{t(`${i18nPrefix}.insert`)}</span>
<span className='system-kbd mr-0.5 flex h-4 items-center rounded-[4px] bg-components-kbd-bg-white px-1'>{getKeyboardKeyNameBySystem('ctrl')}</span>
<span className=' system-kbd flex items-center rounded-[4px] bg-components-kbd-bg-white px-1'></span>
<span className=' system-kbd flex h-4 items-center rounded-[4px] bg-components-kbd-bg-white px-1'></span>
</Button>
</div>
</div>

View File

@ -939,6 +939,19 @@ const translation = {
hours: 'Hours',
days: 'Days',
},
insertInputField: {
title: 'Insert Input Field',
saveResponseAs: 'Save Response As',
saveResponseAsPlaceholder: 'Name this variable for later reference',
prePopulateField: 'Pre-populate Field',
add: 'Add',
staticContent: 'Static Content',
or: 'or',
variable: 'variable',
users: 'users',
prePopulateFieldPlaceholderEnd: 'will see initially, or leave empty.',
insert: 'Insert',
},
},
},
tracing: {

View File

@ -940,6 +940,19 @@ const translation = {
hours: '小时',
days: '日',
},
insertInputField: {
title: '插入输入字段',
saveResponseAs: '保存响应为',
saveResponseAsPlaceholder: '为此变量命名以便将来引用',
prePopulateField: '预填充字段',
add: '添加',
staticContent: '静态内容',
or: '或',
variable: '变量',
users: '用户',
prePopulateFieldPlaceholderEnd: '将最初看到,或留空。',
insert: '插入',
},
},
},
tracing: {