mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
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:
@ -103,7 +103,7 @@ const WorkflowChecklist = ({
|
||||
>
|
||||
<div className="text-md sticky top-0 z-[1] flex h-[44px] items-center bg-components-panel-bg pl-4 pr-3 pt-3 font-semibold text-text-primary">
|
||||
<div className="grow">
|
||||
{t('workflow.panel.checklist')}
|
||||
{t('panel.checklist', { ns: 'workflow' })}
|
||||
{needWarningNodes.length ? `(${needWarningNodes.length})` : ''}
|
||||
</div>
|
||||
<div
|
||||
@ -117,7 +117,7 @@ const WorkflowChecklist = ({
|
||||
{
|
||||
!!needWarningNodes.length && (
|
||||
<>
|
||||
<div className="px-4 pt-1 text-xs text-text-tertiary">{t('workflow.panel.checklistTip')}</div>
|
||||
<div className="px-4 pt-1 text-xs text-text-tertiary">{t('panel.checklistTip', { ns: 'workflow' })}</div>
|
||||
<div className="px-4 py-2">
|
||||
{
|
||||
needWarningNodes.map(node => (
|
||||
@ -142,7 +142,7 @@ const WorkflowChecklist = ({
|
||||
(showGoTo && node.canNavigate && !node.disableGoTo) && (
|
||||
<div className="flex h-4 w-[60px] shrink-0 items-center justify-center gap-1 opacity-0 transition-opacity duration-200 group-hover:opacity-100">
|
||||
<span className="whitespace-nowrap text-xs font-medium leading-4 text-primary-600">
|
||||
{t('workflow.panel.goTo')}
|
||||
{t('panel.goTo', { ns: 'workflow' })}
|
||||
</span>
|
||||
<IconR className="h-3.5 w-3.5 text-primary-600" />
|
||||
</div>
|
||||
@ -160,7 +160,7 @@ const WorkflowChecklist = ({
|
||||
<div className="px-3 py-1 first:pt-1.5 last:pb-1.5">
|
||||
<div className="flex text-xs leading-4 text-text-tertiary">
|
||||
<Warning className="mr-2 mt-[2px] h-3 w-3 text-[#F79009]" />
|
||||
{t('workflow.common.needConnectTip')}
|
||||
{t('common.needConnectTip', { ns: 'workflow' })}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@ -187,7 +187,7 @@ const WorkflowChecklist = ({
|
||||
!needWarningNodes.length && (
|
||||
<div className="mx-4 mb-3 rounded-lg bg-components-panel-bg py-4 text-center text-xs text-text-tertiary">
|
||||
<ChecklistSquare className="mx-auto mb-[5px] h-8 w-8 text-text-quaternary" />
|
||||
{t('workflow.panel.checklistResolved')}
|
||||
{t('panel.checklistResolved', { ns: 'workflow' })}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ const EditingTitle = () => {
|
||||
{
|
||||
!!draftUpdatedAt && (
|
||||
<>
|
||||
{t('workflow.common.autoSaved')}
|
||||
{t('common.autoSaved', { ns: 'workflow' })}
|
||||
{' '}
|
||||
{formatTime(draftUpdatedAt / 1000, 'HH:mm:ss')}
|
||||
</>
|
||||
@ -27,14 +27,14 @@ const EditingTitle = () => {
|
||||
<span className="mx-1 flex items-center">·</span>
|
||||
{
|
||||
publishedAt
|
||||
? `${t('workflow.common.published')} ${formatTimeFromNow(publishedAt)}`
|
||||
: t('workflow.common.unpublished')
|
||||
? `${t('common.published', { ns: 'workflow' })} ${formatTimeFromNow(publishedAt)}`
|
||||
: t('common.unpublished', { ns: 'workflow' })
|
||||
}
|
||||
{
|
||||
isSyncingWorkflowDraft && (
|
||||
<>
|
||||
<span className="mx-1 flex items-center">·</span>
|
||||
{t('workflow.common.syncingData')}
|
||||
{t('common.syncingData', { ns: 'workflow' })}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@ -58,13 +58,13 @@ const HeaderInRestoring = ({
|
||||
onSuccess: () => {
|
||||
Toast.notify({
|
||||
type: 'success',
|
||||
message: t('workflow.versionHistory.action.restoreSuccess'),
|
||||
message: t('versionHistory.action.restoreSuccess', { ns: 'workflow' }),
|
||||
})
|
||||
},
|
||||
onError: () => {
|
||||
Toast.notify({
|
||||
type: 'error',
|
||||
message: t('workflow.versionHistory.action.restoreFailure'),
|
||||
message: t('versionHistory.action.restoreFailure', { ns: 'workflow' }),
|
||||
})
|
||||
},
|
||||
onSettled: () => {
|
||||
@ -90,7 +90,7 @@ const HeaderInRestoring = ({
|
||||
theme === 'dark' && 'border-black/5 bg-white/10 backdrop-blur-sm',
|
||||
)}
|
||||
>
|
||||
{t('workflow.common.restore')}
|
||||
{t('common.restore', { ns: 'workflow' })}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleCancelRestore}
|
||||
@ -101,7 +101,7 @@ const HeaderInRestoring = ({
|
||||
>
|
||||
<div className="flex items-center gap-x-0.5">
|
||||
<RiHistoryLine className="h-4 w-4" />
|
||||
<span className="px-0.5">{t('workflow.common.exitVersions')}</span>
|
||||
<span className="px-0.5">{t('common.exitVersions', { ns: 'workflow' })}</span>
|
||||
</div>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@ -46,7 +46,7 @@ const HeaderInHistory = ({
|
||||
onClick={handleGoBackToEdit}
|
||||
>
|
||||
<ArrowNarrowLeft className="mr-1 h-4 w-4" />
|
||||
{t('workflow.common.goBackToEdit')}
|
||||
{t('common.goBackToEdit', { ns: 'workflow' })}
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@ -11,12 +11,12 @@ const RestoringTitle = () => {
|
||||
const { formatTime } = useTimestamp()
|
||||
const currentVersion = useStore(state => state.currentVersion)
|
||||
const isDraft = currentVersion?.version === WorkflowVersion.Draft
|
||||
const publishStatus = isDraft ? t('workflow.common.unpublished') : t('workflow.common.published')
|
||||
const publishStatus = isDraft ? t('common.unpublished', { ns: 'workflow' }) : t('common.published', { ns: 'workflow' })
|
||||
|
||||
const versionName = useMemo(() => {
|
||||
if (isDraft)
|
||||
return t('workflow.versionHistory.currentDraft')
|
||||
return currentVersion?.marked_name || t('workflow.versionHistory.defaultName')
|
||||
return t('versionHistory.currentDraft', { ns: 'workflow' })
|
||||
return currentVersion?.marked_name || t('versionHistory.defaultName', { ns: 'workflow' })
|
||||
}, [currentVersion, t, isDraft])
|
||||
|
||||
return (
|
||||
@ -26,7 +26,7 @@ const RestoringTitle = () => {
|
||||
{versionName}
|
||||
</span>
|
||||
<span className="system-2xs-medium-uppercase rounded-[5px] border border-text-accent-secondary bg-components-badge-bg-dimm px-1 py-0.5 text-text-accent-secondary">
|
||||
{t('workflow.common.viewOnly')}
|
||||
{t('common.viewOnly', { ns: 'workflow' })}
|
||||
</span>
|
||||
</div>
|
||||
<div className="system-xs-regular flex h-4 items-center gap-x-1 text-text-tertiary">
|
||||
|
||||
@ -26,7 +26,7 @@ const PreviewMode = memo(() => {
|
||||
onClick={() => handleWorkflowStartRunInChatflow()}
|
||||
>
|
||||
<RiPlayLargeLine className="mr-1 h-4 w-4" />
|
||||
{t('workflow.common.debugAndPreview')}
|
||||
{t('common.debugAndPreview', { ns: 'workflow' })}
|
||||
</div>
|
||||
)
|
||||
})
|
||||
|
||||
@ -66,7 +66,7 @@ const RunMode = ({
|
||||
isValid = false
|
||||
})
|
||||
if (!isValid) {
|
||||
notify({ type: 'error', message: t('workflow.panel.checklistTip') })
|
||||
notify({ type: 'error', message: t('panel.checklistTip', { ns: 'workflow' }) })
|
||||
return
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ const RunMode = ({
|
||||
disabled={true}
|
||||
>
|
||||
<RiLoader2Line className="mr-1 size-4 animate-spin" />
|
||||
{isListening ? t('workflow.common.listening') : t('workflow.common.running')}
|
||||
{isListening ? t('common.listening', { ns: 'workflow' }) : t('common.running', { ns: 'workflow' })}
|
||||
</button>
|
||||
)
|
||||
: (
|
||||
@ -142,7 +142,7 @@ const RunMode = ({
|
||||
style={{ userSelect: 'none' }}
|
||||
>
|
||||
<RiPlayLargeLine className="mr-1 size-4" />
|
||||
{text ?? t('workflow.common.run')}
|
||||
{text ?? t('common.run', { ns: 'workflow' })}
|
||||
<div className="system-kbd flex items-center gap-x-0.5 text-text-tertiary">
|
||||
<div className="flex size-4 items-center justify-center rounded-[4px] bg-components-kbd-bg-gray">
|
||||
{getKeyboardKeyNameBySystem('alt')}
|
||||
|
||||
@ -16,7 +16,7 @@ const RunningTitle = () => {
|
||||
<span>{isChatMode ? `Test Chat${formatWorkflowRunIdentifier(historyWorkflowData?.finished_at)}` : `Test Run${formatWorkflowRunIdentifier(historyWorkflowData?.finished_at)}`}</span>
|
||||
<span className="mx-1">·</span>
|
||||
<span className="ml-1 flex h-[18px] items-center rounded-[5px] border border-indigo-300 bg-white/[0.48] px-1 text-[10px] font-semibold uppercase text-indigo-600">
|
||||
{t('workflow.common.viewOnly')}
|
||||
{t('common.viewOnly', { ns: 'workflow' })}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
|
||||
@ -27,7 +27,7 @@ const ScrollToSelectedNodeButton: FC = () => {
|
||||
)}
|
||||
onClick={handleScrollToSelectedNode}
|
||||
>
|
||||
{t('workflow.panel.scrollToSelectedNode')}
|
||||
{t('panel.scrollToSelectedNode', { ns: 'workflow' })}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ const TestRunMenu = forwardRef<TestRunMenuRef, TestRunMenuProps>(({
|
||||
<PortalToFollowElemContent className="z-[12]">
|
||||
<div className="w-[284px] rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-1 shadow-lg">
|
||||
<div className="mb-2 px-3 pt-2 text-sm font-medium text-text-primary">
|
||||
{t('workflow.common.chooseStartNodeToRun')}
|
||||
{t('common.chooseStartNodeToRun', { ns: 'workflow' })}
|
||||
</div>
|
||||
<div>
|
||||
{hasUserInput && renderOption(options.userInput!)}
|
||||
|
||||
@ -32,7 +32,7 @@ const UndoRedo: FC<UndoRedoProps> = ({ handleUndo, handleRedo }) => {
|
||||
|
||||
return (
|
||||
<div className="flex items-center space-x-0.5 rounded-lg border-[0.5px] border-components-actionbar-border bg-components-actionbar-bg p-0.5 shadow-lg backdrop-blur-[5px]">
|
||||
<TipPopup title={t('workflow.common.undo')!} shortcuts={['ctrl', 'z']}>
|
||||
<TipPopup title={t('common.undo', { ns: 'workflow' })!} shortcuts={['ctrl', 'z']}>
|
||||
<div
|
||||
data-tooltip-id="workflow.undo"
|
||||
className={
|
||||
@ -44,7 +44,7 @@ const UndoRedo: FC<UndoRedoProps> = ({ handleUndo, handleRedo }) => {
|
||||
<RiArrowGoBackLine className="h-4 w-4" />
|
||||
</div>
|
||||
</TipPopup>
|
||||
<TipPopup title={t('workflow.common.redo')!} shortcuts={['ctrl', 'y']}>
|
||||
<TipPopup title={t('common.redo', { ns: 'workflow' })!} shortcuts={['ctrl', 'y']}>
|
||||
<div
|
||||
data-tooltip-id="workflow.redo"
|
||||
className={
|
||||
|
||||
@ -21,7 +21,7 @@ const PopupContent = React.memo(() => {
|
||||
return (
|
||||
<div className="flex items-center gap-x-1">
|
||||
<div className="system-xs-medium px-0.5 text-text-secondary">
|
||||
{t('workflow.common.versionHistory')}
|
||||
{t('common.versionHistory', { ns: 'workflow' })}
|
||||
</div>
|
||||
<div className="flex items-center gap-x-0.5">
|
||||
{VERSION_HISTORY_SHORTCUT.map(key => (
|
||||
|
||||
@ -92,14 +92,14 @@ const ViewHistory = ({
|
||||
<ClockPlay
|
||||
className="mr-1 h-4 w-4"
|
||||
/>
|
||||
{t('workflow.common.showRunHistory')}
|
||||
{t('common.showRunHistory', { ns: 'workflow' })}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
{
|
||||
!withText && (
|
||||
<Tooltip
|
||||
popupContent={t('workflow.common.viewRunHistory')}
|
||||
popupContent={t('common.viewRunHistory', { ns: 'workflow' })}
|
||||
>
|
||||
<div
|
||||
className={cn('group flex h-7 w-7 cursor-pointer items-center justify-center rounded-md hover:bg-state-accent-hover', open && 'bg-state-accent-hover')}
|
||||
@ -121,7 +121,7 @@ const ViewHistory = ({
|
||||
}}
|
||||
>
|
||||
<div className="sticky top-0 flex items-center justify-between bg-components-panel-bg px-4 pt-3 text-base font-semibold text-text-primary">
|
||||
<div className="grow">{t('workflow.common.runHistory')}</div>
|
||||
<div className="grow">{t('common.runHistory', { ns: 'workflow' })}</div>
|
||||
<div
|
||||
className="flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center"
|
||||
onClick={() => {
|
||||
@ -147,7 +147,7 @@ const ViewHistory = ({
|
||||
<div className="py-12">
|
||||
<ClockPlaySlim className="mx-auto mb-2 h-8 w-8 text-text-quaternary" />
|
||||
<div className="text-center text-[13px] text-text-quaternary">
|
||||
{t('workflow.common.notRunning')}
|
||||
{t('common.notRunning', { ns: 'workflow' })}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
@ -83,7 +83,7 @@ const ViewWorkflowHistory = () => {
|
||||
return
|
||||
|
||||
const count = index < 0 ? index * -1 : index
|
||||
return `${index > 0 ? t('workflow.changeHistory.stepForward', { count }) : t('workflow.changeHistory.stepBackward', { count })}`
|
||||
return `${index > 0 ? t('changeHistory.stepForward', { ns: 'workflow', count }) : t('changeHistory.stepBackward', { ns: 'workflow', count })}`
|
||||
}, [t])
|
||||
|
||||
const calculateChangeList: ChangeHistoryList = useMemo(() => {
|
||||
@ -139,7 +139,7 @@ const ViewWorkflowHistory = () => {
|
||||
>
|
||||
<PortalToFollowElemTrigger onClick={() => !nodesReadOnly && setOpen(v => !v)}>
|
||||
<TipPopup
|
||||
title={t('workflow.changeHistory.title')}
|
||||
title={t('changeHistory.title', { ns: 'workflow' })}
|
||||
>
|
||||
<div
|
||||
className={
|
||||
@ -161,7 +161,7 @@ const ViewWorkflowHistory = () => {
|
||||
className="ml-2 flex min-w-[240px] max-w-[360px] flex-col overflow-y-auto rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-xl backdrop-blur-[5px]"
|
||||
>
|
||||
<div className="sticky top-0 flex items-center justify-between px-4 pt-3">
|
||||
<div className="system-mg-regular grow text-text-secondary">{t('workflow.changeHistory.title')}</div>
|
||||
<div className="system-mg-regular grow text-text-secondary">{t('changeHistory.title', { ns: 'workflow' })}</div>
|
||||
<div
|
||||
className="flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center"
|
||||
onClick={() => {
|
||||
@ -184,7 +184,7 @@ const ViewWorkflowHistory = () => {
|
||||
<div className="py-12">
|
||||
<RiHistoryLine className="mx-auto mb-2 h-8 w-8 text-text-tertiary" />
|
||||
<div className="text-center text-[13px] text-text-tertiary">
|
||||
{t('workflow.changeHistory.placeholder')}
|
||||
{t('changeHistory.placeholder', { ns: 'workflow' })}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@ -211,12 +211,12 @@ const ViewWorkflowHistory = () => {
|
||||
>
|
||||
{composeHistoryItemLabel(
|
||||
item?.state?.workflowHistoryEventMeta?.nodeTitle,
|
||||
item?.label || t('workflow.changeHistory.sessionStart'),
|
||||
item?.label || t('changeHistory.sessionStart', { ns: 'workflow' }),
|
||||
)}
|
||||
{' '}
|
||||
(
|
||||
{calculateStepLabel(item?.index)}
|
||||
{item?.index === currentHistoryStateIndex && t('workflow.changeHistory.currentState')}
|
||||
{item?.index === currentHistoryStateIndex && t('changeHistory.currentState', { ns: 'workflow' })}
|
||||
)
|
||||
</div>
|
||||
</div>
|
||||
@ -244,7 +244,7 @@ const ViewWorkflowHistory = () => {
|
||||
>
|
||||
{composeHistoryItemLabel(
|
||||
item?.state?.workflowHistoryEventMeta?.nodeTitle,
|
||||
item?.label || t('workflow.changeHistory.sessionStart'),
|
||||
item?.label || t('changeHistory.sessionStart', { ns: 'workflow' }),
|
||||
)}
|
||||
{' '}
|
||||
(
|
||||
@ -277,7 +277,7 @@ const ViewWorkflowHistory = () => {
|
||||
'flex items-center text-[13px] font-medium leading-[18px]',
|
||||
)}
|
||||
>
|
||||
{t('workflow.changeHistory.clearHistory')}
|
||||
{t('changeHistory.clearHistory', { ns: 'workflow' })}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -285,8 +285,8 @@ const ViewWorkflowHistory = () => {
|
||||
)
|
||||
}
|
||||
<div className="w-[240px] px-3 py-2 text-xs text-text-tertiary">
|
||||
<div className="mb-1 flex h-[22px] items-center font-medium uppercase">{t('workflow.changeHistory.hint')}</div>
|
||||
<div className="mb-1 leading-[18px] text-text-tertiary">{t('workflow.changeHistory.hintText')}</div>
|
||||
<div className="mb-1 flex h-[22px] items-center font-medium uppercase">{t('changeHistory.hint', { ns: 'workflow' })}</div>
|
||||
<div className="mb-1 leading-[18px] text-text-tertiary">{t('changeHistory.hintText', { ns: 'workflow' })}</div>
|
||||
</div>
|
||||
</div>
|
||||
</PortalToFollowElemContent>
|
||||
|
||||
Reference in New Issue
Block a user