refactor(i18n): use JSON with flattened key and namespace (#30114)

Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Stephen Zhou
2025-12-29 14:52:32 +08:00
committed by GitHub
parent 09be869f58
commit 6d0e36479b
2552 changed files with 111159 additions and 142972 deletions

View File

@ -83,7 +83,7 @@ const LinkEditorComponent = ({
className="mr-0.5 h-6 w-[196px] appearance-none rounded-sm bg-transparent p-1 text-[13px] text-components-input-text-filled outline-none"
value={url}
onChange={e => setUrl(e.target.value)}
placeholder={t('workflow.nodes.note.editor.enterUrl') || ''}
placeholder={t('nodes.note.editor.enterUrl', { ns: 'workflow' }) || ''}
autoFocus
/>
<Button
@ -92,7 +92,7 @@ const LinkEditorComponent = ({
disabled={!url}
onClick={() => handleSaveLink(url)}
>
{t('common.operation.ok')}
{t('operation.ok', { ns: 'common' })}
</Button>
</>
)
@ -108,7 +108,7 @@ const LinkEditorComponent = ({
>
<RiExternalLinkLine className="mr-1 h-3 w-3" />
<div className="mr-1">
{t('workflow.nodes.note.editor.openLink')}
{t('nodes.note.editor.openLink', { ns: 'workflow' })}
</div>
<div
title={escape(url)}
@ -126,14 +126,14 @@ const LinkEditorComponent = ({
}}
>
<RiEditLine className="mr-1 h-3 w-3" />
{t('common.operation.edit')}
{t('operation.edit', { ns: 'common' })}
</div>
<div
className="flex h-6 cursor-pointer items-center rounded-md px-2 hover:bg-state-base-hover"
onClick={handleUnlink}
>
<RiLinkUnlinkM className="mr-1 h-3 w-3" />
{t('workflow.nodes.note.editor.unlink')}
{t('nodes.note.editor.unlink', { ns: 'workflow' })}
</div>
</>
)

View File

@ -92,7 +92,7 @@ export const useLink = () => {
const handleSaveLink = useCallback((url: string) => {
if (url && !urlRegExp.test(url)) {
notify({ type: 'error', message: t('workflow.nodes.note.editor.invalidUrl') })
notify({ type: 'error', message: t('nodes.note.editor.invalidUrl', { ns: 'workflow' }) })
return
}
editor.dispatchCommand(TOGGLE_LINK_COMMAND, escape(url))

View File

@ -47,15 +47,15 @@ const Command = ({
const tip = useMemo(() => {
switch (type) {
case 'bold':
return t('workflow.nodes.note.editor.bold')
return t('nodes.note.editor.bold', { ns: 'workflow' })
case 'italic':
return t('workflow.nodes.note.editor.italic')
return t('nodes.note.editor.italic', { ns: 'workflow' })
case 'strikethrough':
return t('workflow.nodes.note.editor.strikethrough')
return t('nodes.note.editor.strikethrough', { ns: 'workflow' })
case 'link':
return t('workflow.nodes.note.editor.link')
return t('nodes.note.editor.link', { ns: 'workflow' })
case 'bullet':
return t('workflow.nodes.note.editor.bulletList')
return t('nodes.note.editor.bulletList', { ns: 'workflow' })
}
}, [type, t])

View File

@ -15,15 +15,15 @@ const FontSizeSelector = () => {
const FONT_SIZE_LIST = [
{
key: '12px',
value: t('workflow.nodes.note.editor.small'),
value: t('nodes.note.editor.small', { ns: 'workflow' }),
},
{
key: '14px',
value: t('workflow.nodes.note.editor.medium'),
value: t('nodes.note.editor.medium', { ns: 'workflow' }),
},
{
key: '16px',
value: t('workflow.nodes.note.editor.large'),
value: t('nodes.note.editor.large', { ns: 'workflow' }),
},
]
const {
@ -47,7 +47,7 @@ const FontSizeSelector = () => {
)}
>
<RiFontSize className="mr-1 h-4 w-4" />
{FONT_SIZE_LIST.find(font => font.key === fontSize)?.value || t('workflow.nodes.note.editor.small')}
{FONT_SIZE_LIST.find(font => font.key === fontSize)?.value || t('nodes.note.editor.small', { ns: 'workflow' })}
</div>
</PortalToFollowElemTrigger>
<PortalToFollowElemContent>

View File

@ -57,7 +57,7 @@ const Operator = ({
setOpen(false)
}}
>
{t('workflow.common.copy')}
{t('common.copy', { ns: 'workflow' })}
<ShortcutsName keys={['ctrl', 'c']} />
</div>
<div
@ -67,7 +67,7 @@ const Operator = ({
setOpen(false)
}}
>
{t('workflow.common.duplicate')}
{t('common.duplicate', { ns: 'workflow' })}
<ShortcutsName keys={['ctrl', 'd']} />
</div>
</div>
@ -77,7 +77,7 @@ const Operator = ({
className="flex h-8 cursor-pointer items-center justify-between rounded-md px-3 text-sm text-text-secondary hover:bg-state-base-hover"
onClick={e => e.stopPropagation()}
>
<div>{t('workflow.nodes.note.editor.showAuthor')}</div>
<div>{t('nodes.note.editor.showAuthor', { ns: 'workflow' })}</div>
<Switch
size="l"
defaultValue={showAuthor}
@ -94,7 +94,7 @@ const Operator = ({
setOpen(false)
}}
>
{t('common.operation.delete')}
{t('operation.delete', { ns: 'common' })}
<ShortcutsName keys={['del']} />
</div>
</div>