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

@ -121,7 +121,7 @@ const HeaderInMobile = () => {
<div className="flex h-full w-[calc(100vw_-_40px)] flex-col rounded-xl bg-components-panel-bg shadow-lg backdrop-blur-sm" onClick={e => e.stopPropagation()}>
<div className="flex items-center gap-3 rounded-t-2xl border-b border-divider-subtle px-4 py-3">
<Message3Fill className="h-6 w-6 shrink-0" />
<div className="system-xl-semibold grow text-text-secondary">{t('share.chat.chatSettingsTitle')}</div>
<div className="system-xl-semibold grow text-text-secondary">{t('chat.chatSettingsTitle', { ns: 'share' })}</div>
</div>
<div className="p-4">
<InputsFormContent />
@ -131,8 +131,8 @@ const HeaderInMobile = () => {
)}
{!!showConfirm && (
<Confirm
title={t('share.chat.deleteConversation.title')}
content={t('share.chat.deleteConversation.content') || ''}
title={t('chat.deleteConversation.title', { ns: 'share' })}
content={t('chat.deleteConversation.content', { ns: 'share' }) || ''}
isShow
onCancel={handleCancelConfirm}
onConfirm={handleDelete}

View File

@ -109,7 +109,7 @@ const Header = () => {
{isSidebarCollapsed && (
<Tooltip
disabled={!!currentConversationId}
popupContent={t('share.chat.newChatTip')}
popupContent={t('chat.newChatTip', { ns: 'share' })}
>
<div>
<ActionButton
@ -127,7 +127,7 @@ const Header = () => {
<div className="flex items-center gap-1">
{currentConversationId && (
<Tooltip
popupContent={t('share.chat.resetChat')}
popupContent={t('chat.resetChat', { ns: 'share' })}
>
<ActionButton size="l" onClick={handleNewConversation}>
<RiResetLeftLine className="h-[18px] w-[18px]" />
@ -141,8 +141,8 @@ const Header = () => {
</div>
{!!showConfirm && (
<Confirm
title={t('share.chat.deleteConversation.title')}
content={t('share.chat.deleteConversation.content') || ''}
title={t('chat.deleteConversation.title', { ns: 'share' })}
content={t('chat.deleteConversation.content', { ns: 'share' }) || ''}
isShow
onCancel={handleCancelConfirm}
onConfirm={handleDelete}

View File

@ -42,11 +42,11 @@ const MobileOperationDropdown = ({
className="min-w-[160px] rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-1 shadow-lg backdrop-blur-sm"
>
<div className="system-md-regular flex cursor-pointer items-center space-x-1 rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover" onClick={handleResetChat}>
<span className="grow">{t('share.chat.resetChat')}</span>
<span className="grow">{t('chat.resetChat', { ns: 'share' })}</span>
</div>
{!hideViewChatSettings && (
<div className="system-md-regular flex cursor-pointer items-center space-x-1 rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover" onClick={handleViewChatSettings}>
<span className="grow">{t('share.chat.viewChatSettings')}</span>
<span className="grow">{t('chat.viewChatSettings', { ns: 'share' })}</span>
</div>
)}
</div>

View File

@ -54,16 +54,16 @@ const Operation: FC<Props> = ({
className="min-w-[120px] rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-1 shadow-lg backdrop-blur-sm"
>
<div className={cn('system-md-regular flex cursor-pointer items-center space-x-1 rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover')} onClick={togglePin}>
<span className="grow">{isPinned ? t('explore.sidebar.action.unpin') : t('explore.sidebar.action.pin')}</span>
<span className="grow">{isPinned ? t('sidebar.action.unpin', { ns: 'explore' }) : t('sidebar.action.pin', { ns: 'explore' })}</span>
</div>
{isShowRenameConversation && (
<div className={cn('system-md-regular flex cursor-pointer items-center space-x-1 rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-base-hover')} onClick={onRenameConversation}>
<span className="grow">{t('explore.sidebar.action.rename')}</span>
<span className="grow">{t('sidebar.action.rename', { ns: 'explore' })}</span>
</div>
)}
{isShowDelete && (
<div className={cn('system-md-regular group flex cursor-pointer items-center space-x-1 rounded-lg px-3 py-1.5 text-text-secondary hover:bg-state-destructive-hover hover:text-text-destructive')} onClick={onDelete}>
<span className="grow">{t('explore.sidebar.action.delete')}</span>
<span className="grow">{t('sidebar.action.delete', { ns: 'explore' })}</span>
</div>
)}
</div>

View File

@ -350,7 +350,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
if (showNewConversationItemInList && data[0]?.id !== '') {
data.unshift({
id: '',
name: t('share.chat.newChatDefaultName'),
name: t('chat.newChatDefaultName', { ns: 'share' }),
inputs: {},
introduction: '',
})
@ -421,12 +421,12 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
}
if (hasEmptyInput) {
notify({ type: 'error', message: t('appDebug.errorMessage.valueOfVarRequired', { key: hasEmptyInput }) })
notify({ type: 'error', message: t('errorMessage.valueOfVarRequired', { ns: 'appDebug', key: hasEmptyInput }) })
return false
}
if (fileIsUploading) {
notify({ type: 'info', message: t('appDebug.errorMessage.waitForFileUpload') })
notify({ type: 'info', message: t('errorMessage.waitForFileUpload', { ns: 'appDebug' }) })
return
}
@ -463,13 +463,13 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
const handlePinConversation = useCallback(async (conversationId: string) => {
await pinConversation(isInstalledApp, appId, conversationId)
notify({ type: 'success', message: t('common.api.success') })
notify({ type: 'success', message: t('api.success', { ns: 'common' }) })
handleUpdateConversationList()
}, [isInstalledApp, appId, notify, t, handleUpdateConversationList])
const handleUnpinConversation = useCallback(async (conversationId: string) => {
await unpinConversation(isInstalledApp, appId, conversationId)
notify({ type: 'success', message: t('common.api.success') })
notify({ type: 'success', message: t('api.success', { ns: 'common' }) })
handleUpdateConversationList()
}, [isInstalledApp, appId, notify, t, handleUpdateConversationList])
@ -486,7 +486,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
try {
setConversationDeleting(true)
await delConversation(isInstalledApp, appId, conversationId)
notify({ type: 'success', message: t('common.api.success') })
notify({ type: 'success', message: t('api.success', { ns: 'common' }) })
onSuccess()
}
finally {
@ -513,7 +513,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
if (!newName.trim()) {
notify({
type: 'error',
message: t('common.chat.conversationNameCanNotEmpty'),
message: t('chat.conversationNameCanNotEmpty', { ns: 'common' }),
})
return
}
@ -524,7 +524,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
notify({
type: 'success',
message: t('common.actionMsg.modifiedSuccessfully'),
message: t('actionMsg.modifiedSuccessfully', { ns: 'common' }),
})
setOriginConversationList(produce((draft) => {
const index = originConversationList.findIndex(item => item.id === conversationId)
@ -551,7 +551,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
const handleFeedback = useCallback(async (messageId: string, feedback: Feedback) => {
await updateFeedback({ url: `/messages/${messageId}/feedbacks`, body: { rating: feedback.rating, content: feedback.content } }, isInstalledApp, appId)
notify({ type: 'success', message: t('common.api.success') })
notify({ type: 'success', message: t('api.success', { ns: 'common' }) })
}, [isInstalledApp, appId, t, notify])
return {

View File

@ -50,7 +50,7 @@ const InputsFormContent = ({ showTip }: Props) => {
<div className="flex h-6 items-center gap-1">
<div className="system-md-semibold text-text-secondary">{form.label}</div>
{!form.required && (
<div className="system-xs-regular text-text-tertiary">{t('workflow.panel.optional')}</div>
<div className="system-xs-regular text-text-tertiary">{t('panel.optional', { ns: 'workflow' })}</div>
)}
</div>
)}
@ -134,7 +134,7 @@ const InputsFormContent = ({ showTip }: Props) => {
</div>
))}
{showTip && (
<div className="system-xs-regular text-text-tertiary">{t('share.chat.chatFormTip')}</div>
<div className="system-xs-regular text-text-tertiary">{t('chat.chatFormTip', { ns: 'share' })}</div>
)}
</div>
)

View File

@ -43,12 +43,12 @@ const InputsFormNode = ({
)}
>
<Message3Fill className="h-6 w-6 shrink-0" />
<div className="system-xl-semibold grow text-text-secondary">{t('share.chat.chatSettingsTitle')}</div>
<div className="system-xl-semibold grow text-text-secondary">{t('chat.chatSettingsTitle', { ns: 'share' })}</div>
{collapsed && (
<Button className="uppercase text-text-tertiary" size="small" variant="ghost" onClick={() => setCollapsed(false)}>{t('common.operation.edit')}</Button>
<Button className="uppercase text-text-tertiary" size="small" variant="ghost" onClick={() => setCollapsed(false)}>{t('operation.edit', { ns: 'common' })}</Button>
)}
{!collapsed && currentConversationId && (
<Button className="uppercase text-text-tertiary" size="small" variant="ghost" onClick={() => setCollapsed(true)}>{t('common.operation.close')}</Button>
<Button className="uppercase text-text-tertiary" size="small" variant="ghost" onClick={() => setCollapsed(true)}>{t('operation.close', { ns: 'common' })}</Button>
)}
</div>
{!collapsed && (
@ -70,7 +70,7 @@ const InputsFormNode = ({
: {}
}
>
{t('share.chat.startChat')}
{t('chat.startChat', { ns: 'share' })}
</Button>
</div>
)}

View File

@ -33,7 +33,7 @@ const ViewFormDropdown = () => {
<div className="w-[400px] rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-lg backdrop-blur-sm">
<div className="flex items-center gap-3 rounded-t-2xl border-b border-divider-subtle px-6 py-4">
<Message3Fill className="h-6 w-6 shrink-0" />
<div className="system-xl-semibold grow text-text-secondary">{t('share.chat.chatSettingsTitle')}</div>
<div className="system-xl-semibold grow text-text-secondary">{t('chat.chatSettingsTitle', { ns: 'share' })}</div>
</div>
<div className="p-6">
<InputsFormContent />

View File

@ -113,7 +113,7 @@ const Sidebar = ({ isPanel, panelVisible }: Props) => {
<div className="shrink-0 px-3 py-4">
<Button variant="secondary-accent" disabled={isResponding} className="w-full justify-center" onClick={handleNewConversation}>
<RiEditBoxLine className="mr-1 h-4 w-4" />
{t('share.chat.newChat')}
{t('chat.newChat', { ns: 'share' })}
</Button>
</div>
<div className="h-0 grow space-y-2 overflow-y-auto px-3 pt-4">
@ -122,7 +122,7 @@ const Sidebar = ({ isPanel, panelVisible }: Props) => {
<div className="mb-4">
<List
isPin
title={t('share.chat.pinnedTitle') || ''}
title={t('chat.pinnedTitle', { ns: 'share' }) || ''}
list={pinnedConversationList}
onChangeConversation={handleChangeConversation}
onOperate={handleOperate}
@ -132,7 +132,7 @@ const Sidebar = ({ isPanel, panelVisible }: Props) => {
)}
{!!conversationList.length && (
<List
title={(pinnedConversationList.length && t('share.chat.unpinnedTitle')) || ''}
title={(pinnedConversationList.length && t('chat.unpinnedTitle', { ns: 'share' })) || ''}
list={conversationList}
onChangeConversation={handleChangeConversation}
onOperate={handleOperate}
@ -154,7 +154,7 @@ const Sidebar = ({ isPanel, panelVisible }: Props) => {
'flex shrink-0 items-center gap-1.5 px-1',
)}
>
<div className="system-2xs-medium-uppercase text-text-tertiary">{t('share.chat.poweredBy')}</div>
<div className="system-2xs-medium-uppercase text-text-tertiary">{t('chat.poweredBy', { ns: 'share' })}</div>
{
systemFeatures.branding.enabled && systemFeatures.branding.workspace_logo
? <img src={systemFeatures.branding.workspace_logo} alt="logo" className="block h-5 w-auto" />
@ -167,8 +167,8 @@ const Sidebar = ({ isPanel, panelVisible }: Props) => {
</div>
{!!showConfirm && (
<Confirm
title={t('share.chat.deleteConversation.title')}
content={t('share.chat.deleteConversation.content') || ''}
title={t('chat.deleteConversation.title', { ns: 'share' })}
content={t('chat.deleteConversation.content', { ns: 'share' }) || ''}
isShow
onCancel={handleCancelConfirm}
onConfirm={handleDelete}

View File

@ -80,18 +80,18 @@ const Operation: FC<Props> = ({
<div className={cn('system-md-regular flex cursor-pointer items-center space-x-1 rounded-lg px-2 py-1.5 text-text-secondary hover:bg-state-base-hover')} onClick={togglePin}>
{isPinned && <RiUnpinLine className="h-4 w-4 shrink-0 text-text-tertiary" />}
{!isPinned && <RiPushpinLine className="h-4 w-4 shrink-0 text-text-tertiary" />}
<span className="grow">{isPinned ? t('explore.sidebar.action.unpin') : t('explore.sidebar.action.pin')}</span>
<span className="grow">{isPinned ? t('sidebar.action.unpin', { ns: 'explore' }) : t('sidebar.action.pin', { ns: 'explore' })}</span>
</div>
{isShowRenameConversation && (
<div className={cn('system-md-regular flex cursor-pointer items-center space-x-1 rounded-lg px-2 py-1.5 text-text-secondary hover:bg-state-base-hover')} onClick={onRenameConversation}>
<RiEditLine className="h-4 w-4 shrink-0 text-text-tertiary" />
<span className="grow">{t('explore.sidebar.action.rename')}</span>
<span className="grow">{t('sidebar.action.rename', { ns: 'explore' })}</span>
</div>
)}
{isShowDelete && (
<div className={cn('system-md-regular group flex cursor-pointer items-center space-x-1 rounded-lg px-2 py-1.5 text-text-secondary hover:bg-state-destructive-hover hover:text-text-destructive')} onClick={onDelete}>
<RiDeleteBinLine className={cn('h-4 w-4 shrink-0 text-text-tertiary group-hover:text-text-destructive')} />
<span className="grow">{t('explore.sidebar.action.delete')}</span>
<span className="grow">{t('sidebar.action.delete', { ns: 'explore' })}</span>
</div>
)}
</div>

View File

@ -27,21 +27,21 @@ const RenameModal: FC<IRenameModalProps> = ({
return (
<Modal
title={t('common.chat.renameConversation')}
title={t('chat.renameConversation', { ns: 'common' })}
isShow={isShow}
onClose={onClose}
>
<div className="mt-6 text-sm font-medium leading-[21px] text-text-primary">{t('common.chat.conversationName')}</div>
<div className="mt-6 text-sm font-medium leading-[21px] text-text-primary">{t('chat.conversationName', { ns: 'common' })}</div>
<Input
className="mt-2 h-10 w-full"
value={tempName}
onChange={e => setTempName(e.target.value)}
placeholder={t('common.chat.conversationNamePlaceholder') || ''}
placeholder={t('chat.conversationNamePlaceholder', { ns: 'common' }) || ''}
/>
<div className="mt-10 flex justify-end">
<Button className="mr-2 shrink-0" onClick={onClose}>{t('common.operation.cancel')}</Button>
<Button variant="primary" className="shrink-0" onClick={() => onSave(tempName)} loading={saveLoading}>{t('common.operation.save')}</Button>
<Button className="mr-2 shrink-0" onClick={onClose}>{t('operation.cancel', { ns: 'common' })}</Button>
<Button variant="primary" className="shrink-0" onClick={() => onSave(tempName)} loading={saveLoading}>{t('operation.save', { ns: 'common' })}</Button>
</div>
</Modal>
)

View File

@ -201,7 +201,7 @@ const Answer: FC<AnswerProps> = ({
annotation?.id && annotation.authorName && (
<EditTitle
className="mt-1"
title={t('appAnnotation.editBy', { author: annotation.authorName })}
title={t('editBy', { ns: 'appAnnotation', author: annotation.authorName })}
/>
)
}

View File

@ -19,15 +19,15 @@ const More: FC<MoreProps> = ({
<>
<div
className="mr-2 max-w-[25%] shrink-0 truncate"
title={`${t('appLog.detail.timeConsuming')} ${more.latency}${t('appLog.detail.second')}`}
title={`${t('detail.timeConsuming', { ns: 'appLog' })} ${more.latency}${t('detail.second', { ns: 'appLog' })}`}
>
{`${t('appLog.detail.timeConsuming')} ${more.latency}${t('appLog.detail.second')}`}
{`${t('detail.timeConsuming', { ns: 'appLog' })} ${more.latency}${t('detail.second', { ns: 'appLog' })}`}
</div>
<div
className="mr-2 max-w-[25%] shrink-0 truncate"
title={`${t('appLog.detail.tokenCost')} ${formatNumber(more.tokens)}`}
title={`${t('detail.tokenCost', { ns: 'appLog' })} ${formatNumber(more.tokens)}`}
>
{`${t('appLog.detail.tokenCost')} ${formatNumber(more.tokens)}`}
{`${t('detail.tokenCost', { ns: 'appLog' })} ${formatNumber(more.tokens)}`}
</div>
{more.tokens_per_second && (
<div

View File

@ -92,8 +92,8 @@ const Operation: FC<OperationProps> = ({
const shouldShowUserFeedbackBar = !isOpeningStatement && config?.supportFeedback && !!onFeedback && !config?.supportAnnotation
const shouldShowAdminFeedbackBar = !isOpeningStatement && config?.supportFeedback && !!onFeedback && !!config?.supportAnnotation
const userFeedbackLabel = t('appLog.table.header.userRate') || 'User feedback'
const adminFeedbackLabel = t('appLog.table.header.adminRate') || 'Admin feedback'
const userFeedbackLabel = t('table.header.userRate', { ns: 'appLog' }) || 'User feedback'
const adminFeedbackLabel = t('table.header.adminRate', { ns: 'appLog' }) || 'Admin feedback'
const feedbackTooltipClassName = 'max-w-[260px]'
const buildFeedbackTooltip = (feedbackData?: Feedback | null, label = userFeedbackLabel) => {
@ -101,8 +101,8 @@ const Operation: FC<OperationProps> = ({
return label
const ratingLabel = feedbackData.rating === 'like'
? (t('appLog.detail.operation.like') || 'like')
: (t('appLog.detail.operation.dislike') || 'dislike')
? (t('detail.operation.like', { ns: 'appLog' }) || 'like')
: (t('detail.operation.dislike', { ns: 'appLog' }) || 'dislike')
const feedbackText = feedbackData.content?.trim()
if (feedbackText)
@ -314,7 +314,7 @@ const Operation: FC<OperationProps> = ({
)}
<ActionButton onClick={() => {
copy(content)
Toast.notify({ type: 'success', message: t('common.actionMsg.copySuccessfully') })
Toast.notify({ type: 'success', message: t('actionMsg.copySuccessfully', { ns: 'common' }) })
}}
>
<RiClipboardLine className="h-4 w-4" />
@ -353,23 +353,23 @@ const Operation: FC<OperationProps> = ({
/>
{isShowFeedbackModal && (
<Modal
title={t('common.feedback.title') || 'Provide Feedback'}
subTitle={t('common.feedback.subtitle') || 'Please tell us what went wrong with this response'}
title={t('feedback.title', { ns: 'common' }) || 'Provide Feedback'}
subTitle={t('feedback.subtitle', { ns: 'common' }) || 'Please tell us what went wrong with this response'}
onClose={handleFeedbackCancel}
onConfirm={handleFeedbackSubmit}
onCancel={handleFeedbackCancel}
confirmButtonText={t('common.operation.submit') || 'Submit'}
cancelButtonText={t('common.operation.cancel') || 'Cancel'}
confirmButtonText={t('operation.submit', { ns: 'common' }) || 'Submit'}
cancelButtonText={t('operation.cancel', { ns: 'common' }) || 'Cancel'}
>
<div className="space-y-3">
<div>
<label className="system-sm-semibold mb-2 block text-text-secondary">
{t('common.feedback.content') || 'Feedback Content'}
{t('feedback.content', { ns: 'common' }) || 'Feedback Content'}
</label>
<Textarea
value={feedbackContent}
onChange={e => setFeedbackContent(e.target.value)}
placeholder={t('common.feedback.placeholder') || 'Please describe what went wrong or how we can improve...'}
placeholder={t('feedback.placeholder', { ns: 'common' }) || 'Please describe what went wrong or how we can improve...'}
rows={4}
className="w-full"
/>

View File

@ -17,7 +17,7 @@ const ToolDetail = ({
}: ToolDetailProps) => {
const { t } = useTranslation()
const { name, label, input, isFinished, output } = payload
const toolLabel = name.startsWith('dataset_') ? t('dataset.knowledge') : label
const toolLabel = name.startsWith('dataset_') ? t('knowledge', { ns: 'dataset' }) : label
const [expand, setExpand] = useState(false)
return (
@ -37,7 +37,7 @@ const ToolDetail = ({
>
{isFinished && <RiHammerFill className="mr-1 h-3.5 w-3.5" />}
{!isFinished && <RiLoader2Line className="mr-1 h-3.5 w-3.5 animate-spin" />}
{t(`tools.thought.${isFinished ? 'used' : 'using'}`)}
{t(`thought.${isFinished ? 'used' : 'using'}`, { ns: 'tools' })}
<div className="mx-1 text-text-secondary">{toolLabel}</div>
{!expand && <RiArrowRightSLine className="h-4 w-4" />}
{expand && <RiArrowDownSLine className="ml-auto h-4 w-4" />}
@ -47,7 +47,7 @@ const ToolDetail = ({
<>
<div className="mx-1 mb-0.5 rounded-[10px] bg-components-panel-on-panel-item-bg text-text-secondary">
<div className="system-xs-semibold-uppercase flex h-7 items-center justify-between px-2 pt-1">
{t('tools.thought.requestTitle')}
{t('thought.requestTitle', { ns: 'tools' })}
</div>
<div className="code-xs-regular break-words px-3 pb-2 pt-1">
{input}
@ -55,7 +55,7 @@ const ToolDetail = ({
</div>
<div className="mx-1 mb-1 rounded-[10px] bg-components-panel-on-panel-item-bg text-text-secondary">
<div className="system-xs-semibold-uppercase flex h-7 items-center justify-between px-2 pt-1">
{t('tools.thought.responseTitle')}
{t('thought.responseTitle', { ns: 'tools' })}
</div>
<div className="code-xs-regular break-words px-3 pb-2 pt-1">
{output}

View File

@ -73,7 +73,7 @@ const WorkflowProcessItem = ({
)
}
<div className={cn('system-xs-medium text-text-secondary', !collapse && 'grow')}>
{t('workflow.common.workflowProcess')}
{t('common.workflowProcess', { ns: 'workflow' })}
</div>
<RiArrowRightSLine className={cn('ml-1 h-4 w-4 text-text-tertiary', !collapse && 'rotate-90')} />
</div>

View File

@ -95,18 +95,18 @@ const ChatInputArea = ({
const handleSend = () => {
if (isResponding) {
notify({ type: 'info', message: t('appDebug.errorMessage.waitForResponse') })
notify({ type: 'info', message: t('errorMessage.waitForResponse', { ns: 'appDebug' }) })
return
}
if (onSend) {
const { files, setFiles } = filesStore.getState()
if (files.find(item => item.transferMethod === TransferMethod.local_file && !item.uploadedId)) {
notify({ type: 'info', message: t('appDebug.errorMessage.waitForFileUpload') })
notify({ type: 'info', message: t('errorMessage.waitForFileUpload', { ns: 'appDebug' }) })
return
}
if (!query || !query.trim()) {
notify({ type: 'info', message: t('appAnnotation.errorMessage.queryRequired') })
notify({ type: 'info', message: t('errorMessage.queryRequired', { ns: 'appAnnotation' }) })
return
}
if (checkInputsForm(inputs, inputsForm)) {
@ -163,7 +163,7 @@ const ChatInputArea = ({
(Recorder as any).getPermission().then(() => {
setShowVoiceInput(true)
}, () => {
notify({ type: 'error', message: t('common.voiceInput.notAllow') })
notify({ type: 'error', message: t('voiceInput.notAllow', { ns: 'common' }) })
})
}, [t, notify])
@ -205,7 +205,7 @@ const ChatInputArea = ({
className={cn(
'body-lg-regular w-full resize-none bg-transparent p-1 leading-6 text-text-primary outline-none',
)}
placeholder={decode(t('common.chat.inputPlaceholder', { botName }) || '')}
placeholder={decode(t('chat.inputPlaceholder', { ns: 'common', botName }) || '')}
autoFocus
minRows={1}
value={query}

View File

@ -36,12 +36,12 @@ export const useCheckInputsForms = () => {
}
if (hasEmptyInput) {
notify({ type: 'error', message: t('appDebug.errorMessage.valueOfVarRequired', { key: hasEmptyInput }) })
notify({ type: 'error', message: t('errorMessage.valueOfVarRequired', { ns: 'appDebug', key: hasEmptyInput }) })
return false
}
if (fileIsUploading) {
notify({ type: 'info', message: t('appDebug.errorMessage.waitForFileUpload') })
notify({ type: 'info', message: t('errorMessage.waitForFileUpload', { ns: 'appDebug' }) })
return
}

View File

@ -78,7 +78,7 @@ const Citation: FC<CitationProps> = ({
return (
<div className="-mb-1 mt-3">
<div className="system-xs-medium mb-2 flex items-center text-text-tertiary">
{t('common.chat.citation.title')}
{t('chat.citation.title', { ns: 'common' })}
<div className="ml-2 h-px grow bg-divider-regular" />
</div>
<div className="relative flex flex-wrap">

View File

@ -79,7 +79,7 @@ const Popup: FC<PopupProps> = ({
href={`/datasets/${source.dataset_id}/documents/${source.document_id}`}
className="hidden h-[18px] items-center text-xs text-text-accent group-hover:flex"
>
{t('common.chat.citation.linkToDataset')}
{t('chat.citation.linkToDataset', { ns: 'common' })}
<ArrowUpRight className="ml-1 h-3 w-3" />
</Link>
)
@ -90,17 +90,17 @@ const Popup: FC<PopupProps> = ({
showHitInfo && (
<div className="system-xs-medium mt-2 flex flex-wrap items-center text-text-quaternary">
<Tooltip
text={t('common.chat.citation.characters')}
text={t('chat.citation.characters', { ns: 'common' })}
data={source.word_count}
icon={<TypeSquare className="mr-1 h-3 w-3" />}
/>
<Tooltip
text={t('common.chat.citation.hitCount')}
text={t('chat.citation.hitCount', { ns: 'common' })}
data={source.hit_count}
icon={<Target04 className="mr-1 h-3 w-3" />}
/>
<Tooltip
text={t('common.chat.citation.vectorHash')}
text={t('chat.citation.vectorHash', { ns: 'common' })}
data={source.index_node_hash?.substring(0, 7)}
icon={<BezierCurve03 className="mr-1 h-3 w-3" />}
/>

View File

@ -36,7 +36,7 @@ const ProgressTooltip: FC<ProgressTooltipProps> = ({
</PortalToFollowElemTrigger>
<PortalToFollowElemContent style={{ zIndex: 1001 }}>
<div className="system-xs-medium rounded-lg bg-components-tooltip-bg p-3 text-text-quaternary shadow-lg">
{t('common.chat.citation.hitScore')}
{t('chat.citation.hitScore', { ns: 'common' })}
{' '}
{data}
</div>

View File

@ -226,7 +226,7 @@ export const useChat = (
setSuggestQuestions([])
if (isRespondingRef.current) {
notify({ type: 'info', message: t('appDebug.errorMessage.waitForResponse') })
notify({ type: 'info', message: t('errorMessage.waitForResponse', { ns: 'appDebug' }) })
return false
}

View File

@ -317,7 +317,7 @@ const Chat: FC<ChatProps> = ({
<div className="mb-2 flex justify-center">
<Button className="border-components-panel-border bg-components-panel-bg text-components-button-secondary-text" onClick={onStopResponding}>
<StopCircle className="mr-[5px] h-3.5 w-3.5" />
<span className="text-xs font-normal">{t('appDebug.operation.stopResponding')}</span>
<span className="text-xs font-normal">{t('operation.stopResponding', { ns: 'appDebug' })}</span>
</Button>
</div>
)

View File

@ -110,7 +110,7 @@ const Question: FC<QuestionProps> = ({
>
<ActionButton onClick={() => {
copy(content)
Toast.notify({ type: 'success', message: t('common.actionMsg.copySuccessfully') })
Toast.notify({ type: 'success', message: t('actionMsg.copySuccessfully', { ns: 'common' }) })
}}
>
<RiClipboardLine className="h-4 w-4" />
@ -157,8 +157,8 @@ const Question: FC<QuestionProps> = ({
/>
</div>
<div className="flex justify-end gap-2">
<Button variant="ghost" onClick={handleCancelEditing}>{t('common.operation.cancel')}</Button>
<Button variant="primary" onClick={handleResend}>{t('common.chat.resend')}</Button>
<Button variant="ghost" onClick={handleCancelEditing}>{t('operation.cancel', { ns: 'common' })}</Button>
<Button variant="primary" onClick={handleResend}>{t('chat.resend', { ns: 'common' })}</Button>
</div>
</div>
)}

View File

@ -19,7 +19,7 @@ const TryToAsk: FC<TryToAskProps> = ({
<div className="mb-2 py-2">
<div className="mb-2.5 flex items-center justify-between gap-2">
<Divider bgStyle="gradient" className="h-px !w-auto grow rotate-180" />
<div className="system-xs-medium-uppercase shrink-0 text-text-tertiary">{t('appDebug.feature.suggestedQuestionsAfterAnswer.tryToAsk')}</div>
<div className="system-xs-medium-uppercase shrink-0 text-text-tertiary">{t('feature.suggestedQuestionsAfterAnswer.tryToAsk', { ns: 'appDebug' })}</div>
<Divider bgStyle="gradient" className="h-px !w-auto grow" />
</div>
<div className="flex flex-wrap justify-center">

View File

@ -91,7 +91,7 @@ const Header: FC<IHeaderProps> = ({
'flex shrink-0 items-center gap-1.5 px-2',
)}
>
<div className="system-2xs-medium-uppercase text-text-tertiary">{t('share.chat.poweredBy')}</div>
<div className="system-2xs-medium-uppercase text-text-tertiary">{t('chat.poweredBy', { ns: 'share' })}</div>
{
systemFeatures.branding.enabled && systemFeatures.branding.workspace_logo
? <img src={systemFeatures.branding.workspace_logo} alt="logo" className="block h-5 w-auto" />
@ -108,7 +108,7 @@ const Header: FC<IHeaderProps> = ({
{
showToggleExpandButton && (
<Tooltip
popupContent={expanded ? t('share.chat.collapse') : t('share.chat.expand')}
popupContent={expanded ? t('chat.collapse', { ns: 'share' }) : t('chat.expand', { ns: 'share' })}
>
<ActionButton size="l" onClick={handleToggleExpand}>
{
@ -122,7 +122,7 @@ const Header: FC<IHeaderProps> = ({
}
{currentConversationId && allowResetChat && (
<Tooltip
popupContent={t('share.chat.resetChat')}
popupContent={t('chat.resetChat', { ns: 'share' })}
>
<ActionButton size="l" onClick={onCreateNewChat}>
<RiResetLeftLine className="h-[18px] w-[18px]" />
@ -155,7 +155,7 @@ const Header: FC<IHeaderProps> = ({
{
showToggleExpandButton && (
<Tooltip
popupContent={expanded ? t('share.chat.collapse') : t('share.chat.expand')}
popupContent={expanded ? t('chat.collapse', { ns: 'share' }) : t('chat.expand', { ns: 'share' })}
>
<ActionButton size="l" onClick={handleToggleExpand}>
{
@ -169,7 +169,7 @@ const Header: FC<IHeaderProps> = ({
}
{currentConversationId && allowResetChat && (
<Tooltip
popupContent={t('share.chat.resetChat')}
popupContent={t('chat.resetChat', { ns: 'share' })}
>
<ActionButton size="l" onClick={onCreateNewChat}>
<RiResetLeftLine className={cn('h-[18px] w-[18px]', theme?.colorPathOnHeader)} />

View File

@ -298,7 +298,7 @@ export const useEmbeddedChatbot = () => {
if (showNewConversationItemInList && data[0]?.id !== '') {
data.unshift({
id: '',
name: t('share.chat.newChatDefaultName'),
name: t('chat.newChatDefaultName', { ns: 'share' }),
inputs: {},
introduction: '',
})
@ -369,12 +369,12 @@ export const useEmbeddedChatbot = () => {
}
if (hasEmptyInput) {
notify({ type: 'error', message: t('appDebug.errorMessage.valueOfVarRequired', { key: hasEmptyInput }) })
notify({ type: 'error', message: t('errorMessage.valueOfVarRequired', { ns: 'appDebug', key: hasEmptyInput }) })
return false
}
if (fileIsUploading) {
notify({ type: 'info', message: t('appDebug.errorMessage.waitForFileUpload') })
notify({ type: 'info', message: t('errorMessage.waitForFileUpload', { ns: 'appDebug' }) })
return
}
@ -411,7 +411,7 @@ export const useEmbeddedChatbot = () => {
const handleFeedback = useCallback(async (messageId: string, feedback: Feedback) => {
await updateFeedback({ url: `/messages/${messageId}/feedbacks`, body: { rating: feedback.rating, content: feedback.content } }, isInstalledApp, appId)
notify({ type: 'success', message: t('common.api.success') })
notify({ type: 'success', message: t('api.success', { ns: 'common' }) })
}, [isInstalledApp, appId, t, notify])
return {

View File

@ -79,7 +79,7 @@ const Chatbot = () => {
'flex shrink-0 items-center gap-1.5 px-2',
)}
>
<div className="system-2xs-medium-uppercase text-text-tertiary">{t('share.chat.poweredBy')}</div>
<div className="system-2xs-medium-uppercase text-text-tertiary">{t('chat.poweredBy', { ns: 'share' })}</div>
{
systemFeatures.branding.enabled && systemFeatures.branding.workspace_logo
? <img src={systemFeatures.branding.workspace_logo} alt="logo" className="block h-5 w-auto" />

View File

@ -50,7 +50,7 @@ const InputsFormContent = ({ showTip }: Props) => {
<div className="flex h-6 items-center gap-1">
<div className="system-md-semibold text-text-secondary">{form.label}</div>
{!form.required && (
<div className="system-xs-regular text-text-tertiary">{t('workflow.panel.optional')}</div>
<div className="system-xs-regular text-text-tertiary">{t('panel.optional', { ns: 'workflow' })}</div>
)}
</div>
)}
@ -134,7 +134,7 @@ const InputsFormContent = ({ showTip }: Props) => {
</div>
))}
{showTip && (
<div className="system-xs-regular text-text-tertiary">{t('share.chat.chatFormTip')}</div>
<div className="system-xs-regular text-text-tertiary">{t('chat.chatFormTip', { ns: 'share' })}</div>
)}
</div>
)

View File

@ -43,12 +43,12 @@ const InputsFormNode = ({
)}
>
<Message3Fill className="h-6 w-6 shrink-0" />
<div className="system-xl-semibold grow text-text-secondary">{t('share.chat.chatSettingsTitle')}</div>
<div className="system-xl-semibold grow text-text-secondary">{t('chat.chatSettingsTitle', { ns: 'share' })}</div>
{collapsed && (
<Button className="uppercase text-text-tertiary" size="small" variant="ghost" onClick={() => setCollapsed(false)}>{t('common.operation.edit')}</Button>
<Button className="uppercase text-text-tertiary" size="small" variant="ghost" onClick={() => setCollapsed(false)}>{t('operation.edit', { ns: 'common' })}</Button>
)}
{!collapsed && currentConversationId && (
<Button className="uppercase text-text-tertiary" size="small" variant="ghost" onClick={() => setCollapsed(true)}>{t('common.operation.close')}</Button>
<Button className="uppercase text-text-tertiary" size="small" variant="ghost" onClick={() => setCollapsed(true)}>{t('operation.close', { ns: 'common' })}</Button>
)}
</div>
{!collapsed && (
@ -70,7 +70,7 @@ const InputsFormNode = ({
: {}
}
>
{t('share.chat.startChat')}
{t('chat.startChat', { ns: 'share' })}
</Button>
</div>
)}

View File

@ -37,7 +37,7 @@ const ViewFormDropdown = ({ iconColor }: Props) => {
<div className="w-[400px] rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-lg backdrop-blur-sm">
<div className="flex items-center gap-3 rounded-t-2xl border-b border-divider-subtle px-6 py-4">
<Message3Fill className="h-6 w-6 shrink-0" />
<div className="system-xl-semibold grow text-text-secondary">{t('share.chat.chatSettingsTitle')}</div>
<div className="system-xl-semibold grow text-text-secondary">{t('chat.chatSettingsTitle', { ns: 'share' })}</div>
</div>
<div className="p-6">
<InputsFormContent />