Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(web): declare translation namespace dependencies (#42784)

Stephen Zhou5f899e428a62
diff --git a/lint.config.ts b/lint.config.ts
index 64a2c1b11d1..621fa2f6554 100644
--- a/lint.config.ts
+++ b/lint.config.ts
@@ -488,6 +488,8 @@ export const lintConfig = {
'unicorn/no-abusive-eslint-disable': 'error',
'dify/no-file-wide-disable': 'error',
'dify/require-disable-directive-description': 'error',
+ 'dify/require-i18n-namespace': 'error',
+ 'dify/require-t-function-namespace': 'error',
'eslint-comments/no-aggregating-enable': 'error',
'eslint-comments/no-duplicate-disable': 'error',
'eslint-comments/no-unlimited-disable': 'error',
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx
index 4df033cbffe..479e907f6e7 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx
@@ -53,7 +53,7 @@ const AppDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
children,
appId, // get appId in path
} = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const router = useRouter()
const pathname = usePathname()
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/chart-view.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/chart-view.tsx
index 777113b1414..013dd48c6ac 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/chart-view.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/chart-view.tsx
@@ -72,7 +72,7 @@ function ChartViewContent({
headerRight,
deploymentEdition,
}: IChartViewProps & { deploymentEdition: DeploymentEdition }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common'])
const isCloudEdition = deploymentEdition === 'CLOUD'
const isNonCloudEdition = deploymentEdition === 'COMMUNITY' || deploymentEdition === 'ENTERPRISE'
const docLink = useDocLink()
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/long-time-range-picker.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/long-time-range-picker.tsx
index c727f700ed3..8310ffccc51 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/long-time-range-picker.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/long-time-range-picker.tsx
@@ -29,7 +29,7 @@ type Props = Readonly<{
const today = dayjs()
const LongTimeRangePicker: FC<Props> = ({ periodMapping, onSelect, queryDateFormat }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common'])
const items = React.useMemo<TimePeriodOption[]>(() => {
return Object.entries(periodMapping).map(([key, period]) => ({
value: key,
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/time-range-picker/range-selector.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/time-range-picker/range-selector.tsx
index 3f3cea791d9..6805ea62252 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/time-range-picker/range-selector.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/time-range-picker/range-selector.tsx
@@ -34,7 +34,7 @@ type Props = Readonly<{
}>
const RangeSelector: FC<Props> = ({ isCustomRange, ranges, onSelect }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog'])
const items = useMemo<TimePeriodOption[]>(() => {
return ranges.map((range) => ({
...range,
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx
index 828bbc07749..e9a07e787a8 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/config-popup.tsx
@@ -82,7 +82,7 @@ const ConfigPopup: FC<PopupProps> = ({
onConfigUpdated,
onConfigRemoved,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const [currentProvider, setCurrentProvider] = useState<TracingProvider | null>(
TracingProvider.langfuse,
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/panel.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/panel.tsx
index fa7366fe36e..48aa7cb4c28 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/panel.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/panel.tsx
@@ -42,7 +42,7 @@ import { TracingProvider } from './type'
const I18N_PREFIX = 'tracing'
const Panel: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const pathname = usePathname()
const matched = /\/app\/([^/]+)/.exec(pathname)
const appId = matched?.length && matched[1] ? matched[1] : ''
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx
index 2d3dff24e84..b1cb5f7f490 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-config-modal.tsx
@@ -145,7 +145,7 @@ const ProviderConfigModal: FC<Props> = ({
onSaved,
onChosen,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const isEdit = !!payload
const isAdd = !isEdit
const [isSaving, setIsSaving] = useState(false)
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-panel.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-panel.tsx
index 9e1cc1e9084..55c1fee7ac0 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-panel.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-panel.tsx
@@ -43,7 +43,7 @@ const ProviderPanel: FC<Props> = ({
hasConfigured,
onConfig,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const iconClassName = getIconClassName(type)
const handleConfigBtnClick = useCallback(
diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx
index 1a181ac2511..950e51e13f4 100644
--- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx
+++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx
@@ -86,7 +86,7 @@ const getDatasetRedirectionPath = (
const DatasetDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
const { children, datasetId } = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetPipeline'])
const router = useRouter()
const pathname = usePathname()
const isLoadingCurrentWorkspace = useAtomValue(currentWorkspaceLoadingAtom)
diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/settings/page.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/settings/page.tsx
index c0c0d814afb..cd032df070c 100644
--- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/settings/page.tsx
+++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/settings/page.tsx
@@ -2,7 +2,7 @@ import { useTranslation } from '#i18n'
import Form from '@/app/components/datasets/settings/form'
const Settings = () => {
- const { t } = useTranslation('datasetSettings')
+ const { t } = useTranslation(['datasetSettings'])
return (
<div className="h-full overflow-y-auto">
diff --git a/web/app/(commonLayout)/error.tsx b/web/app/(commonLayout)/error.tsx
index 9128c73cdd2..79f9f4d5788 100644
--- a/web/app/(commonLayout)/error.tsx
+++ b/web/app/(commonLayout)/error.tsx
@@ -12,7 +12,7 @@ type Props = Readonly<{
}>
export default function CommonLayoutError({ error, retry }: Props) {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const { reset: resetQueries } = useQueryErrorResetBoundary()
console.error(error)
diff --git a/web/app/(commonLayout)/marketplace/document-title.tsx b/web/app/(commonLayout)/marketplace/document-title.tsx
index d053ab9cb3c..1aaae53c76f 100644
--- a/web/app/(commonLayout)/marketplace/document-title.tsx
+++ b/web/app/(commonLayout)/marketplace/document-title.tsx
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'
import useDocumentTitle from '@/hooks/use-document-title'
const MarketplaceDocumentTitle = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
useDocumentTitle(t(($) => $['mainNav.marketplace'], { ns: 'common' }))
return null
}
diff --git a/web/app/(humanInputLayout)/form/[token]/branding-footer.tsx b/web/app/(humanInputLayout)/form/[token]/branding-footer.tsx
index 739c97e09dd..12dc204173b 100644
--- a/web/app/(humanInputLayout)/form/[token]/branding-footer.tsx
+++ b/web/app/(humanInputLayout)/form/[token]/branding-footer.tsx
@@ -7,7 +7,7 @@ type BrandingFooterProps = {
}
const BrandingFooter = ({ removeWebappBrand, replaceWebappLogo }: BrandingFooterProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
if (removeWebappBrand) return null
diff --git a/web/app/(humanInputLayout)/form/[token]/form-status-card.tsx b/web/app/(humanInputLayout)/form/[token]/form-status-card.tsx
index 0ce8984f209..92d7a151e94 100644
--- a/web/app/(humanInputLayout)/form/[token]/form-status-card.tsx
+++ b/web/app/(humanInputLayout)/form/[token]/form-status-card.tsx
@@ -20,7 +20,7 @@ const FormStatusCard = ({
removeWebappBrand,
replaceWebappLogo,
}: FormStatusCardProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
return (
<div className={cn('flex size-full flex-col items-center justify-center')}>
diff --git a/web/app/(humanInputLayout)/form/[token]/form.tsx b/web/app/(humanInputLayout)/form/[token]/form.tsx
index 7f533ae16b1..3de4b011925 100644
--- a/web/app/(humanInputLayout)/form/[token]/form.tsx
+++ b/web/app/(humanInputLayout)/form/[token]/form.tsx
@@ -26,7 +26,7 @@ export type FormData = {
}
const FormContent = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'share'])
const { token } = useParams<{ token: string }>()
diff --git a/web/app/(shareLayout)/components/authenticated-layout.tsx b/web/app/(shareLayout)/components/authenticated-layout.tsx
index cf6736c6eb2..b243298feff 100644
--- a/web/app/(shareLayout)/components/authenticated-layout.tsx
+++ b/web/app/(shareLayout)/components/authenticated-layout.tsx
@@ -13,7 +13,7 @@ import { resolveWebAppAddress } from '@/service/webapp-address'
import { webAppLogout } from '@/service/webapp-auth'
const AuthenticatedLayout = ({ children }: { children: React.ReactNode }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const updateAppInfo = useWebAppStore((s) => s.updateAppInfo)
const updateAppParams = useWebAppStore((s) => s.updateAppParams)
const updateWebAppMeta = useWebAppStore((s) => s.updateWebAppMeta)
diff --git a/web/app/(shareLayout)/components/splash.tsx b/web/app/(shareLayout)/components/splash.tsx
index 052d71e5829..c9b221b60bb 100644
--- a/web/app/(shareLayout)/components/splash.tsx
+++ b/web/app/(shareLayout)/components/splash.tsx
@@ -25,7 +25,7 @@ import { replaceLoginRedirect } from '@/utils/login-redirect.client'
import { basePath } from '@/utils/var'
function Splash({ children }: PropsWithChildren) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'share'])
const shareCode = useWebAppStore((s) => s.shareCode)
const webAppAccessMode = useWebAppStore((s) => s.webAppAccessMode)
const embeddedUserId = useWebAppStore((s) => s.embeddedUserId)
diff --git a/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx b/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx
index e8435f51d9d..27370f60278 100644
--- a/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx
+++ b/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx
@@ -12,7 +12,7 @@ import { useRouter, useSearchParams } from '@/next/navigation'
import { sendWebAppResetPasswordCode, verifyWebAppResetPasswordCode } from '@/service/common'
export default function CheckCode() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const router = useRouter()
const searchParams = useSearchParams()
const email = decodeURIComponent(searchParams.get('email') as string)
diff --git a/web/app/(shareLayout)/webapp-reset-password/page.tsx b/web/app/(shareLayout)/webapp-reset-password/page.tsx
index 7f98a682429..46451a85b29 100644
--- a/web/app/(shareLayout)/webapp-reset-password/page.tsx
+++ b/web/app/(shareLayout)/webapp-reset-password/page.tsx
@@ -15,7 +15,7 @@ import { useRouter, useSearchParams } from '@/next/navigation'
import { sendResetPasswordCode } from '@/service/common'
export default function CheckCode() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const searchParams = useSearchParams()
const router = useRouter()
const [email, setEmail] = useState('')
diff --git a/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx b/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx
index 6708d402398..0eecd9a7571 100644
--- a/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx
+++ b/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx
@@ -17,7 +17,7 @@ import { useRouter, useSearchParams } from '@/next/navigation'
import { changeWebAppPasswordWithToken } from '@/service/common'
const ChangePasswordForm = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'login'])
const router = useRouter()
const searchParams = useSearchParams()
const token = decodeURIComponent(searchParams.get('token') || '')
diff --git a/web/app/(shareLayout)/webapp-signin/check-code/page.tsx b/web/app/(shareLayout)/webapp-signin/check-code/page.tsx
index 5d113736890..ac15f5f42bc 100644
--- a/web/app/(shareLayout)/webapp-signin/check-code/page.tsx
+++ b/web/app/(shareLayout)/webapp-signin/check-code/page.tsx
@@ -22,7 +22,7 @@ import { replaceLoginRedirect } from '@/utils/login-redirect.client'
import { basePath } from '@/utils/var'
export default function CheckCode() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const router = useRouter()
const searchParams = useSearchParams()
const email = decodeURIComponent(searchParams.get('email') as string)
diff --git a/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx
index ddbed90e7aa..6be995a3776 100644
--- a/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx
+++ b/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx
@@ -14,7 +14,7 @@ import { replaceLoginRedirect } from '@/utils/login-redirect.client'
import { basePath } from '@/utils/var'
export default function MailAndCodeAuth() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const router = useRouter()
const searchParams = useSearchParams()
const emailFromLink = decodeURIComponent(searchParams.get('email') || '')
diff --git a/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx
index 1d3548a58c4..c09b324f5dc 100644
--- a/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx
+++ b/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx
@@ -29,7 +29,7 @@ type MailAndPasswordAuthProps = {
}
export default function MailAndPasswordAuth({ isEmailSetup }: MailAndPasswordAuthProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const router = useRouter()
const searchParams = useSearchParams()
const [showPassword, setShowPassword] = useState(false)
diff --git a/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx
index b4e7d27ce10..6c3fe33d82a 100644
--- a/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx
+++ b/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx
@@ -22,7 +22,7 @@ type SSOAuthProps = {
function SSOAuth({ protocol }: SSOAuthProps) {
const router = useRouter()
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const searchParams = useSearchParams()
const redirectUrl = searchParams.get('redirect_url')
diff --git a/web/app/(shareLayout)/webapp-signin/layout.tsx b/web/app/(shareLayout)/webapp-signin/layout.tsx
index 691c844e781..6fcbbb17de5 100644
--- a/web/app/(shareLayout)/webapp-signin/layout.tsx
+++ b/web/app/(shareLayout)/webapp-signin/layout.tsx
@@ -8,7 +8,7 @@ import { systemFeaturesQueryOptions } from '@/features/system-features/client'
import useDocumentTitle from '@/hooks/use-document-title'
export default function SignInLayout({ children }: PropsWithChildren) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
useDocumentTitle(t(($) => $['webapp.login'], { ns: 'login' }))
return (
diff --git a/web/app/(shareLayout)/webapp-signin/normalForm.tsx b/web/app/(shareLayout)/webapp-signin/normalForm.tsx
index a6c2cd83e8c..326dbeb14dc 100644
--- a/web/app/(shareLayout)/webapp-signin/normalForm.tsx
+++ b/web/app/(shareLayout)/webapp-signin/normalForm.tsx
@@ -14,7 +14,7 @@ import MailAndPasswordAuth from './components/mail-and-password-auth'
import SSOAuth from './components/sso-auth'
const NormalForm = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const [isLoading, setIsLoading] = useState(true)
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
diff --git a/web/app/(shareLayout)/webapp-signin/page.tsx b/web/app/(shareLayout)/webapp-signin/page.tsx
index 44868ffa39e..14dfadb77e5 100644
--- a/web/app/(shareLayout)/webapp-signin/page.tsx
+++ b/web/app/(shareLayout)/webapp-signin/page.tsx
@@ -23,7 +23,7 @@ const getClientOrigin = () => window.location.origin
const getServerOrigin = () => undefined
function WebSSOForm() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login', 'share'])
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const webAppAccessMode = useWebAppStore((s) => s.webAppAccessMode)
const searchParams = useSearchParams()
diff --git a/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx b/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx
index 85a13edc334..1aaaebf3d4e 100644
--- a/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx
+++ b/web/app/account/(commonLayout)/account-page/AvatarWithEdit.tsx
@@ -24,7 +24,7 @@ type InputImageInfo =
type AvatarWithEditProps = AvatarProps & { onSave?: () => void }
const AvatarWithEdit = ({ onSave, ...props }: AvatarWithEditProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const [inputImageInfo, setInputImageInfo] = useState<InputImageInfo>()
const [isShowAvatarPicker, setIsShowAvatarPicker] = useState(false)
diff --git a/web/app/account/(commonLayout)/account-page/email-change-modal.tsx b/web/app/account/(commonLayout)/account-page/email-change-modal.tsx
index 5bf5cc29f3e..f62e3c9ce4f 100644
--- a/web/app/account/(commonLayout)/account-page/email-change-modal.tsx
+++ b/web/app/account/(commonLayout)/account-page/email-change-modal.tsx
@@ -52,7 +52,7 @@ function isFetchResponseError(error: unknown): error is FetchResponseError {
}
const EmailChangeModal = ({ onClose, email }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const router = useRouter()
const [step, setStep] = useState<Step>(STEP.start)
const [code, setCode] = useState<string>('')
diff --git a/web/app/account/(commonLayout)/account-page/index.tsx b/web/app/account/(commonLayout)/account-page/index.tsx
index ac7d6121d5d..e96945b1146 100644
--- a/web/app/account/(commonLayout)/account-page/index.tsx
+++ b/web/app/account/(commonLayout)/account-page/index.tsx
@@ -33,7 +33,7 @@ const descriptionClassName = `
type AccountAppItem = AppPartial & IItem
export default function AccountPage() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'login'])
const editNameInputId = useId()
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const { data: appList } = useQuery(
diff --git a/web/app/account/(commonLayout)/avatar.tsx b/web/app/account/(commonLayout)/avatar.tsx
index ab87124de25..4ec407c141c 100644
--- a/web/app/account/(commonLayout)/avatar.tsx
+++ b/web/app/account/(commonLayout)/avatar.tsx
@@ -18,7 +18,7 @@ import { useLogout } from '@/service/use-common'
export default function AppSelector() {
const router = useRouter()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
// Cache is hydrated by CommonLayoutHydrationBoundary; this hits cache synchronously.
const { data: userProfileResp } = useSuspenseQuery(userProfileQueryOptions())
const userProfile = userProfileResp.profile
diff --git a/web/app/account/(commonLayout)/delete-account/components/check-email.tsx b/web/app/account/(commonLayout)/delete-account/components/check-email.tsx
index fd1b0fe20a7..384996e0b81 100644
--- a/web/app/account/(commonLayout)/delete-account/components/check-email.tsx
+++ b/web/app/account/(commonLayout)/delete-account/components/check-email.tsx
@@ -16,7 +16,7 @@ type DeleteAccountProps = {
}
export default function CheckEmail(props: DeleteAccountProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { data: userProfileEmail } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.email,
diff --git a/web/app/account/(commonLayout)/delete-account/components/feed-back.tsx b/web/app/account/(commonLayout)/delete-account/components/feed-back.tsx
index 333af440190..bbbaefcf2ec 100644
--- a/web/app/account/(commonLayout)/delete-account/components/feed-back.tsx
+++ b/web/app/account/(commonLayout)/delete-account/components/feed-back.tsx
@@ -23,7 +23,7 @@ type FeedbackFormValues = {
}
export default function FeedBack(props: DeleteAccountProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { data: userProfileEmail } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.email,
diff --git a/web/app/account/(commonLayout)/delete-account/components/verify-email.tsx b/web/app/account/(commonLayout)/delete-account/components/verify-email.tsx
index b0a0eef297b..1abb5300699 100644
--- a/web/app/account/(commonLayout)/delete-account/components/verify-email.tsx
+++ b/web/app/account/(commonLayout)/delete-account/components/verify-email.tsx
@@ -19,7 +19,7 @@ type VerifyEmailFormValues = {
}
export default function VerifyEmail(props: DeleteAccountProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const emailToken = useAccountDeleteStore((state) => state.sendEmailToken)
const { mutate: sendEmail } = useSendDeleteAccountEmail()
const { isPending: isDeleting, mutateAsync: confirmDeleteAccount } = useConfirmDeleteAccount()
diff --git a/web/app/account/(commonLayout)/delete-account/index.tsx b/web/app/account/(commonLayout)/delete-account/index.tsx
index 076e4a1425f..d4cad3546e4 100644
--- a/web/app/account/(commonLayout)/delete-account/index.tsx
+++ b/web/app/account/(commonLayout)/delete-account/index.tsx
@@ -13,7 +13,7 @@ type DeleteAccountProps = {
}
export default function DeleteAccount(props: DeleteAccountProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const setCountdownLeftTime = useSetCountdownLeftTime()
const [showVerifyEmail, setShowVerifyEmail] = useState(false)
diff --git a/web/app/account/(commonLayout)/header.tsx b/web/app/account/(commonLayout)/header.tsx
index 6a3c9ca06b9..fabbbacd436 100644
--- a/web/app/account/(commonLayout)/header.tsx
+++ b/web/app/account/(commonLayout)/header.tsx
@@ -9,7 +9,7 @@ import Link from '@/next/link'
import Avatar from './avatar'
const Header = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const logoLabel =
systemFeatures.branding.enabled && systemFeatures.branding.application_title
diff --git a/web/app/account/(commonLayout)/page.tsx b/web/app/account/(commonLayout)/page.tsx
index 48147e87029..ce56ef6fbc5 100644
--- a/web/app/account/(commonLayout)/page.tsx
+++ b/web/app/account/(commonLayout)/page.tsx
@@ -4,7 +4,7 @@ import useDocumentTitle from '@/hooks/use-document-title'
import AccountPage from './account-page'
export default function Account() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
useDocumentTitle(t(($) => $['menus.account'], { ns: 'common' }))
return (
<div className="mx-auto w-full max-w-160 px-6 pt-12">
diff --git a/web/app/account/oauth/authorize/page.tsx b/web/app/account/oauth/authorize/page.tsx
index 2f6ef347f92..65a9c186e91 100644
--- a/web/app/account/oauth/authorize/page.tsx
+++ b/web/app/account/oauth/authorize/page.tsx
@@ -25,7 +25,7 @@ import { useLogout } from '@/service/use-common'
import { buildOAuthCallbackUrl, buildReturnUrl, useSilentAuthorize } from './use-silent-authorize'
export default function OAuthAuthorize() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'oauth'])
const SCOPE_INFO_MAP: Record<
string,
diff --git a/web/app/account/oauth/authorize/use-silent-authorize.ts b/web/app/account/oauth/authorize/use-silent-authorize.ts
index ad561b2e3f6..90216b6ed15 100644
--- a/web/app/account/oauth/authorize/use-silent-authorize.ts
+++ b/web/app/account/oauth/authorize/use-silent-authorize.ts
@@ -52,7 +52,7 @@ export function useSilentAuthorize({
searchParams,
state,
}: SilentAuthorizeOptions) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['oauth'])
const router = useRouter()
const startedRef = useRef(false)
const [autoAuthorizationFailed, setAutoAuthorizationFailed] = useState(false)
diff --git a/web/app/activate/activateForm.tsx b/web/app/activate/activateForm.tsx
index f60dcf727c9..32e2c586a5c 100644
--- a/web/app/activate/activateForm.tsx
+++ b/web/app/activate/activateForm.tsx
@@ -10,7 +10,7 @@ import { useInvitationCheck } from '@/service/use-common'
const ActivateForm = () => {
const router = useRouter()
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const searchParams = useSearchParams()
const workspaceID = searchParams.get('workspace_id')
const email = searchParams.get('email')
diff --git a/web/app/components/access-rules-editor/add-access-subject-popover.tsx b/web/app/components/access-rules-editor/add-access-subject-popover.tsx
index 57a541a9bec..d46b2df354f 100644
--- a/web/app/components/access-rules-editor/add-access-subject-popover.tsx
+++ b/web/app/components/access-rules-editor/add-access-subject-popover.tsx
@@ -30,7 +30,7 @@ function AddAccessSubjectPopoverContent({
updatingAccountId,
onAddAccessSubject,
}: AddAccessSubjectPopoverContentProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const [searchValue, setSearchValue] = useState('')
const {
data: membersData,
@@ -170,7 +170,7 @@ function AddAccessSubjectPopover({
updatingAccountId,
onAddAccessSubject,
}: AddAccessSubjectPopoverProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [open, setOpen] = useState(false)
const isOpen = !disabled && open
diff --git a/web/app/components/access-rules-editor/automatic-include-workspace-members-section.tsx b/web/app/components/access-rules-editor/automatic-include-workspace-members-section.tsx
index 9c9912f0a9c..55a445dac5a 100644
--- a/web/app/components/access-rules-editor/automatic-include-workspace-members-section.tsx
+++ b/web/app/components/access-rules-editor/automatic-include-workspace-members-section.tsx
@@ -15,7 +15,7 @@ function AutomaticIncludeWorkspaceMembersSection({
loading,
onChange,
}: AutomaticIncludeWorkspaceMembersSectionProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['permission'])
const labelId = useId()
const descriptionId = useId()
diff --git a/web/app/components/access-rules-editor/batch-action.tsx b/web/app/components/access-rules-editor/batch-action.tsx
index 7e27ef48f6b..6eb121eb170 100644
--- a/web/app/components/access-rules-editor/batch-action.tsx
+++ b/web/app/components/access-rules-editor/batch-action.tsx
@@ -28,7 +28,7 @@ export default function AccessRulesBatchAction({
onDelete,
onCancel,
}: AccessRulesBatchActionProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const [isDeleteConfirmOpen, setIsDeleteConfirmOpen] = useState(false)
const [isDeleting, setIsDeleting] = useState(false)
diff --git a/web/app/components/access-rules-editor/index.tsx b/web/app/components/access-rules-editor/index.tsx
index d37efe99048..8f62664b73c 100644
--- a/web/app/components/access-rules-editor/index.tsx
+++ b/web/app/components/access-rules-editor/index.tsx
@@ -74,7 +74,7 @@ function AccessRulesEditor({
onBatchRemoveAccessPolicyMemberBindings,
onAddAccessSubject,
}: AccessRulesEditorProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const [selectedAccountIds, setSelectedAccountIds] = useState<Set<string>>(() => new Set())
const isLoading = isLoadingRules || isLoadingUserAccessSettings
const shouldCenterTableBody = isLoading || userAccessSettings.length === 0
diff --git a/web/app/components/access-rules-editor/user-access-policy-row.tsx b/web/app/components/access-rules-editor/user-access-policy-row.tsx
index 8db26ca5603..8f1804964d2 100644
--- a/web/app/components/access-rules-editor/user-access-policy-row.tsx
+++ b/web/app/components/access-rules-editor/user-access-policy-row.tsx
@@ -51,7 +51,7 @@ function UserAccessPolicyRow({
onChange,
onRemove,
}: UserAccessPolicyRowProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const accountId = setting.account.account_id
const accountName = setting.account.account_name || setting.account.email || accountId
const selectedPolicy = setting.access_policies?.[0]
diff --git a/web/app/components/api-key/api-key-modal.tsx b/web/app/components/api-key/api-key-modal.tsx
index 99884146aef..a58a7a87ba4 100644
--- a/web/app/components/api-key/api-key-modal.tsx
+++ b/web/app/components/api-key/api-key-modal.tsx
@@ -43,7 +43,7 @@ type ApiKeyModalProps = {
}
export function ApiKeyModal({ open, canManage, scope, onOpenChange }: ApiKeyModalProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appApi', 'common'])
const currentWorkspace = useAtomValue(currentWorkspaceAtom)
const [deleteKeyId, setDeleteKeyId] = useState<string>()
const [createdApiKey, setCreatedApiKey] = useState<CreatedApiKey>()
diff --git a/web/app/components/api-key/api-key-table.tsx b/web/app/components/api-key/api-key-table.tsx
index 2a1cda31737..8b41a2a4933 100644
--- a/web/app/components/api-key/api-key-table.tsx
+++ b/web/app/components/api-key/api-key-table.tsx
@@ -19,7 +19,7 @@ export function ApiKeyTable({
showScope = false,
onDeleteRequest,
}: ApiKeyTableProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appApi', 'common', 'time'])
const { formatTime } = useTimestamp()
const maskToken = (token: string) => `${token.slice(0, 3)}...${token.slice(-20)}`
diff --git a/web/app/components/api-key/created-api-key-dialog.tsx b/web/app/components/api-key/created-api-key-dialog.tsx
index 831d3060453..57a60d24003 100644
--- a/web/app/components/api-key/created-api-key-dialog.tsx
+++ b/web/app/components/api-key/created-api-key-dialog.tsx
@@ -19,7 +19,7 @@ type CreatedApiKeyDialogProps = {
}
export function CreatedApiKeyDialog({ open, onOpenChange, value }: CreatedApiKeyDialogProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appApi', 'common'])
return (
<Dialog open={open} onOpenChange={onOpenChange}>
diff --git a/web/app/components/api-key/dataset-scope-dialog.tsx b/web/app/components/api-key/dataset-scope-dialog.tsx
index fd0255affdf..4f52092891e 100644
--- a/web/app/components/api-key/dataset-scope-dialog.tsx
+++ b/web/app/components/api-key/dataset-scope-dialog.tsx
@@ -39,7 +39,7 @@ export function DatasetScopeDialog({
onOpenChange,
onConfirm,
}: DatasetScopeDialogProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appApi', 'common'])
const [scope, setScope] = useState<Scope>('all')
const [selected, setSelected] = useState<SelectedKb[]>([])
const [pickerOpen, setPickerOpen] = useState(false)
diff --git a/web/app/components/app-sidebar/app-detail-section.tsx b/web/app/components/app-sidebar/app-detail-section.tsx
index 65adcf7043b..5d6e6c52ed4 100644
--- a/web/app/components/app-sidebar/app-detail-section.tsx
+++ b/web/app/components/app-sidebar/app-detail-section.tsx
@@ -42,7 +42,7 @@ type AppDetailSectionProps = {
}
const AppDetailSection = ({ expand = true }: AppDetailSectionProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const pathname = usePathname()
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const { data: currentUserId } = useSuspenseQuery({
diff --git a/web/app/components/app-sidebar/app-detail-top.tsx b/web/app/components/app-sidebar/app-detail-top.tsx
index 6983e8b744b..b6e2f4299bd 100644
--- a/web/app/components/app-sidebar/app-detail-top.tsx
+++ b/web/app/components/app-sidebar/app-detail-top.tsx
@@ -23,7 +23,7 @@ type AppDetailTopProps = {
}
export function AppDetailTop({ expand = true, onToggle }: AppDetailTopProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
if (!expand) {
return (
diff --git a/web/app/components/app-sidebar/app-info/__tests__/app-mode-labels.spec.ts b/web/app/components/app-sidebar/app-info/__tests__/app-mode-labels.spec.ts
index ef7f6343ebc..e954621d001 100644
--- a/web/app/components/app-sidebar/app-info/__tests__/app-mode-labels.spec.ts
+++ b/web/app/components/app-sidebar/app-info/__tests__/app-mode-labels.spec.ts
@@ -7,7 +7,7 @@ describe('getAppModeLabel', () => {
const t = withSelectorKey((key: string, options?: Record<string, unknown>) => {
const ns = (options?.ns as string | undefined) ?? ''
return ns ? `${ns}.${key}` : key
- }, 'app') as unknown as TFunction
+ }, 'app') as unknown as TFunction<['app']>
it('should return advanced chat label', () => {
expect(getAppModeLabel(AppModeEnum.ADVANCED_CHAT, t)).toBe('app.types.advanced')
diff --git a/web/app/components/app-sidebar/app-info/app-info-modals.tsx b/web/app/components/app-sidebar/app-info/app-info-modals.tsx
index 82c41a3b65c..b3afbe2a2d2 100644
--- a/web/app/components/app-sidebar/app-info/app-info-modals.tsx
+++ b/web/app/components/app-sidebar/app-info/app-info-modals.tsx
@@ -63,7 +63,7 @@ const AppInfoModals = ({
handleConfirmExport,
onConfirmDelete,
}: AppInfoModalsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common', 'workflow'])
const [confirmDeleteInput, setConfirmDeleteInput] = useState('')
const [isSecretExporting, setIsSecretExporting] = useState(false)
const exportConfirmLabelId = React.useId()
diff --git a/web/app/components/app-sidebar/app-info/app-info-trigger.tsx b/web/app/components/app-sidebar/app-info/app-info-trigger.tsx
index 24ae0b9799d..7da412685ca 100644
--- a/web/app/components/app-sidebar/app-info/app-info-trigger.tsx
+++ b/web/app/components/app-sidebar/app-info/app-info-trigger.tsx
@@ -29,7 +29,7 @@ const AppInfoTrigger = ({
isExporting,
exportCheck,
}: AppInfoTriggerProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common', 'workflow'])
const { data: currentUserId } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.id,
diff --git a/web/app/components/app-sidebar/app-info/app-mode-labels.ts b/web/app/components/app-sidebar/app-info/app-mode-labels.ts
index 1ff7559f650..260ff3b95e5 100644
--- a/web/app/components/app-sidebar/app-info/app-mode-labels.ts
+++ b/web/app/components/app-sidebar/app-info/app-mode-labels.ts
@@ -1,7 +1,7 @@
import type { TFunction } from 'i18next'
import { AppModeEnum } from '@/types/app'
-export function getAppModeLabel(mode: string, t: TFunction): string {
+export function getAppModeLabel(mode: string, t: TFunction<['app']>): string {
switch (mode) {
case AppModeEnum.ADVANCED_CHAT:
return t(($) => $['types.advanced'], { ns: 'app' })
diff --git a/web/app/components/app-sidebar/app-info/app-operations.tsx b/web/app/components/app-sidebar/app-info/app-operations.tsx
index f45b8878cd0..26fe65a8d45 100644
--- a/web/app/components/app-sidebar/app-info/app-operations.tsx
+++ b/web/app/components/app-sidebar/app-info/app-operations.tsx
@@ -27,7 +27,7 @@ type AppOperationsProps = {
}
const AppOperations = ({ appName, operationGroups }: AppOperationsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const visibleGroups = operationGroups.filter((group) => group.length > 0)
if (!visibleGroups.length) return null
diff --git a/web/app/components/app-sidebar/app-info/use-app-info-actions.ts b/web/app/components/app-sidebar/app-info/use-app-info-actions.ts
index 116c09ad12b..527417d40eb 100644
--- a/web/app/components/app-sidebar/app-info/use-app-info-actions.ts
+++ b/web/app/components/app-sidebar/app-info/use-app-info-actions.ts
@@ -90,7 +90,7 @@ const getCurrentUiState = (state: AppInfoUiState, resetKey?: string) => {
}
export function useAppInfoActions({ resetKey }: UseAppInfoActionsParams) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const { replace } = useRouter()
const queryClient = useQueryClient()
const { mutateAsync: copyApp } = useMutation(
diff --git a/web/app/components/app-sidebar/dataset-detail-section.tsx b/web/app/components/app-sidebar/dataset-detail-section.tsx
index 68e6b6e3024..5663259771e 100644
--- a/web/app/components/app-sidebar/dataset-detail-section.tsx
+++ b/web/app/components/app-sidebar/dataset-detail-section.tsx
@@ -27,7 +27,7 @@ type DatasetDetailSectionProps = {
}
const DatasetDetailSection = ({ expand = true }: DatasetDetailSectionProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const pathname = usePathname()
const datasetId = getDatasetIdFromPathname(pathname)
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
diff --git a/web/app/components/app-sidebar/dataset-detail-top.tsx b/web/app/components/app-sidebar/dataset-detail-top.tsx
index 1642f285a2d..a441b9379a1 100644
--- a/web/app/components/app-sidebar/dataset-detail-top.tsx
+++ b/web/app/components/app-sidebar/dataset-detail-top.tsx
@@ -23,7 +23,7 @@ type DatasetDetailTopProps = {
}
export function DatasetDetailTop({ expand = true, onToggle }: DatasetDetailTopProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
if (!expand) {
return (
diff --git a/web/app/components/app-sidebar/dataset-info/dropdown.tsx b/web/app/components/app-sidebar/dataset-info/dropdown.tsx
index a1def0ee008..80b8f342411 100644
--- a/web/app/components/app-sidebar/dataset-info/dropdown.tsx
+++ b/web/app/components/app-sidebar/dataset-info/dropdown.tsx
@@ -63,7 +63,7 @@ const getErrorMessage = async (error: unknown) => {
}
const DropDown = ({ expand, triggerClassName }: DropDownProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common', 'dataset'])
const { push, replace } = useRouter()
const [open, setOpen] = useState(false)
const [showRenameModal, setShowRenameModal] = useState(false)
diff --git a/web/app/components/app-sidebar/dataset-info/index.tsx b/web/app/components/app-sidebar/dataset-info/index.tsx
index f10e7a2383f..d6af45bd61e 100644
--- a/web/app/components/app-sidebar/dataset-info/index.tsx
+++ b/web/app/components/app-sidebar/dataset-info/index.tsx
@@ -14,7 +14,7 @@ type DatasetInfoProps = {
}
const DatasetInfo = ({ expand }: DatasetInfoProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const dataset = useDatasetDetailContextWithSelector((state) => state.dataset) as DataSet
const iconInfo = dataset.icon_info || {
icon: '📙',
diff --git a/web/app/components/app-sidebar/dataset-info/menu.tsx b/web/app/components/app-sidebar/dataset-info/menu.tsx
index fe83aa60b78..6254ed4f619 100644
--- a/web/app/components/app-sidebar/dataset-info/menu.tsx
+++ b/web/app/components/app-sidebar/dataset-info/menu.tsx
@@ -26,7 +26,7 @@ const Menu = ({
detectIsUsedByApp,
openAccessConfig,
}: MenuProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetPipeline'])
const runtimeMode = useDatasetDetailContextWithSelector((state) => state.dataset?.runtime_mode)
return (
diff --git a/web/app/components/app-sidebar/snippet-info/dropdown.tsx b/web/app/components/app-sidebar/snippet-info/dropdown.tsx
index d582b801baf..372bc5bc0c8 100644
--- a/web/app/components/app-sidebar/snippet-info/dropdown.tsx
+++ b/web/app/components/app-sidebar/snippet-info/dropdown.tsx
@@ -41,7 +41,7 @@ type SnippetInfoDropdownProps = {
}
const SnippetInfoDropdown = ({ snippet }: SnippetInfoDropdownProps) => {
- const { t } = useTranslation('snippet')
+ const { t } = useTranslation(['snippet', 'common'])
const { replace } = useRouter()
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
const [open, setOpen] = React.useState(false)
diff --git a/web/app/components/app/access-config/index.tsx b/web/app/components/app/access-config/index.tsx
index 570b7d850f2..4a1789d2036 100644
--- a/web/app/components/app/access-config/index.tsx
+++ b/web/app/components/app/access-config/index.tsx
@@ -35,7 +35,7 @@ type AppAccessConfigContentProps = {
}
const AppAccessConfigContent = ({ appId, maintainerId }: AppAccessConfigContentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const locale = useLocale()
const language = useMemo(() => getAccessControlTemplateLanguage(locale), [locale])
const [currentPage, setCurrentPage] = useState(1)
diff --git a/web/app/components/app/access-point/built-in-access-points/index.tsx b/web/app/components/app/access-point/built-in-access-points/index.tsx
index 30c3d99bf27..a9ef011645c 100644
--- a/web/app/components/app/access-point/built-in-access-points/index.tsx
+++ b/web/app/components/app/access-point/built-in-access-points/index.tsx
@@ -33,7 +33,7 @@ export function BuiltInAccessPoints({
canReleaseAndVersion,
highlightedAccessPoint,
}: BuiltInAccessPointsProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'deployments'])
const docLink = useDocLink()
const appInfo = useAppStore((state) => state.appDetail)
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
diff --git a/web/app/components/app/access-point/built-in-access-points/mcp-card.tsx b/web/app/components/app/access-point/built-in-access-points/mcp-card.tsx
index 59a754cc314..2819eee88e5 100644
--- a/web/app/components/app/access-point/built-in-access-points/mcp-card.tsx
+++ b/web/app/components/app/access-point/built-in-access-points/mcp-card.tsx
@@ -46,7 +46,7 @@ export function MCPAccessPointCard({
workflow,
workflowLoading,
}: MCPAccessPointCardProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview', 'common', 'deployments', 'tools'])
const advancedApp = isAdvancedApp(appInfo)
const basicApp = !advancedApp
const workflowApp = appInfo.mode === AppModeEnum.WORKFLOW
diff --git a/web/app/components/app/access-point/built-in-access-points/service-api-card.tsx b/web/app/components/app/access-point/built-in-access-points/service-api-card.tsx
index 4b6fa613341..a2e147e5548 100644
--- a/web/app/components/app/access-point/built-in-access-points/service-api-card.tsx
+++ b/web/app/components/app/access-point/built-in-access-points/service-api-card.tsx
@@ -24,7 +24,7 @@ export function ServiceApiAccessPointCard({
canManage,
highlighted,
}: ServiceApiAccessPointCardProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const setAppDetail = useAppStore((state) => state.setAppDetail)
const toggleApiMutation = useMutation(
consoleQuery.apps.byAppId.apiEnable.post.mutationOptions({
diff --git a/web/app/components/app/access-point/built-in-access-points/trigger-card.tsx b/web/app/components/app/access-point/built-in-access-points/trigger-card.tsx
index 5c46fac1ee6..caee48ca111 100644
--- a/web/app/components/app/access-point/built-in-access-points/trigger-card.tsx
+++ b/web/app/components/app/access-point/built-in-access-points/trigger-card.tsx
@@ -63,7 +63,7 @@ function TriggerAccessPointItem({
trigger: AppTrigger
triggerPlugins: TriggerWithProvider[]
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['agentV2', 'appOverview', 'common'])
const invalidateTriggers = useInvalidateAppTriggers()
const updateTriggerMutation = useMutation(
consoleQuery.apps.byAppId.triggerEnable.post.mutationOptions({
@@ -143,7 +143,7 @@ export function TriggerAccessPointCard({
canManageAccessPoint,
highlighted,
}: TriggerAccessPointCardProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview', 'common', 'deployments'])
const docLink = useDocLink()
const { data: response, isLoading } = useAppTriggers(appInfo.id)
const { data: triggerPlugins = [] } = useAllTriggerPlugins()
diff --git a/web/app/components/app/access-point/built-in-access-points/web-app-card.tsx b/web/app/components/app/access-point/built-in-access-points/web-app-card.tsx
index f3265e6db6a..26acf232373 100644
--- a/web/app/components/app/access-point/built-in-access-points/web-app-card.tsx
+++ b/web/app/components/app/access-point/built-in-access-points/web-app-card.tsx
@@ -79,7 +79,7 @@ export function WebAppAccessPointCard({
showAccessControl,
workflow,
}: WebAppAccessPointCardProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['agentV2', 'app', 'appOverview', 'common', 'deployments'])
const setAppDetail = useAppStore((state) => state.setAppDetail)
const [showSettings, setShowSettings] = useState(false)
const [showEmbedded, setShowEmbedded] = useState(false)
diff --git a/web/app/components/app/access-point/deployed-environment-access-points/environment-access-control.tsx b/web/app/components/app/access-point/deployed-environment-access-points/environment-access-control.tsx
index 423d3b0cc2b..7e4a010b3a2 100644
--- a/web/app/components/app/access-point/deployed-environment-access-points/environment-access-control.tsx
+++ b/web/app/components/app/access-point/deployed-environment-access-points/environment-access-control.tsx
@@ -42,7 +42,7 @@ function EnvironmentAccessControlContainer({
onClose,
onConfirm,
}: EnvironmentAccessControlProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const queryClient = useQueryClient()
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const [accessMode, setAccessMode] = useState<AccessMode>(initialAccessMode)
diff --git a/web/app/components/app/access-point/deployed-environment-access-points/environment-service-api-card.tsx b/web/app/components/app/access-point/deployed-environment-access-points/environment-service-api-card.tsx
index 02c3e01dde1..88c439e91f4 100644
--- a/web/app/components/app/access-point/deployed-environment-access-points/environment-service-api-card.tsx
+++ b/web/app/components/app/access-point/deployed-environment-access-points/environment-service-api-card.tsx
@@ -20,7 +20,7 @@ export function EnvironmentServiceApiCard({
canManageAccessPoint,
highlighted,
}: EnvironmentServiceApiCardProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const appMode = useAppStore((state) => state.appDetail?.mode)
const params = {
app_id: appId,
diff --git a/web/app/components/app/access-point/deployed-environment-access-points/environment-web-app-card.tsx b/web/app/components/app/access-point/deployed-environment-access-points/environment-web-app-card.tsx
index f6003099544..638a1928293 100644
--- a/web/app/components/app/access-point/deployed-environment-access-points/environment-web-app-card.tsx
+++ b/web/app/components/app/access-point/deployed-environment-access-points/environment-web-app-card.tsx
@@ -53,7 +53,7 @@ export function EnvironmentWebAppCard({
canManageAccessPoint,
highlighted,
}: EnvironmentWebAppCardProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['agentV2', 'app', 'appOverview', 'common', 'deployments'])
const queryClient = useQueryClient()
const appInfo = useAppStore((state) => state.appDetail) as AccessPointAppInfo | null
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
diff --git a/web/app/components/app/access-point/deployed-environment-access-points/index.tsx b/web/app/components/app/access-point/deployed-environment-access-points/index.tsx
index 96cfdbbc78b..0c424db9dbe 100644
--- a/web/app/components/app/access-point/deployed-environment-access-points/index.tsx
+++ b/web/app/components/app/access-point/deployed-environment-access-points/index.tsx
@@ -42,7 +42,7 @@ export function DeployedEnvironmentAccessPoints({
canManageAccessPoint,
highlightedAccessPoint,
}: DeployedEnvironmentAccessPointsProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'deployments', 'tools'])
const unsupportedStatusLabel = useAccessPointStatusLabel('unsupported')
const title = (accessPoint: (typeof UNSUPPORTED_ACCESS_POINTS)[number]) => {
diff --git a/web/app/components/app/access-point/index.tsx b/web/app/components/app/access-point/index.tsx
index fb59a07fea1..d068ac999fe 100644
--- a/web/app/components/app/access-point/index.tsx
+++ b/web/app/components/app/access-point/index.tsx
@@ -53,7 +53,7 @@ function AccessPointContent({
canReleaseAndVersion,
showEnvironmentTabs,
}: AccessPointContentProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'deployments', 'workflow'])
const environments = useAtomValue(inUseAppEnvironmentsAtom)
const [queryStates, setQueryStates] = useQueryStates(accessPointQueryStates)
const { accessPoint: highlightedAccessPoint, environment } = queryStates
diff --git a/web/app/components/app/access-point/shared/api-secret-key-button.tsx b/web/app/components/app/access-point/shared/api-secret-key-button.tsx
index 2341797888e..4666e396ce5 100644
--- a/web/app/components/app/access-point/shared/api-secret-key-button.tsx
+++ b/web/app/components/app/access-point/shared/api-secret-key-button.tsx
@@ -23,7 +23,7 @@ export function ApiSecretKeyButton({
disabled = false,
environmentId,
}: ApiSecretKeyButtonProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appApi'])
const [modalOpen, setModalOpen] = useState(false)
const isEnvironmentScope = Boolean(environmentId)
const apiKeysQuery = useQuery(
diff --git a/web/app/components/app/access-point/shared/service-api-card-view.tsx b/web/app/components/app/access-point/shared/service-api-card-view.tsx
index 5ff7f941e87..d07e174cbf6 100644
--- a/web/app/components/app/access-point/shared/service-api-card-view.tsx
+++ b/web/app/components/app/access-point/shared/service-api-card-view.tsx
@@ -37,7 +37,7 @@ export function ServiceApiCardView({
switchDisabled,
switchLoading = false,
}: ServiceApiCardViewProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['agentV2', 'appOverview', 'deployments'])
const docLink = useDocLink()
const apiReferencePath = appMode ? getAppApiReferencePath(appMode) : undefined
const apiReferenceUrl = apiReferencePath ? docLink(apiReferencePath) : undefined
diff --git a/web/app/components/app/access-point/shared/use-access-point-actions.ts b/web/app/components/app/access-point/shared/use-access-point-actions.ts
index ed08627abb1..44736e8b2a3 100644
--- a/web/app/components/app/access-point/shared/use-access-point-actions.ts
+++ b/web/app/components/app/access-point/shared/use-access-point-actions.ts
@@ -13,7 +13,7 @@ import { consoleQuery } from '@/service/console'
import { asyncRunSafe } from '@/utils'
export function useAccessPointActions(appId: string, canManageAccessPoint: boolean) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const queryClient = useQueryClient()
const setAppDetail = useAppStore((state) => state.setAppDetail)
const refreshAppDetail = useCallback(async () => {
diff --git a/web/app/components/app/access-point/shared/use-access-point-status-label.ts b/web/app/components/app/access-point/shared/use-access-point-status-label.ts
index 52a6b727661..b776962b5fd 100644
--- a/web/app/components/app/access-point/shared/use-access-point-status-label.ts
+++ b/web/app/components/app/access-point/shared/use-access-point-status-label.ts
@@ -4,7 +4,7 @@ import type { AccessPointStatus } from '@/app/components/base/access-point/statu
import { useTranslation } from 'react-i18next'
export function useAccessPointStatusLabel(status: AccessPointStatus) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['agentV2', 'appOverview', 'common', 'deployments'])
const labels: Record<AccessPointStatus, string> = {
disabled: t(($) => $['overview.status.disable'], { ns: 'appOverview' }),
inService: t(($) => $['agentDetail.access.status.inService'], { ns: 'agentV2' }),
diff --git a/web/app/components/app/access-point/shared/web-app-access-control.tsx b/web/app/components/app/access-point/shared/web-app-access-control.tsx
index c17eb11a0a5..31c8392023a 100644
--- a/web/app/components/app/access-point/shared/web-app-access-control.tsx
+++ b/web/app/components/app/access-point/shared/web-app-access-control.tsx
@@ -11,7 +11,7 @@ type WebAppAccessControlEntryProps = {
}
export function WebAppAccessControlEntrySkeleton({ loading }: { loading: boolean }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className="-mt-1 px-4 pb-3">
@@ -39,7 +39,7 @@ export function WebAppAccessControlEntry({
disabled,
onClick,
}: WebAppAccessControlEntryProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
return (
<div className="-mt-1 px-4 pb-3">
diff --git a/web/app/components/app/annotation/add-annotation-modal/edit-item/index.tsx b/web/app/components/app/annotation/add-annotation-modal/edit-item/index.tsx
index 4dc979e3208..d18870af1f5 100644
--- a/web/app/components/app/annotation/add-annotation-modal/edit-item/index.tsx
+++ b/web/app/components/app/annotation/add-annotation-modal/edit-item/index.tsx
@@ -18,7 +18,7 @@ type Props = Readonly<{
}>
const EditItem: FC<Props> = ({ type, content, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation'])
const avatar =
type === EditItemType.Query ? (
<span aria-hidden className="i-custom-public-avatar-user size-6" />
diff --git a/web/app/components/app/annotation/add-annotation-modal/index.tsx b/web/app/components/app/annotation/add-annotation-modal/index.tsx
index 5459b456b81..12837318839 100644
--- a/web/app/components/app/annotation/add-annotation-modal/index.tsx
+++ b/web/app/components/app/annotation/add-annotation-modal/index.tsx
@@ -31,7 +31,7 @@ type Props = Readonly<{
}>
const AddAnnotationModal: FC<Props> = ({ isShow, onHide, onAdd }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation', 'common'])
const deploymentEdition = useAtomValue(deploymentEditionAtom)
const { data: annotationQuota } = useQuery(
consoleQuery.features.get.queryOptions({
diff --git a/web/app/components/app/annotation/batch-action.tsx b/web/app/components/app/annotation/batch-action.tsx
index 0868a22d341..1369789d336 100644
--- a/web/app/components/app/annotation/batch-action.tsx
+++ b/web/app/components/app/annotation/batch-action.tsx
@@ -29,7 +29,7 @@ const BatchAction: FC<IBatchActionProps> = ({
onBatchDelete,
onSelectedIdsChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation', 'common'])
const [isShowDeleteConfirm, { setTrue: showDeleteConfirm, setFalse: hideDeleteConfirm }] =
useBoolean(false)
const [isDeleting, { setTrue: setIsDeleting, setFalse: setIsNotDeleting }] = useBoolean(false)
diff --git a/web/app/components/app/annotation/batch-add-annotation-modal/csv-downloader.tsx b/web/app/components/app/annotation/batch-add-annotation-modal/csv-downloader.tsx
index 4aadfdddb89..26cc0034d33 100644
--- a/web/app/components/app/annotation/batch-add-annotation-modal/csv-downloader.tsx
+++ b/web/app/components/app/annotation/batch-add-annotation-modal/csv-downloader.tsx
@@ -18,7 +18,7 @@ const CSV_TEMPLATE_QA_CN = [
]
const CSVDownload: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation', 'share'])
const locale = useLocale()
const { CSVDownloader, Type } = useCSVDownloader()
diff --git a/web/app/components/app/annotation/batch-add-annotation-modal/csv-uploader.tsx b/web/app/components/app/annotation/batch-add-annotation-modal/csv-uploader.tsx
index 12f5147efad..60fccfba169 100644
--- a/web/app/components/app/annotation/batch-add-annotation-modal/csv-uploader.tsx
+++ b/web/app/components/app/annotation/batch-add-annotation-modal/csv-uploader.tsx
@@ -14,7 +14,7 @@ export type Props = Readonly<{
}>
const CSVUploader: FC<Props> = ({ file, updateFile }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation', 'common', 'datasetCreation'])
const [dragging, setDragging] = useState(false)
const dropRef = useRef<HTMLDivElement>(null)
const dragRef = useRef<HTMLDivElement>(null)
diff --git a/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx b/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx
index cd1dd99c70e..dc6b732ffb8 100644
--- a/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx
+++ b/web/app/components/app/annotation/batch-add-annotation-modal/index.tsx
@@ -33,7 +33,7 @@ export type IBatchModalProps = {
}
const BatchModal: FC<IBatchModalProps> = ({ appId, isShow, onCancel, onAdded }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation', 'common'])
const deploymentEdition = useAtomValue(deploymentEditionAtom)
const { data: annotationQuota } = useQuery(
consoleQuery.features.get.queryOptions({
diff --git a/web/app/components/app/annotation/clear-all-annotations-confirm-modal/index.tsx b/web/app/components/app/annotation/clear-all-annotations-confirm-modal/index.tsx
index 48943656d07..cbf668425be 100644
--- a/web/app/components/app/annotation/clear-all-annotations-confirm-modal/index.tsx
+++ b/web/app/components/app/annotation/clear-all-annotations-confirm-modal/index.tsx
@@ -19,7 +19,7 @@ type Props = Readonly<{
}>
const ClearAllAnnotationsConfirmModal: FC<Props> = ({ isShow, onHide, onConfirm }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation', 'common'])
const title = t(($) => $['table.header.clearAllConfirm'], { ns: 'appAnnotation' })
return (
diff --git a/web/app/components/app/annotation/edit-annotation-modal/edit-item/index.tsx b/web/app/components/app/annotation/edit-annotation-modal/edit-item/index.tsx
index 8c577df0b00..fe4bceb5322 100644
--- a/web/app/components/app/annotation/edit-annotation-modal/edit-item/index.tsx
+++ b/web/app/components/app/annotation/edit-annotation-modal/edit-item/index.tsx
@@ -35,7 +35,7 @@ export const EditTitle: FC<{ className?: string; title: string }> = ({ className
</div>
)
const EditItem: FC<Props> = ({ type, readonly, content, onSave }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation', 'common'])
const [newContent, setNewContent] = useState('')
const showNewContent = newContent && newContent !== content
const avatar =
diff --git a/web/app/components/app/annotation/edit-annotation-modal/index.tsx b/web/app/components/app/annotation/edit-annotation-modal/index.tsx
index 3626d050005..52c351adb86 100644
--- a/web/app/components/app/annotation/edit-annotation-modal/index.tsx
+++ b/web/app/components/app/annotation/edit-annotation-modal/index.tsx
@@ -53,7 +53,7 @@ const EditAnnotationModal: FC<Props> = ({
onRemove,
onlyEditResponse,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation', 'appDebug', 'appLog', 'common'])
const { formatTime } = useTimestamp()
const handleSave = async (type: EditItemType, editedContent: string) => {
let postQuery = query
diff --git a/web/app/components/app/annotation/empty-element.tsx b/web/app/components/app/annotation/empty-element.tsx
index cdf366f04fb..2f01daf1a0b 100644
--- a/web/app/components/app/annotation/empty-element.tsx
+++ b/web/app/components/app/annotation/empty-element.tsx
@@ -25,7 +25,7 @@ const ThreeDotsIcon = ({ className }: SVGProps<SVGElement>) => {
}
const EmptyElement: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation'])
return (
<div className="flex h-full items-center justify-center">
diff --git a/web/app/components/app/annotation/filter.tsx b/web/app/components/app/annotation/filter.tsx
index 0c407695211..7fd53304c52 100644
--- a/web/app/components/app/annotation/filter.tsx
+++ b/web/app/components/app/annotation/filter.tsx
@@ -18,7 +18,7 @@ type IFilterProps = {
const Filter: FC<IFilterProps> = ({ appId, queryParams, setQueryParams, children }) => {
const { data, isLoading } = useAnnotationsCount(appId)
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
if (isLoading || !data) return null
return (
<div className="mb-2 flex flex-row flex-wrap items-center justify-between gap-2">
diff --git a/web/app/components/app/annotation/header-opts/index.tsx b/web/app/components/app/annotation/header-opts/index.tsx
index d725b92c4c7..cc90e1d62f4 100644
--- a/web/app/components/app/annotation/header-opts/index.tsx
+++ b/web/app/components/app/annotation/header-opts/index.tsx
@@ -68,7 +68,7 @@ const OperationsMenu: FC<OperationsMenuProps> = ({
onClearAll,
onExportJsonl,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation'])
const locale = useLocale()
const annotationUnavailable = list.length === 0
@@ -132,7 +132,7 @@ const OperationsMenu: FC<OperationsMenuProps> = ({
}
const HeaderOptions: FC<Props> = ({ appId, onAdd, onAdded, controlUpdateList }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation', 'common'])
const locale = useLocale()
const [list, setList] = useState<AnnotationItemBasic[]>([])
diff --git a/web/app/components/app/annotation/index.tsx b/web/app/components/app/annotation/index.tsx
index 2267f518db8..0573ea7be53 100644
--- a/web/app/components/app/annotation/index.tsx
+++ b/web/app/components/app/annotation/index.tsx
@@ -50,7 +50,7 @@ type Props = Readonly<{
const Annotation: FC<Props> = (props) => {
const { appDetail } = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation', 'common'])
const docLink = useDocLink()
const [isShowEdit, setIsShowEdit] = useState(false)
const [annotationConfig, setAnnotationConfig] = useState<AnnotationReplyConfig | null>(null)
diff --git a/web/app/components/app/annotation/list.tsx b/web/app/components/app/annotation/list.tsx
index a6f44ad16f1..955bf449278 100644
--- a/web/app/components/app/annotation/list.tsx
+++ b/web/app/components/app/annotation/list.tsx
@@ -31,7 +31,7 @@ function AnnotationTableRow({
onView,
onRemoveClick,
}: AnnotationTableRowProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const questionId = React.useId()
return (
@@ -80,7 +80,7 @@ export function List({
onSelectedIdsChange,
onBatchDelete,
}: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation', 'appLog', 'common'])
const { formatTime } = useTimestamp()
const [currId, setCurrId] = React.useState<string | null>(null)
const [showConfirmDelete, setShowConfirmDelete] = React.useState(false)
diff --git a/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx b/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx
index dbaa091659f..6538b40baf5 100644
--- a/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx
+++ b/web/app/components/app/annotation/remove-annotation-confirm-modal/index.tsx
@@ -18,7 +18,7 @@ type Props = Readonly<{
}>
const RemoveAnnotationConfirmModal: FC<Props> = ({ isShow, onHide, onRemove }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const title = t(($) => $['feature.annotation.removeConfirm'], { ns: 'appDebug' })
return (
diff --git a/web/app/components/app/annotation/view-annotation-modal/hit-history-no-data.tsx b/web/app/components/app/annotation/view-annotation-modal/hit-history-no-data.tsx
index 946f556aca0..860e8da3e13 100644
--- a/web/app/components/app/annotation/view-annotation-modal/hit-history-no-data.tsx
+++ b/web/app/components/app/annotation/view-annotation-modal/hit-history-no-data.tsx
@@ -4,7 +4,7 @@ import * as React from 'react'
import { useTranslation } from 'react-i18next'
const HitHistoryNoData: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation'])
return (
<div className="mx-auto mt-20 w-120 space-y-2 rounded-2xl bg-background-section-burn p-5">
<div className="inline-block rounded-lg border border-divider-subtle p-3">
diff --git a/web/app/components/app/annotation/view-annotation-modal/index.tsx b/web/app/components/app/annotation/view-annotation-modal/index.tsx
index 17c9ba5f7e9..091c22fe747 100644
--- a/web/app/components/app/annotation/view-annotation-modal/index.tsx
+++ b/web/app/components/app/annotation/view-annotation-modal/index.tsx
@@ -51,7 +51,7 @@ const ViewAnnotationModal: FC<Props> = ({ appId, isShow, onHide, item, onSave, o
const { id, question, answer, created_at: createdAt } = item
const [newQuestion, setNewQuery] = useState(question)
const [newAnswer, setNewAnswer] = useState(answer)
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation', 'appDebug', 'appLog', 'common'])
const { formatTime } = useTimestamp()
const [currPage, setCurrPage] = React.useState<number>(0)
const [total, setTotal] = useState(0)
diff --git a/web/app/components/app/app-access-control/access-control-dialog.tsx b/web/app/components/app/app-access-control/access-control-dialog.tsx
index 4269d8f8148..27a92ca0e5a 100644
--- a/web/app/components/app/app-access-control/access-control-dialog.tsx
+++ b/web/app/components/app/app-access-control/access-control-dialog.tsx
@@ -13,7 +13,7 @@ type DialogProps = {
}
const AccessControlDialog = ({ className, children, show, onClose }: DialogProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const close = useCallback(() => {
onClose?.()
}, [onClose])
diff --git a/web/app/components/app/app-access-control/access-control-form.tsx b/web/app/components/app/app-access-control/access-control-form.tsx
index 300f3b1fa10..da06d52bbff 100644
--- a/web/app/components/app/app-access-control/access-control-form.tsx
+++ b/web/app/components/app/app-access-control/access-control-form.tsx
@@ -46,7 +46,7 @@ export function AccessControlForm({
const publicAccessLabelId = useId()
const externalAccessLabelId = useId()
const accessControlOptionsLabelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const confirmDisabled =
(accessMode === AccessModeValue.PUBLIC && publicAccessDisabled) ||
(accessMode === AccessModeValue.SPECIFIC_GROUPS_MEMBERS && subjectsStatus !== 'success')
diff --git a/web/app/components/app/app-access-control/add-member-or-group-pop/breadcrumb.tsx b/web/app/components/app/app-access-control/add-member-or-group-pop/breadcrumb.tsx
index 454429003de..cb6f75f6f68 100644
--- a/web/app/components/app/app-access-control/add-member-or-group-pop/breadcrumb.tsx
+++ b/web/app/components/app/app-access-control/add-member-or-group-pop/breadcrumb.tsx
@@ -15,7 +15,7 @@ type SelectedGroupsBreadcrumbProps = {
}
export function SelectedGroupsBreadcrumb({ groups, onChange }: SelectedGroupsBreadcrumbProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const handleBreadcrumbClick = (index: number) => {
onChange(groups.slice(0, index + 1))
diff --git a/web/app/components/app/app-access-control/add-member-or-group-pop/index.tsx b/web/app/components/app/app-access-control/add-member-or-group-pop/index.tsx
index 53c07cc0de3..eb2f3d31657 100644
--- a/web/app/components/app/app-access-control/add-member-or-group-pop/index.tsx
+++ b/web/app/components/app/app-access-control/add-member-or-group-pop/index.tsx
@@ -35,7 +35,7 @@ export default function AddMemberOrGroupDialog({
subjects: selectedAccessSubjects,
onChange,
}: AddMemberOrGroupDialogProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const [open, setOpen] = useState(false)
const [keyword, setKeyword] = useState('')
const [selectedGroupsForBreadcrumb, setSelectedGroupsForBreadcrumb] = useState<
diff --git a/web/app/components/app/app-access-control/add-member-or-group-pop/subject-item.tsx b/web/app/components/app/app-access-control/add-member-or-group-pop/subject-item.tsx
index 0a6380df7a6..a9d90d4385e 100644
--- a/web/app/components/app/app-access-control/add-member-or-group-pop/subject-item.tsx
+++ b/web/app/components/app/app-access-control/add-member-or-group-pop/subject-item.tsx
@@ -55,7 +55,7 @@ function GroupItem({
onToggle: () => void
onExpand: (group: AccessControlGroup) => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
return (
<li className="flex min-w-0 items-center gap-2 rounded-lg hover:bg-state-base-hover">
@@ -102,7 +102,7 @@ function MemberItem({
...userProfileQueryOptions(),
select: (data) => data.profile,
})
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<li>
diff --git a/web/app/components/app/app-access-control/index.tsx b/web/app/components/app/app-access-control/index.tsx
index 92216f70e0b..32fce0fb573 100644
--- a/web/app/components/app/app-access-control/index.tsx
+++ b/web/app/components/app/app-access-control/index.tsx
@@ -32,7 +32,7 @@ export default function AccessControl(props: AccessControlProps) {
}
function AppAccessControlContainer({ app, onClose, onConfirm }: AccessControlProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const [accessMode, setAccessMode] = useState(
() =>
diff --git a/web/app/components/app/app-access-control/specific-groups-or-members.tsx b/web/app/components/app/app-access-control/specific-groups-or-members.tsx
index 6d6287361bd..1e9ce0f67e5 100644
--- a/web/app/components/app/app-access-control/specific-groups-or-members.tsx
+++ b/web/app/components/app/app-access-control/specific-groups-or-members.tsx
@@ -30,7 +30,7 @@ export default function SpecificGroupsOrMembers({
onSubjectsChange,
onRetrySubjects,
}: SpecificGroupsOrMembersProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
if (accessMode !== AccessMode.SPECIFIC_GROUPS_MEMBERS) {
return (
@@ -90,7 +90,7 @@ type RenderGroupsAndMembersProps = {
}
function RenderGroupsAndMembers({ subjects, onChange }: RenderGroupsAndMembersProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const { groups, members } = subjects
if (groups.length <= 0 && members.length <= 0) {
@@ -191,7 +191,7 @@ type BaseItemProps = {
}
function BaseItem({ icon, onRemove, children }: BaseItemProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className="group flex flex-row items-center gap-x-1 rounded-full border-[0.5px] border-components-panel-border-subtle bg-components-badge-white-to-dark p-1 pr-1.5 shadow-xs">
diff --git a/web/app/components/app/app-publisher/__tests__/utils.spec.ts b/web/app/components/app/app-publisher/__tests__/utils.spec.ts
index 1d2b4967449..7dc8e2e209e 100644
--- a/web/app/components/app/app-publisher/__tests__/utils.spec.ts
+++ b/web/app/components/app/app-publisher/__tests__/utils.spec.ts
@@ -28,7 +28,7 @@ describe('app-publisher utils', () => {
})
describe('getDisabledFunctionTooltip', () => {
- const t = withSelectorKey((key: string) => key, 'app') as unknown as TFunction
+ const t = withSelectorKey((key: string) => key, 'app') as unknown as TFunction<['app']>
it('should prioritize the unpublished hint', () => {
expect(
diff --git a/web/app/components/app/app-publisher/built-in-publisher/actions-section.tsx b/web/app/components/app/app-publisher/built-in-publisher/actions-section.tsx
index 3e35ae97865..85e1916abd6 100644
--- a/web/app/components/app/app-publisher/built-in-publisher/actions-section.tsx
+++ b/web/app/components/app/app-publisher/built-in-publisher/actions-section.tsx
@@ -62,7 +62,7 @@ export function PublisherActionsSection({
onConfigureWorkflowTool,
onPublishToMarketplace,
}: PublisherActionsSectionProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const appId = appDetail?.id
const hasPublishedVersion = Boolean(publishedAt)
diff --git a/web/app/components/app/app-publisher/built-in-publisher/summary-section.tsx b/web/app/components/app/app-publisher/built-in-publisher/summary-section.tsx
index 97eb69357c6..34d1faa91e6 100644
--- a/web/app/components/app/app-publisher/built-in-publisher/summary-section.tsx
+++ b/web/app/components/app/app-publisher/built-in-publisher/summary-section.tsx
@@ -59,7 +59,7 @@ export function PublisherSummarySection({
upgradeHighlightStyle,
versionInfo,
}: PublisherSummarySectionProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const hasPublishedVersion = Boolean(publishedAt)
const publishedTimestamp =
publishedAt || (versionInfo?.created_at ? versionInfo.created_at * 1000 : undefined)
diff --git a/web/app/components/app/app-publisher/environment-deployment-flow/actions-section.tsx b/web/app/components/app/app-publisher/environment-deployment-flow/actions-section.tsx
index 5e142a71eda..eb1457ca4a4 100644
--- a/web/app/components/app/app-publisher/environment-deployment-flow/actions-section.tsx
+++ b/web/app/components/app/app-publisher/environment-deployment-flow/actions-section.tsx
@@ -17,7 +17,7 @@ export function PublisherEnvironmentActionsSection({
deployment?: EnvironmentDeployment
environmentId: string
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const actionsDisabled = !appId || !deployment
const accessPointHref = appId ? environmentHref('access-point', appId, environmentId) : undefined
const deployHref = appId ? environmentHref('deploy', appId, environmentId) : undefined
diff --git a/web/app/components/app/app-publisher/environment-deployment-flow/index.tsx b/web/app/components/app/app-publisher/environment-deployment-flow/index.tsx
index 9a0328e297a..e9c6f4aa3a1 100644
--- a/web/app/components/app/app-publisher/environment-deployment-flow/index.tsx
+++ b/web/app/components/app/app-publisher/environment-deployment-flow/index.tsx
@@ -43,7 +43,7 @@ export function PublisherEnvironmentFlow({
onConfigurationOpenChange,
onGoToPublish,
}: PublisherEnvironmentFlowProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['deployments'])
const deploymentPolling = useAtomValue(publisherEnvironmentDeploymentPollingAtom)
const startDeploymentPolling = useSetAtom(startPublisherEnvironmentDeploymentPollingAtom)
diff --git a/web/app/components/app/app-publisher/environment-deployment-flow/latest-version-row.tsx b/web/app/components/app/app-publisher/environment-deployment-flow/latest-version-row.tsx
index cd2e7580353..227272f7fe9 100644
--- a/web/app/components/app/app-publisher/environment-deployment-flow/latest-version-row.tsx
+++ b/web/app/components/app/app-publisher/environment-deployment-flow/latest-version-row.tsx
@@ -17,7 +17,7 @@ export function PublisherLatestVersionRow({
latestVersion?: DeploymentVersion | null
onShowAllVersions: () => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['deployments'])
return (
<div className="flex items-center gap-1 py-0.5 pr-0.5 pl-1">
diff --git a/web/app/components/app/app-publisher/environment-deployment-flow/summary-section.tsx b/web/app/components/app/app-publisher/environment-deployment-flow/summary-section.tsx
index c5ce3aa5aad..6d0cd98a61d 100644
--- a/web/app/components/app/app-publisher/environment-deployment-flow/summary-section.tsx
+++ b/web/app/components/app/app-publisher/environment-deployment-flow/summary-section.tsx
@@ -34,7 +34,7 @@ export function PublisherEnvironmentSummarySection({
onGoToPublish: () => void
onShowAllVersions: () => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['deployments', 'workflow'])
const { formatTimeFromNow } = useFormatTimeFromNow()
const deploymentState = deployment?.deployment
const deployedVersion = deploymentState?.current_version
diff --git a/web/app/components/app/app-publisher/environment-tabs/index.tsx b/web/app/components/app/app-publisher/environment-tabs/index.tsx
index ca9ef20e7d0..d24de41f2ac 100644
--- a/web/app/components/app/app-publisher/environment-tabs/index.tsx
+++ b/web/app/components/app/app-publisher/environment-tabs/index.tsx
@@ -32,7 +32,7 @@ export function PublisherEnvironmentTabs({
onAddEnvironment,
onSelectEnvironment,
}: PublisherEnvironmentTabsProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'deployments', 'workflow'])
const builtInLabel = t(($) => $['nodes.common.memories.builtIn'], { ns: 'workflow' })
const moreLabel = t(($) => $['operation.more'], { ns: 'common' })
const moreEnvironmentsLabel = t(($) => $['studio.moreEnvironments'], {
diff --git a/web/app/components/app/app-publisher/features-wrapper.tsx b/web/app/components/app/app-publisher/features-wrapper.tsx
index ffb85da6b44..94826743fe1 100644
--- a/web/app/components/app/app-publisher/features-wrapper.tsx
+++ b/web/app/components/app/app-publisher/features-wrapper.tsx
@@ -34,7 +34,7 @@ type Props = Omit<AppPublisherProps, 'onPublish'> & {
}
const FeaturesWrappedAppPublisher = (props: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const features = useFeatures((s) => s.features)
const featuresStore = useFeaturesStore()
const [restoreConfirmOpen, setRestoreConfirmOpen] = useState(false)
diff --git a/web/app/components/app/app-publisher/publish-with-multiple-model.tsx b/web/app/components/app/app-publisher/publish-with-multiple-model.tsx
index 3f94f9ab8a8..3386fe7add3 100644
--- a/web/app/components/app/app-publisher/publish-with-multiple-model.tsx
+++ b/web/app/components/app/app-publisher/publish-with-multiple-model.tsx
@@ -30,7 +30,7 @@ const PublishWithMultipleModel: FC<PublishWithMultipleModelProps> = ({
multipleModelConfigs,
onSelect,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const language = useLanguage()
const { data: textGenerationModelList = [] } = useQuery(
consoleQuery.workspaces.current.models.modelTypes.byModelType.get.queryOptions({
diff --git a/web/app/components/app/app-publisher/publisher-content/index.tsx b/web/app/components/app/app-publisher/publisher-content/index.tsx
index 82641a214cc..5d6fc6bff71 100644
--- a/web/app/components/app/app-publisher/publisher-content/index.tsx
+++ b/web/app/components/app/app-publisher/publisher-content/index.tsx
@@ -64,7 +64,7 @@ export function PublisherContent({
toolPublished,
workflowToolAvailable = true,
}: PublisherContentProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'workflow'])
const appDetail = useAppStore((state) => state.appDetail)
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const { formatTimeFromNow } = useFormatTimeFromNow()
diff --git a/web/app/components/app/app-publisher/publisher-content/publisher-panel/index.tsx b/web/app/components/app/app-publisher/publisher-content/publisher-panel/index.tsx
index 98e199a1dc7..07cef773d02 100644
--- a/web/app/components/app/app-publisher/publisher-content/publisher-panel/index.tsx
+++ b/web/app/components/app/app-publisher/publisher-content/publisher-panel/index.tsx
@@ -33,7 +33,7 @@ export function PublisherPanel({
showBuiltInPublisher,
workflowLaunch,
}: PublisherPanelProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [deploymentConfigurationOpen, setDeploymentConfigurationOpen] = useState(false)
const handleOpenChange: NonNullable<PopoverProps['onOpenChange']> = (nextOpen, eventDetails) => {
const isOutsideDismiss =
diff --git a/web/app/components/app/app-publisher/publisher-content/use-marketplace-publish.ts b/web/app/components/app/app-publisher/publisher-content/use-marketplace-publish.ts
index 2ccdd0c4424..0d09f969ae1 100644
--- a/web/app/components/app/app-publisher/publisher-content/use-marketplace-publish.ts
+++ b/web/app/components/app/app-publisher/publisher-content/use-marketplace-publish.ts
@@ -4,7 +4,7 @@ import { toast } from '@/app/notifications'
import { publishToCreatorsPlatform } from '@/service/apps'
export function useMarketplacePublish(appId?: string) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [isPublishing, setIsPublishing] = useState(false)
async function publish() {
diff --git a/web/app/components/app/app-publisher/publisher-content/use-version-info.ts b/web/app/components/app/app-publisher/publisher-content/use-version-info.ts
index 6e722b96ea0..03689bf20ce 100644
--- a/web/app/components/app/app-publisher/publisher-content/use-version-info.ts
+++ b/web/app/components/app/app-publisher/publisher-content/use-version-info.ts
@@ -22,7 +22,7 @@ export function useVersionInfo({
publishedWorkflow?: WorkflowResponse | null
onClosePublisher: () => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [isOpen, setIsOpen] = useState(false)
const { mutate: updateWorkflow } = useUpdateWorkflow()
const invalidateAppWorkflow = useInvalidateAppWorkflow()
diff --git a/web/app/components/app/app-publisher/publisher-content/use-workflow-tool.ts b/web/app/components/app/app-publisher/publisher-content/use-workflow-tool.ts
index 01609e2ef8a..23279aebc79 100644
--- a/web/app/components/app/app-publisher/publisher-content/use-workflow-tool.ts
+++ b/web/app/components/app/app-publisher/publisher-content/use-workflow-tool.ts
@@ -49,7 +49,7 @@ export function useWorkflowTool({
toolPublished,
workflowToolAvailable,
}: UseWorkflowToolParams) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [drawerOpen, setDrawerOpen] = useState(false)
const canManageTools = useCanManageTools()
const visible = appMode === AppModeEnum.WORKFLOW && !hasHumanInputNode && !hasTriggerNode
diff --git a/web/app/components/app/app-publisher/utils.ts b/web/app/components/app/app-publisher/utils.ts
index a7edb07da86..2ddfe5ee4af 100644
--- a/web/app/components/app/app-publisher/utils.ts
+++ b/web/app/components/app/app-publisher/utils.ts
@@ -24,7 +24,7 @@ export const getDisabledFunctionTooltip = ({
missingStartNode,
noAccessPermission,
}: {
- t: TFunction
+ t: TFunction<['app']>
publishedAt?: number
missingStartNode: boolean
noAccessPermission: boolean
diff --git a/web/app/components/app/app-publisher/version-info-modal.tsx b/web/app/components/app/app-publisher/version-info-modal.tsx
index c28855da843..b18007894fb 100644
--- a/web/app/components/app/app-publisher/version-info-modal.tsx
+++ b/web/app/components/app/app-publisher/version-info-modal.tsx
@@ -25,7 +25,7 @@ const VersionInfoModal: FC<VersionInfoModalProps> = ({
onClose,
onPublish,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const [title, setTitle] = useState(versionInfo?.marked_name || '')
const [releaseNotes, setReleaseNotes] = useState(versionInfo?.marked_comment || '')
const [titleError, setTitleError] = useState(false)
diff --git a/web/app/components/app/app-publisher/workflow-tool-action/index.tsx b/web/app/components/app/app-publisher/workflow-tool-action/index.tsx
index bf9cc3fe444..a804a4b3b21 100644
--- a/web/app/components/app/app-publisher/workflow-tool-action/index.tsx
+++ b/web/app/components/app/app-publisher/workflow-tool-action/index.tsx
@@ -26,7 +26,7 @@ const WorkflowToolAction = ({
published,
onConfigure,
}: WorkflowToolActionProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appApi', 'workflow'])
const disabledReason = disabled ? message : undefined
const workflowToolLabel = t(($) => $['common.workflowAsTool'], { ns: 'workflow' })
diff --git a/web/app/components/app/configuration/base/operation-button/index.tsx b/web/app/components/app/configuration/base/operation-button/index.tsx
index bb65f0213f0..384a9495cc1 100644
--- a/web/app/components/app/configuration/base/operation-button/index.tsx
+++ b/web/app/components/app/configuration/base/operation-button/index.tsx
@@ -15,7 +15,7 @@ export function OperationButton({
className,
...buttonProps
}: OperationButtonProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<Button
{...buttonProps}
diff --git a/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.tsx b/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.tsx
index f829bf1f54b..f0d8453f0e3 100644
--- a/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.tsx
+++ b/web/app/components/app/configuration/base/warning-mask/cannot-query-dataset.tsx
@@ -10,7 +10,7 @@ type IFormattingChangedProps = {
}
const FormattingChanged: FC<IFormattingChangedProps> = ({ onConfirm }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
return (
<WarningMask
diff --git a/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx b/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx
index b9d57ddbbc5..476e7039687 100644
--- a/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx
+++ b/web/app/components/app/configuration/base/warning-mask/formatting-changed.tsx
@@ -23,7 +23,7 @@ const icon = (
)
const FormattingChanged: FC<IFormattingChangedProps> = ({ onConfirm, onCancel }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
return (
<WarningMask
diff --git a/web/app/components/app/configuration/base/warning-mask/has-not-set-api.tsx b/web/app/components/app/configuration/base/warning-mask/has-not-set-api.tsx
index 0cbc6abea55..6d9b5c0a272 100644
--- a/web/app/components/app/configuration/base/warning-mask/has-not-set-api.tsx
+++ b/web/app/components/app/configuration/base/warning-mask/has-not-set-api.tsx
@@ -8,7 +8,7 @@ type IHasNotSetAPIProps = {
}
const HasNotSetAPI: FC<IHasNotSetAPIProps> = ({ onSetting }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
return (
<div className="flex grow flex-col items-center justify-center pb-30">
diff --git a/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx
index ca474fc074d..7c58a16e42c 100644
--- a/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx
+++ b/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx
@@ -56,7 +56,7 @@ const AdvancedPromptInput: FC<Props> = ({
}) => {
const promptLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const { eventEmitter } = useEventEmitterContextContext()
const {
diff --git a/web/app/components/app/configuration/config-prompt/confirm-add-var/index.tsx b/web/app/components/app/configuration/config-prompt/confirm-add-var/index.tsx
index a65782e8343..d50cced9b14 100644
--- a/web/app/components/app/configuration/config-prompt/confirm-add-var/index.tsx
+++ b/web/app/components/app/configuration/config-prompt/confirm-add-var/index.tsx
@@ -36,7 +36,7 @@ const ConfirmAddVar: FC<IConfirmAddVarProps> = ({
onCancel,
// onHide,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const mainContentRef = useRef<HTMLDivElement>(null)
// new prompt editor blur trigger click...
// useClickAway(() => {
diff --git a/web/app/components/app/configuration/config-prompt/conversation-history/edit-modal.tsx b/web/app/components/app/configuration/config-prompt/conversation-history/edit-modal.tsx
index 2a82242c7a0..e565433e5fa 100644
--- a/web/app/components/app/configuration/config-prompt/conversation-history/edit-modal.tsx
+++ b/web/app/components/app/configuration/config-prompt/conversation-history/edit-modal.tsx
@@ -16,7 +16,7 @@ type Props = Readonly<{
}>
const EditModal: FC<Props> = ({ isShow, saveLoading, data, onClose, onSave }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const [tempData, setTempData] = useState(data)
return (
<Dialog
diff --git a/web/app/components/app/configuration/config-prompt/conversation-history/history-panel.tsx b/web/app/components/app/configuration/config-prompt/conversation-history/history-panel.tsx
index 82f19a6c223..66ac7538e39 100644
--- a/web/app/components/app/configuration/config-prompt/conversation-history/history-panel.tsx
+++ b/web/app/components/app/configuration/config-prompt/conversation-history/history-panel.tsx
@@ -11,7 +11,7 @@ type Props = Readonly<{
}>
const HistoryPanel: FC<Props> = ({ showWarning, onShowEditModal }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
return (
<Panel
className="mt-2"
diff --git a/web/app/components/app/configuration/config-prompt/index.tsx b/web/app/components/app/configuration/config-prompt/index.tsx
index ee90e0721e5..0841a650e0a 100644
--- a/web/app/components/app/configuration/config-prompt/index.tsx
+++ b/web/app/components/app/configuration/config-prompt/index.tsx
@@ -38,7 +38,7 @@ const Prompt: FC<IPromptProps> = ({
noResize,
onChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const {
isAdvancedMode,
diff --git a/web/app/components/app/configuration/config-prompt/prompt-editor-height-resize-wrap.tsx b/web/app/components/app/configuration/config-prompt/prompt-editor-height-resize-wrap.tsx
index 3ff5dac18c2..77eb1cc8835 100644
--- a/web/app/components/app/configuration/config-prompt/prompt-editor-height-resize-wrap.tsx
+++ b/web/app/components/app/configuration/config-prompt/prompt-editor-height-resize-wrap.tsx
@@ -27,7 +27,7 @@ const PromptEditorHeightResizeWrap: FC<Props> = ({
footer,
hideResize,
}) => {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const editorId = useId()
const resizeDescriptionId = useId()
const didDragRef = useRef(false)
diff --git a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx
index 1c21cdd57b7..8b32425ef1a 100644
--- a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx
+++ b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx
@@ -51,7 +51,7 @@ const Prompt: FC<ISimplePromptInput> = ({
editorHeight: initEditorHeight,
noResize,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const titleId = useId()
const title =
mode !== AppModeEnum.COMPLETION
diff --git a/web/app/components/app/configuration/config-var/config-modal/field.tsx b/web/app/components/app/configuration/config-var/config-modal/field.tsx
index d0b072a5fa3..9246a005aa5 100644
--- a/web/app/components/app/configuration/config-var/config-modal/field.tsx
+++ b/web/app/components/app/configuration/config-var/config-modal/field.tsx
@@ -25,7 +25,7 @@ const Field: FC<Props> = ({
errorId,
children,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const Label = htmlFor ? 'label' : 'div'
return (
<div className={cn(className)}>
diff --git a/web/app/components/app/configuration/config-var/config-modal/index.tsx b/web/app/components/app/configuration/config-var/config-modal/index.tsx
index 5bd67170dca..c1c7c32dd45 100644
--- a/web/app/components/app/configuration/config-var/config-modal/index.tsx
+++ b/web/app/components/app/configuration/config-var/config-modal/index.tsx
@@ -54,7 +54,7 @@ const ConfigModal: FC<IConfigModalProps> = ({
supportFile,
}) => {
const { modelConfig } = useContext(ConfigContext)
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'workflow'])
const [tempPayload, setTempPayload] = useState<InputVar>(() =>
normalizeSelectDefaultValue(payload || (getNewVarInWorkflow('') as any)),
)
diff --git a/web/app/components/app/configuration/config-var/config-select/index.tsx b/web/app/components/app/configuration/config-var/config-select/index.tsx
index 64495b826e3..dfe8b3985b8 100644
--- a/web/app/components/app/configuration/config-var/config-select/index.tsx
+++ b/web/app/components/app/configuration/config-var/config-select/index.tsx
@@ -19,7 +19,7 @@ type IConfigSelectProps = {
}
const ConfigSelect: FC<IConfigSelectProps> = ({ options, onChange, errorMessage, errorId }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const [focusID, setFocusID] = useState<number | null>(null)
const [deletingID, setDeletingID] = useState<number | null>(null)
diff --git a/web/app/components/app/configuration/config-var/index.tsx b/web/app/components/app/configuration/config-var/index.tsx
index 80128730acb..e3be2a3e1f4 100644
--- a/web/app/components/app/configuration/config-var/index.tsx
+++ b/web/app/components/app/configuration/config-var/index.tsx
@@ -96,7 +96,7 @@ export type IConfigVarProps = {
const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVariablesChange }) => {
const titleId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const { mode, dataSets } = useContext(ConfigContext)
const { eventEmitter } = useEventEmitterContextContext()
diff --git a/web/app/components/app/configuration/config-var/modal-foot.tsx b/web/app/components/app/configuration/config-var/modal-foot.tsx
index 0732d4c921d..8fb4cad0ee5 100644
--- a/web/app/components/app/configuration/config-var/modal-foot.tsx
+++ b/web/app/components/app/configuration/config-var/modal-foot.tsx
@@ -11,7 +11,7 @@ type IModalFootProps = {
}
const ModalFoot: FC<IModalFootProps> = ({ onConfirm, onCancel, confirmType = 'button' }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className="flex justify-end gap-2">
<Button type="button" onClick={onCancel}>
diff --git a/web/app/components/app/configuration/config-var/select-var-type.tsx b/web/app/components/app/configuration/config-var/select-var-type.tsx
index dbf11f188ee..46d0c462e86 100644
--- a/web/app/components/app/configuration/config-var/select-var-type.tsx
+++ b/web/app/components/app/configuration/config-var/select-var-type.tsx
@@ -44,7 +44,7 @@ const SelectItem: FC<ItemProps> = ({ text, type, value, iconClassName, onClick }
}
const SelectVarType: FC<Props> = ({ onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const handleChange = (value: string) => {
onChange(value)
}
diff --git a/web/app/components/app/configuration/config-var/var-item.tsx b/web/app/components/app/configuration/config-var/var-item.tsx
index 9f306fc837a..e9d54159e3d 100644
--- a/web/app/components/app/configuration/config-var/var-item.tsx
+++ b/web/app/components/app/configuration/config-var/var-item.tsx
@@ -36,7 +36,7 @@ const VarItem: FC<ItemProps> = ({
canDrag,
dragHandleProps,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [isDeleting, setIsDeleting] = useState(false)
return (
diff --git a/web/app/components/app/configuration/config-vision/index.tsx b/web/app/components/app/configuration/config-vision/index.tsx
index 97252c4fb74..1cef5566f82 100644
--- a/web/app/components/app/configuration/config-vision/index.tsx
+++ b/web/app/components/app/configuration/config-vision/index.tsx
@@ -21,7 +21,7 @@ import ParamConfig from './param-config'
const ConfigVision: FC = () => {
const resolutionLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const titleId = useId()
const { isShowVisionConfig, isAllowVideoUpload, readonly } = useContext(ConfigContext)
const file = useFeatures((s) => s.features.file)
diff --git a/web/app/components/app/configuration/config-vision/param-config-content.tsx b/web/app/components/app/configuration/config-vision/param-config-content.tsx
index aac797b0b8b..2eedb00c650 100644
--- a/web/app/components/app/configuration/config-vision/param-config-content.tsx
+++ b/web/app/components/app/configuration/config-vision/param-config-content.tsx
@@ -20,7 +20,7 @@ const optionClassName =
const ParamConfigContent: FC = () => {
const resolutionLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const file = useFeatures((s) => s.features.file)
const featuresStore = useFeaturesStore()
diff --git a/web/app/components/app/configuration/config-vision/param-config.tsx b/web/app/components/app/configuration/config-vision/param-config.tsx
index 215d1c48e67..e028ca00c96 100644
--- a/web/app/components/app/configuration/config-vision/param-config.tsx
+++ b/web/app/components/app/configuration/config-vision/param-config.tsx
@@ -8,7 +8,7 @@ import { useTranslation } from 'react-i18next'
import ParamConfigContent from './param-config-content'
const ParamsConfig: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
return (
<Popover>
diff --git a/web/app/components/app/configuration/config/agent-setting-button.tsx b/web/app/components/app/configuration/config/agent-setting-button.tsx
index 8f020d6ef20..bf39e6e95de 100644
--- a/web/app/components/app/configuration/config/agent-setting-button.tsx
+++ b/web/app/components/app/configuration/config/agent-setting-button.tsx
@@ -22,7 +22,7 @@ const AgentSettingButton: FC<Props> = ({
agentConfig,
disabled = false,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const [isShowAgentSetting, setIsShowAgentSetting] = useState(false)
return (
diff --git a/web/app/components/app/configuration/config/agent/agent-setting/index.tsx b/web/app/components/app/configuration/config/agent/agent-setting/index.tsx
index 5622df14a91..a0f5f0463a0 100644
--- a/web/app/components/app/configuration/config/agent/agent-setting/index.tsx
+++ b/web/app/components/app/configuration/config/agent/agent-setting/index.tsx
@@ -28,7 +28,7 @@ type Props = Readonly<{
const maxIterationsMin = 1
export function AgentSetting({ isChatModel, payload, isFunctionCall, onCancel, onSave }: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'tools'])
const [tempPayload, setTempPayload] = useState(payload)
const maximumIterationsLabel = t(($) => $['agent.setting.maximumIterations.name'], {
ns: 'appDebug',
diff --git a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx
index 5873bb48ebb..389cb150cea 100644
--- a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx
+++ b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx
@@ -45,7 +45,7 @@ const AgentTools: FC = () => {
const toolNameLabelId = React.useId()
const toolsLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'tools'])
const [isShowChooseTool, setIsShowChooseTool] = useState(false)
const { readonly, modelConfig, setModelConfig } = useContext(ConfigContext)
const { data: buildInTools } = useAllBuiltInTools()
diff --git a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx
index cd4546c8cbd..8334ca4dbe0 100644
--- a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx
+++ b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx
@@ -68,7 +68,7 @@ const SettingBuiltInTool: FC<Props> = ({
}) => {
const locale = useLocale()
const language = getPluginLanguage(locale)
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin', 'tools'])
const passedTools = (collection as ToolWithProvider).tools
const hasPassedTools = passedTools?.length > 0
const [isLoading, setIsLoading] = useState(!hasPassedTools)
diff --git a/web/app/components/app/configuration/config/automatic/automatic-btn.tsx b/web/app/components/app/configuration/config/automatic/automatic-btn.tsx
index 39b9cf2bcff..4b2c9f8a1ee 100644
--- a/web/app/components/app/configuration/config/automatic/automatic-btn.tsx
+++ b/web/app/components/app/configuration/config/automatic/automatic-btn.tsx
@@ -9,7 +9,7 @@ type IAutomaticBtnProps = {
onClick: () => void
}
const AutomaticBtn: FC<IAutomaticBtnProps> = ({ onClick }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
return (
<Button variant="secondary-accent" size="small" onClick={onClick}>
diff --git a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx
index 2f2eb685346..e79cc8accfb 100644
--- a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx
+++ b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx
@@ -79,7 +79,7 @@ const GetAutomaticRes: FC<IGetAutomaticResProps> = ({
isBasicMode,
onFinished,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const instructionLabelId = useId()
const [storedModel, setStoredModel] = useAutoGenModel()
const [selectedModel, setSelectedModel] = React.useState<Model>()
diff --git a/web/app/components/app/configuration/config/automatic/idea-output.tsx b/web/app/components/app/configuration/config/automatic/idea-output.tsx
index db3759a91dc..29826a159c0 100644
--- a/web/app/components/app/configuration/config/automatic/idea-output.tsx
+++ b/web/app/components/app/configuration/config/automatic/idea-output.tsx
@@ -13,7 +13,7 @@ type Props = Readonly<{
}>
const IdeaOutput: FC<Props> = ({ value, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
return (
<Collapsible className="mt-4 text-[0px]">
diff --git a/web/app/components/app/configuration/config/automatic/instruction-editor.tsx b/web/app/components/app/configuration/config/automatic/instruction-editor.tsx
index cc19014c0d6..dbf3e96457d 100644
--- a/web/app/components/app/configuration/config/automatic/instruction-editor.tsx
+++ b/web/app/components/app/configuration/config/automatic/instruction-editor.tsx
@@ -39,7 +39,7 @@ const InstructionEditor: FC<Props> = ({
isShowCurrentBlock,
isShowLastRunBlock,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'workflow'])
const { eventEmitter } = useEventEmitterContextContext()
const isCode = generatorType === 'code'
diff --git a/web/app/components/app/configuration/config/automatic/prompt-res-in-workflow.tsx b/web/app/components/app/configuration/config/automatic/prompt-res-in-workflow.tsx
index a35a3b378e1..8ecc9f9912c 100644
--- a/web/app/components/app/configuration/config/automatic/prompt-res-in-workflow.tsx
+++ b/web/app/components/app/configuration/config/automatic/prompt-res-in-workflow.tsx
@@ -13,7 +13,7 @@ type Props = Readonly<{
}>
const PromptResInWorkflow: FC<Props> = ({ value, nodeId }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { availableVars, availableNodes } = useAvailableVarList(nodeId, {
onlyLeafNodeVar: false,
filterVar: (_payload) => true,
diff --git a/web/app/components/app/configuration/config/automatic/prompt-toast.tsx b/web/app/components/app/configuration/config/automatic/prompt-toast.tsx
index 3110e5cb999..c5e61b30c25 100644
--- a/web/app/components/app/configuration/config/automatic/prompt-toast.tsx
+++ b/web/app/components/app/configuration/config/automatic/prompt-toast.tsx
@@ -11,7 +11,7 @@ type Props = Readonly<{
className?: string
}>
const PromptToast = ({ message, className }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const [isFold, { toggle: toggleFold }] = useBoolean(false)
// const message = `
// list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1list1
diff --git a/web/app/components/app/configuration/config/automatic/res-placeholder.tsx b/web/app/components/app/configuration/config/automatic/res-placeholder.tsx
index 2212a5866fe..fa1d7b265f4 100644
--- a/web/app/components/app/configuration/config/automatic/res-placeholder.tsx
+++ b/web/app/components/app/configuration/config/automatic/res-placeholder.tsx
@@ -4,7 +4,7 @@ import * as React from 'react'
import { useTranslation } from 'react-i18next'
const ResPlaceholder: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
return (
<div className="flex min-w-0 flex-col items-center justify-center space-y-3 px-8 xl:h-full xl:flex-1">
<span aria-hidden className="i-custom-vender-other-generator size-8 text-text-quaternary" />
diff --git a/web/app/components/app/configuration/config/automatic/result.tsx b/web/app/components/app/configuration/config/automatic/result.tsx
index f62c51584e4..17eedcfa7af 100644
--- a/web/app/components/app/configuration/config/automatic/result.tsx
+++ b/web/app/components/app/configuration/config/automatic/result.tsx
@@ -35,7 +35,7 @@ const Result: FC<Props> = ({
onApply,
generatorType,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const isGeneratorPrompt = generatorType === GeneratorType.prompt
return (
diff --git a/web/app/components/app/configuration/config/automatic/version-selector.tsx b/web/app/components/app/configuration/config/automatic/version-selector.tsx
index 05661703bbd..9bfb295a428 100644
--- a/web/app/components/app/configuration/config/automatic/version-selector.tsx
+++ b/web/app/components/app/configuration/config/automatic/version-selector.tsx
@@ -16,7 +16,7 @@ type VersionSelectorProps = {
}
const VersionSelector: React.FC<VersionSelectorProps> = ({ versionLen, value, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const moreThanOneVersion = versionLen > 1
const versions = Array.from({ length: versionLen }, (_, index) => ({
label: `${t(($) => $['generate.version'], { ns: 'appDebug' })} ${index + 1}${index === versionLen - 1 ? ` · ${t(($) => $['generate.latest'], { ns: 'appDebug' })}` : ''}`,
diff --git a/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx b/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx
index 06d905d85fd..9f30bc59e19 100644
--- a/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx
+++ b/web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx
@@ -68,7 +68,7 @@ export const GetCodeGeneratorResModal: FC<IGetCodeGeneratorResProps> = ({
onClose,
onFinished,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const [storedModel, setStoredModel] = useAutoGenModel()
const [selectedModel, setSelectedModel] = React.useState<Model>()
const { defaultModel } = useModelListAndDefaultModelAndCurrentProviderAndModel(
diff --git a/web/app/components/app/configuration/config/config-audio.tsx b/web/app/components/app/configuration/config/config-audio.tsx
index 45930d20e73..6b7e596d8cf 100644
--- a/web/app/components/app/configuration/config/config-audio.tsx
+++ b/web/app/components/app/configuration/config/config-audio.tsx
@@ -14,7 +14,7 @@ import ConfigContext from '@/context/debug-configuration'
const ConfigAudio: FC = () => {
const titleId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const file = useFeatures((s) => s.features.file)
const featuresStore = useFeaturesStore()
const { isShowAudioConfig, readonly } = useContext(ConfigContext)
diff --git a/web/app/components/app/configuration/config/config-document.tsx b/web/app/components/app/configuration/config/config-document.tsx
index 5de58ed13b1..d20ea7257d8 100644
--- a/web/app/components/app/configuration/config/config-document.tsx
+++ b/web/app/components/app/configuration/config/config-document.tsx
@@ -14,7 +14,7 @@ import ConfigContext from '@/context/debug-configuration'
const ConfigDocument: FC = () => {
const titleId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const file = useFeatures((s) => s.features.file)
const featuresStore = useFeaturesStore()
const { isShowDocumentConfig, readonly } = useContext(ConfigContext)
diff --git a/web/app/components/app/configuration/configuration-view/index.tsx b/web/app/components/app/configuration/configuration-view/index.tsx
index 525917fd82f..14d70b9086a 100644
--- a/web/app/components/app/configuration/configuration-view/index.tsx
+++ b/web/app/components/app/configuration/configuration-view/index.tsx
@@ -77,7 +77,7 @@ const ConfigurationView: FC<ConfigurationViewModel> = ({
showUseGPT4Confirm,
setShowUseGPT4Confirm,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const debugWithMultipleModel = appPublisherProps.debugWithMultipleModel
const showLegacyAgentBadge = isAgentV2Enabled() && contextValue.mode === AppModeEnum.AGENT_CHAT
const handlePluginInstallComplete: InstallBundleCompleteCallback = (plugins, installStatus) => {
diff --git a/web/app/components/app/configuration/configuration-view/legacy-agent-badge.tsx b/web/app/components/app/configuration/configuration-view/legacy-agent-badge.tsx
index c68ef7c55bc..7253db00da0 100644
--- a/web/app/components/app/configuration/configuration-view/legacy-agent-badge.tsx
+++ b/web/app/components/app/configuration/configuration-view/legacy-agent-badge.tsx
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'
import Link from '@/next/link'
export function LegacyAgentBadge() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const description = t(($) => $['legacyAgentBadge.description'], { ns: 'appDebug' })
return (
diff --git a/web/app/components/app/configuration/dataset-config/card-item/index.tsx b/web/app/components/app/configuration/dataset-config/card-item/index.tsx
index 7b88aca6f5a..08778adc17e 100644
--- a/web/app/components/app/configuration/dataset-config/card-item/index.tsx
+++ b/web/app/components/app/configuration/dataset-config/card-item/index.tsx
@@ -34,7 +34,7 @@ const Item: FC<ItemProps> = ({ config, onSave, onRemove, readonly = false, edita
const isMobile = media === MediaType.mobile
const [showSettingsModal, setShowSettingsModal] = useState(false)
const { formatIndexingTechniqueAndMethod } = useKnowledge()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const handleSave = (newDataset: DataSet) => {
onSave(newDataset)
diff --git a/web/app/components/app/configuration/dataset-config/context-var/index.tsx b/web/app/components/app/configuration/dataset-config/context-var/index.tsx
index bf7ef00b25e..cf0fe9ab9ae 100644
--- a/web/app/components/app/configuration/dataset-config/context-var/index.tsx
+++ b/web/app/components/app/configuration/dataset-config/context-var/index.tsx
@@ -10,7 +10,7 @@ import VarPicker from './var-picker'
const ContextVar: FC<Props> = (props) => {
const titleId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const { value, options } = props
const currItem = options.find((item) => item.value === value)
const notSetVar = !currItem
diff --git a/web/app/components/app/configuration/dataset-config/context-var/var-picker.tsx b/web/app/components/app/configuration/dataset-config/context-var/var-picker.tsx
index 655e4399c0b..f508da842ad 100644
--- a/web/app/components/app/configuration/dataset-config/context-var/var-picker.tsx
+++ b/web/app/components/app/configuration/dataset-config/context-var/var-picker.tsx
@@ -38,7 +38,7 @@ const VarPicker: FC<Props> = ({
onChange,
notSelectedVarTip,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const [open, setOpen] = useState(false)
const currItem = options.find((item) => item.value === value)
const notSetVar = !currItem
diff --git a/web/app/components/app/configuration/dataset-config/index.tsx b/web/app/components/app/configuration/dataset-config/index.tsx
index a23dfd32e4e..679f6750143 100644
--- a/web/app/components/app/configuration/dataset-config/index.tsx
+++ b/web/app/components/app/configuration/dataset-config/index.tsx
@@ -48,7 +48,7 @@ type Props = Readonly<{
hideMetadataFilter?: boolean
}>
const DatasetConfig: FC<Props> = ({ readonly, hideMetadataFilter }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const { data: currentUserId } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.id,
diff --git a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx
index f7456840a1a..c1ec814e987 100644
--- a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx
+++ b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx
@@ -52,7 +52,7 @@ const ConfigContent: FC<Props> = ({
const rerankLabelId = useId()
const rerankOptionLabelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset', 'workflow'])
const selectedDatasetsMode = useSelectedDatasetsMode(selectedDatasets)
const type = datasetConfigs.retrieval_model
diff --git a/web/app/components/app/configuration/dataset-config/params-config/index.tsx b/web/app/components/app/configuration/dataset-config/params-config/index.tsx
index a3925882186..6055d389978 100644
--- a/web/app/components/app/configuration/dataset-config/params-config/index.tsx
+++ b/web/app/components/app/configuration/dataset-config/params-config/index.tsx
@@ -25,7 +25,7 @@ type ParamsConfigProps = {
selectedDatasets: DataSet[]
}
const ParamsConfig = ({ disabled, selectedDatasets }: ParamsConfigProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'dataset'])
const { datasetConfigs, setDatasetConfigs, rerankSettingModalOpen, setRerankSettingModalOpen } =
useContext(ConfigContext)
const [tempDataSetConfigs, setTempDataSetConfigs] = useState(datasetConfigs)
diff --git a/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx b/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx
index 47ffbffe8b7..762f9f9d75d 100644
--- a/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx
+++ b/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx
@@ -27,7 +27,7 @@ type WeightedScoreProps = {
readonly?: boolean
}
const WeightedScore = ({ value, onChange = noop, readonly = false }: WeightedScoreProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const semanticLabel = t(($) => $['weightedScore.semantic'], { ns: 'dataset' })
const keywordLabel = t(($) => $['weightedScore.keyword'], { ns: 'dataset' })
const semanticWeight = value.value[0]!
diff --git a/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx b/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx
index 48e7a67e705..1c4446670b0 100644
--- a/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx
+++ b/web/app/components/app/configuration/dataset-config/select-dataset/index.tsx
@@ -36,7 +36,7 @@ const SelectDataSet: FC<ISelectDataSetProps> = ({
selectedIds,
onSelect,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'dataset'])
const [selectedIdsInModal, setSelectedIdsInModal] = useState(() => selectedIds)
const canSelectMulti = true
const { formatIndexingTechniqueAndMethod } = useKnowledge()
diff --git a/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx b/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx
index 8a6efa298b3..be73d57d64c 100644
--- a/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx
+++ b/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx
@@ -68,7 +68,7 @@ const SettingsModal: FC<SettingsModalProps> = ({
select: (response) => response.data,
}),
)
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'datasetSettings'])
const translateRetrieval: RetrievalTranslate = (selector, options) => t(selector, options)
const docLink = useDocLink()
const ref = useRef(null)
diff --git a/web/app/components/app/configuration/debug/chat-user-input.tsx b/web/app/components/app/configuration/debug/chat-user-input.tsx
index c52d9b77a7d..c876c706cf7 100644
--- a/web/app/components/app/configuration/debug/chat-user-input.tsx
+++ b/web/app/components/app/configuration/debug/chat-user-input.tsx
@@ -23,7 +23,7 @@ type Props = Readonly<{
}>
const ChatUserInput = ({ inputs }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const baseId = useId()
const { modelConfig, setInputs, canTestAndRun = false } = useContext(ConfigContext)
const debugInputReadonly = !canTestAndRun
diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/debug-item.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/debug-item.tsx
index e0c1ed8620e..66eb87d8acc 100644
--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/debug-item.tsx
+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/debug-item.tsx
@@ -29,7 +29,7 @@ type DebugItemProps = {
style?: CSSProperties
}
const DebugItem: FC<DebugItemProps> = ({ modelAndParameter, className, style }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const { mode } = useDebugConfigurationContext()
const { multipleModelConfigs, onMultipleModelConfigsChange, onDebugWithMultipleModelChange } =
useDebugWithMultipleModelContext()
diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx
index 3a6ec1662ac..d9d44881f08 100644
--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx
+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx
@@ -31,7 +31,7 @@ const DebugModelParameterTrigger: FC<DebugModelParameterTriggerProps> = ({
className,
...triggerProps
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { currentProvider, currentModel } = useTextGenerationCurrentProviderAndModelAndModelList({
provider: modelAndParameter.provider,
model: modelAndParameter.model,
diff --git a/web/app/components/app/configuration/debug/index.tsx b/web/app/components/app/configuration/debug/index.tsx
index 2d864c7ad25..e0cc7b0d71d 100644
--- a/web/app/components/app/configuration/debug/index.tsx
+++ b/web/app/components/app/configuration/debug/index.tsx
@@ -67,7 +67,7 @@ const Debug: FC<IDebug> = ({
multipleModelConfigs,
onMultipleModelConfigsChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'workflow'])
const {
canTestAndRun = false,
appId,
diff --git a/web/app/components/app/configuration/hooks/use-configuration.ts b/web/app/components/app/configuration/hooks/use-configuration.ts
index 7b5aeafe1dc..de76208f5d4 100644
--- a/web/app/components/app/configuration/hooks/use-configuration.ts
+++ b/web/app/components/app/configuration/hooks/use-configuration.ts
@@ -41,7 +41,7 @@ import { useMultipleModelDebug } from './configuration-lifecycle/use-multiple-mo
import { usePublishedConfigSync } from './configuration-lifecycle/use-published-config-sync'
export const useConfiguration = (): ConfigurationViewModel => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const [_settingsDestination, setSettingsDestination] = useQueryState(
settingsQueryParamName,
settingsQueryParser,
diff --git a/web/app/components/app/configuration/prompt-value-panel/index.tsx b/web/app/components/app/configuration/prompt-value-panel/index.tsx
index 983834f3299..ab5199b27aa 100644
--- a/web/app/components/app/configuration/prompt-value-panel/index.tsx
+++ b/web/app/components/app/configuration/prompt-value-panel/index.tsx
@@ -43,7 +43,7 @@ const PromptValuePanel: FC<IPromptValuePanelProps> = ({
visionConfig,
onVisionFilesChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'workflow'])
const baseId = useId()
const {
readonly,
diff --git a/web/app/components/app/configuration/tools/external-data-tool-modal.tsx b/web/app/components/app/configuration/tools/external-data-tool-modal.tsx
index a566d1910c2..019eb821e26 100644
--- a/web/app/components/app/configuration/tools/external-data-tool-modal.tsx
+++ b/web/app/components/app/configuration/tools/external-data-tool-modal.tsx
@@ -41,7 +41,7 @@ const ExternalDataToolModal: FC<ExternalDataToolModalProps> = ({
onSave,
onValidateBeforeSave,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const docLink = useDocLink()
const locale = useLocale()
const [localeData, setLocaleData] = useState(data.type ? data : { ...data, type: 'api' })
diff --git a/web/app/components/app/configuration/utils.ts b/web/app/components/app/configuration/utils.ts
index aed43503462..2db481ff92b 100644
--- a/web/app/components/app/configuration/utils.ts
+++ b/web/app/components/app/configuration/utils.ts
@@ -17,7 +17,7 @@ export type SelectorTranslate<Ns extends Namespace> = <
>(
selector: Selector,
options: { ns: TargetNs } & Record<string, unknown>,
-) => ReturnType<TFunction>
+) => ReturnType<TFunction<['app']>>
type StringSelectorTranslate<Ns extends Namespace> = <
const TargetNs extends Ns,
diff --git a/web/app/components/app/create-app-dialog/app-card/index.tsx b/web/app/components/app/create-app-dialog/app-card/index.tsx
index 8a43d58bdf7..b4c670291f4 100644
--- a/web/app/components/app/create-app-dialog/app-card/index.tsx
+++ b/web/app/components/app/create-app-dialog/app-card/index.tsx
@@ -21,7 +21,7 @@ type AppCardProps = {
}
const AppCard = ({ app, canCreate, onCreate }: AppCardProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'explore'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/app/create-app-dialog/app-list/index.tsx b/web/app/components/app/create-app-dialog/app-list/index.tsx
index 430a2d2f01d..4c43708e87d 100644
--- a/web/app/components/app/create-app-dialog/app-list/index.tsx
+++ b/web/app/components/app/create-app-dialog/app-list/index.tsx
@@ -36,7 +36,7 @@ type AppsProps = {
}
const Apps = ({ onClose, onCreateFromBlank }: AppsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const locale = useLocale()
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const { data: currentUserId } = useSuspenseQuery({
@@ -307,7 +307,7 @@ const Apps = ({ onClose, onCreateFromBlank }: AppsProps) => {
export default React.memo(Apps)
function NoTemplateFound() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
return (
<div className="w-full rounded-lg bg-workflow-process-bg p-4">
<div className="mb-2 inline-flex size-8 items-center justify-center rounded-lg bg-components-card-bg shadow-lg">
diff --git a/web/app/components/app/create-app-dialog/app-list/sidebar.tsx b/web/app/components/app/create-app-dialog/app-list/sidebar.tsx
index c654022af1f..48c45f8c49d 100644
--- a/web/app/components/app/create-app-dialog/app-list/sidebar.tsx
+++ b/web/app/components/app/create-app-dialog/app-list/sidebar.tsx
@@ -18,7 +18,7 @@ type SidebarProps = {
}
export default function Sidebar({ current, categories, onClick, onCreateFromBlank }: SidebarProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
return (
<div className="flex size-full flex-col">
<ul className="pt-0.5">
@@ -91,7 +91,7 @@ type AppCategoryLabelProps = {
className?: string
}
export function AppCategoryLabel({ category, className }: AppCategoryLabelProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
return (
<span className={className}>
{category === AppCategories.RECOMMENDED
diff --git a/web/app/components/app/create-app-dialog/index.tsx b/web/app/components/app/create-app-dialog/index.tsx
index 8916ebff77e..3bc96554283 100644
--- a/web/app/components/app/create-app-dialog/index.tsx
+++ b/web/app/components/app/create-app-dialog/index.tsx
@@ -10,7 +10,7 @@ type CreateAppDialogProps = {
}
const CreateAppTemplateDialog = ({ show, onClose, onCreateFromBlank }: CreateAppDialogProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
return (
<CreateAppDialogShell
diff --git a/web/app/components/app/create-app-dropdown.tsx b/web/app/components/app/create-app-dropdown.tsx
index 771825b83d9..f2ed39f4a30 100644
--- a/web/app/components/app/create-app-dropdown.tsx
+++ b/web/app/components/app/create-app-dropdown.tsx
@@ -31,7 +31,7 @@ export function CreateAppDropdown({
stepByStepTourTarget,
stepByStepTourHighlightPart,
}: CreateAppDropdownProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const menu = useStepByStepTourControlledDropdown({
controlledOpen: stepByStepTourControlledOpen,
})
diff --git a/web/app/components/app/create-app-modal/index.tsx b/web/app/components/app/create-app-modal/index.tsx
index cda3c2614af..62dca0354a5 100644
--- a/web/app/components/app/create-app-modal/index.tsx
+++ b/web/app/components/app/create-app-modal/index.tsx
@@ -49,7 +49,7 @@ const shouldExpandBeginnerAppTypes = (appMode?: AppModeEnum) => {
}
function CreateApp({ onClose, onCreateFromTemplate, defaultAppMode }: CreateAppProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const { push } = useRouter()
const nameInputId = useId()
@@ -433,7 +433,7 @@ const CreateAppModal = ({
onCreateFromTemplate,
defaultAppMode,
}: CreateAppDialogProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
return (
<CreateAppDialogShell
@@ -482,7 +482,7 @@ function AppTypeCard({ icon, title, description, active, onClick }: AppTypeCardP
}
function AppPreview({ mode }: { mode: AppModeEnum }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const previewInfo = (() => {
switch (mode) {
case AppModeEnum.CHAT:
diff --git a/web/app/components/app/create-from-dsl-modal/dsl-confirm-modal.tsx b/web/app/components/app/create-from-dsl-modal/dsl-confirm-modal.tsx
index b83575f12a2..2237325a9b4 100644
--- a/web/app/components/app/create-from-dsl-modal/dsl-confirm-modal.tsx
+++ b/web/app/components/app/create-from-dsl-modal/dsl-confirm-modal.tsx
@@ -27,7 +27,7 @@ function DSLConfirmModal({
confirmDisabled = false,
confirmLoading = false,
}: DSLConfirmModalProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
return (
<AlertDialog
diff --git a/web/app/components/app/create-from-dsl-modal/index.tsx b/web/app/components/app/create-from-dsl-modal/index.tsx
index e9df788806b..b79310972a5 100644
--- a/web/app/components/app/create-from-dsl-modal/index.tsx
+++ b/web/app/components/app/create-from-dsl-modal/index.tsx
@@ -92,7 +92,7 @@ function CreateFromDSLModal({
droppedFile,
}: CreateFromDSLModalProps) {
const { push } = useRouter()
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const formRef = useRef<HTMLFormElement>(null)
const browseButtonRef = useRef<HTMLButtonElement>(null)
const [currentFile, setCurrentFile] = useState<File | undefined>(droppedFile)
diff --git a/web/app/components/app/create-from-dsl-modal/uploader.tsx b/web/app/components/app/create-from-dsl-modal/uploader.tsx
index 9e516653b25..506f6aad94c 100644
--- a/web/app/components/app/create-from-dsl-modal/uploader.tsx
+++ b/web/app/components/app/create-from-dsl-modal/uploader.tsx
@@ -31,7 +31,7 @@ export function Uploader({
importType = 'dsl',
disabled = false,
}: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common', 'datasetCreation'])
const { accept, displayName: formatName } = importFormats[importType]
const isPackage = importType === 'app' && file?.name.toLowerCase().endsWith('.ifpkg')
const displayName = isPackage ? t(($) => $.appPackage, { ns: 'app' }) : formatName
diff --git a/web/app/components/app/deploy/built-in-environment-card/index.tsx b/web/app/components/app/deploy/built-in-environment-card/index.tsx
index c288ef06622..1e09d5e7628 100644
--- a/web/app/components/app/deploy/built-in-environment-card/index.tsx
+++ b/web/app/components/app/deploy/built-in-environment-card/index.tsx
@@ -22,7 +22,7 @@ function Divider() {
export const BuiltInEnvironmentCard = memo(
({ canViewAccessPoint }: { canViewAccessPoint: boolean }) => {
- const { t } = useTranslation('deployments')
+ const { t } = useTranslation(['deployments'])
const { formatTime } = useTimestamp()
const appDetail = useAppStore((state) => state.appDetail)
const appId = appDetail?.id ?? ''
diff --git a/web/app/components/app/deploy/environment-table/activity-cell.tsx b/web/app/components/app/deploy/environment-table/activity-cell.tsx
index 8fda519c2cf..7820eb886aa 100644
--- a/web/app/components/app/deploy/environment-table/activity-cell.tsx
+++ b/web/app/components/app/deploy/environment-table/activity-cell.tsx
@@ -25,8 +25,8 @@ function activityLabel(
}
export function ActivityCell({ activity }: { activity?: EnvironmentDeploymentOperation }) {
- const { t } = useTranslation('deployments')
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t } = useTranslation(['deployments'])
+ const { t: tWorkflow } = useTranslation(['workflow'])
const { formatTimeFromNow } = useFormatTimeFromNow()
if (!activity) return <span className="text-text-quaternary">--</span>
diff --git a/web/app/components/app/deploy/environment-table/deploy-menu/index.tsx b/web/app/components/app/deploy/environment-table/deploy-menu/index.tsx
index 74af3c9af76..437eb2b4a14 100644
--- a/web/app/components/app/deploy/environment-table/deploy-menu/index.tsx
+++ b/web/app/components/app/deploy/environment-table/deploy-menu/index.tsx
@@ -30,8 +30,8 @@ export function EnvironmentDeployMenu({
appearance = 'header',
onSelectEnvironment,
}: EnvironmentDeployMenuProps) {
- const { t } = useTranslation('deployments')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['deployments'])
+ const { t: tCommon } = useTranslation(['common'])
const undeployedEnvironments = useAtomValue(undeployedAppEnvironmentsAtom) ?? []
const isLoading = useAtomValue(appEnvironmentsIsLoadingAtom)
const isError = useAtomValue(appEnvironmentsIsErrorAtom)
diff --git a/web/app/components/app/deploy/environment-table/empty-state/index.tsx b/web/app/components/app/deploy/environment-table/empty-state/index.tsx
index 82d47cc7cf0..c6e6d205105 100644
--- a/web/app/components/app/deploy/environment-table/empty-state/index.tsx
+++ b/web/app/components/app/deploy/environment-table/empty-state/index.tsx
@@ -18,8 +18,8 @@ type EnvironmentTableEmptyProps =
}
export function EnvironmentTableEmpty(props: EnvironmentTableEmptyProps) {
- const { t } = useTranslation('deployments')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['deployments'])
+ const { t: tCommon } = useTranslation(['common'])
const isError = props.state === 'error'
const title = isError ? tCommon(($) => $['errorBoundary.title']) : t(($) => $['list.emptyTitle'])
const description = isError
diff --git a/web/app/components/app/deploy/environment-table/index.tsx b/web/app/components/app/deploy/environment-table/index.tsx
index 79a12a105dd..2d4b98d2ddf 100644
--- a/web/app/components/app/deploy/environment-table/index.tsx
+++ b/web/app/components/app/deploy/environment-table/index.tsx
@@ -52,7 +52,7 @@ function EnvironmentTableColumns() {
}
function EnvironmentTableHeader() {
- const { t } = useTranslation('deployments')
+ const { t } = useTranslation(['deployments'])
return (
<thead>
@@ -90,8 +90,8 @@ export const EnvironmentTable = memo(
onRedeploy,
onUndeploy,
}: EnvironmentTableProps) => {
- const { t } = useTranslation('deployments')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['deployments'])
+ const { t: tCommon } = useTranslation(['common'])
const deployments = useAtomValue(appEnvironmentDeploymentsAtom) ?? []
const isLoading = useAtomValue(appEnvironmentDeploymentsIsLoadingAtom)
const isError = useAtomValue(appEnvironmentDeploymentsIsErrorAtom)
diff --git a/web/app/components/app/deploy/environment-table/row-actions.tsx b/web/app/components/app/deploy/environment-table/row-actions.tsx
index 5fa3f678454..613bd9b05d5 100644
--- a/web/app/components/app/deploy/environment-table/row-actions.tsx
+++ b/web/app/components/app/deploy/environment-table/row-actions.tsx
@@ -68,8 +68,8 @@ export function EnvironmentRowActions({
onRedeploy: (deployment: EnvironmentDeployment) => void
onUndeploy: UndeployHandler
}) {
- const { t } = useTranslation('deployments')
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t } = useTranslation(['deployments'])
+ const { t: tWorkflow } = useTranslation(['workflow'])
const defaultVersionName = tWorkflow(($) => $['versionHistory.defaultName'])
const currentVersionName = getWorkflowVersionName(
row.deployment?.current_version,
diff --git a/web/app/components/app/deploy/environment-table/undeploy-confirm-dialog/index.tsx b/web/app/components/app/deploy/environment-table/undeploy-confirm-dialog/index.tsx
index b7e6d184a02..be9888d79a1 100644
--- a/web/app/components/app/deploy/environment-table/undeploy-confirm-dialog/index.tsx
+++ b/web/app/components/app/deploy/environment-table/undeploy-confirm-dialog/index.tsx
@@ -28,8 +28,8 @@ export function UndeployConfirmDialog({
onConfirm,
onOpenChange,
}: UndeployConfirmDialogProps) {
- const { t } = useTranslation('deployments')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['deployments'])
+ const { t: tCommon } = useTranslation(['common'])
return (
<AlertDialog
diff --git a/web/app/components/app/deploy/hooks/use-undeploy-workflow.ts b/web/app/components/app/deploy/hooks/use-undeploy-workflow.ts
index 07a7e02fbb0..c072d75490a 100644
--- a/web/app/components/app/deploy/hooks/use-undeploy-workflow.ts
+++ b/web/app/components/app/deploy/hooks/use-undeploy-workflow.ts
@@ -8,7 +8,7 @@ import { toast } from '@/app/notifications'
import { consoleQuery } from '@/service/console'
export function useUndeployWorkflow(appId: string) {
- const { t } = useTranslation('deployments')
+ const { t } = useTranslation(['deployments'])
const { mutateAsync } = useMutation(
consoleQuery.enterprise.appDeploy.deploymentService.undeployWorkflow.mutationOptions(),
)
diff --git a/web/app/components/app/deploy/index.tsx b/web/app/components/app/deploy/index.tsx
index d9f03ec1259..6669f89de1e 100644
--- a/web/app/components/app/deploy/index.tsx
+++ b/web/app/components/app/deploy/index.tsx
@@ -38,9 +38,9 @@ function AppDeployContent({
appId: string
canViewAccessPoint: boolean
}) {
- const { t } = useTranslation('deployments')
- const { t: tCommon } = useTranslation('common')
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t } = useTranslation(['deployments'])
+ const { t: tCommon } = useTranslation(['common'])
+ const { t: tWorkflow } = useTranslation(['workflow'])
const locale = useLocale()
const docLanguage = getDocLanguage(locale)
const deployOverviewDocUrl = getEnterpriseDocUrl('/use/deploy/overview', docLanguage)
diff --git a/web/app/components/app/deploy/shared/access-point-icon.tsx b/web/app/components/app/deploy/shared/access-point-icon.tsx
index a8d4b1daf2b..a213775c192 100644
--- a/web/app/components/app/deploy/shared/access-point-icon.tsx
+++ b/web/app/components/app/deploy/shared/access-point-icon.tsx
@@ -14,8 +14,8 @@ const ACCESS_POINT_ICON_CLASS_NAMES: Record<AccessPoint, string> = {
}
function useAccessPointLabels() {
- const { t: tAgent } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t: tAgent } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
return {
mcp: 'MCP',
@@ -34,7 +34,7 @@ export function AccessPointIcon({
accessPoint: AccessPoint
href?: string
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const labels = useAccessPointLabels()
const status = active
? t(($) => $['agentDetail.access.status.inService'])
diff --git a/web/app/components/app/deploy/shared/deployment-configuration/content.tsx b/web/app/components/app/deploy/shared/deployment-configuration/content.tsx
index adc3d5cf10f..12b3b85f47d 100644
--- a/web/app/components/app/deploy/shared/deployment-configuration/content.tsx
+++ b/web/app/components/app/deploy/shared/deployment-configuration/content.tsx
@@ -13,7 +13,7 @@ import { EnvironmentVariablesSection } from './environment-variables-section'
import { getDeploymentErrorMessage } from './utils/deployment-error'
function ConfigurationError({ messages }: { messages: string[] }) {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
return (
<div role="alert" className="flex gap-2 text-text-destructive">
@@ -45,8 +45,8 @@ export function DeploymentConfigurationContent({
request: DeploymentDialogRequest
version: DeploymentVersion
}) {
- const { t } = useTranslation('deployments')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['deployments'])
+ const { t: tCommon } = useTranslation(['common'])
const horizontalPaddingClassName = compact ? 'px-4' : 'px-6'
const {
deploymentOptions,
diff --git a/web/app/components/app/deploy/shared/deployment-configuration/credential-field.tsx b/web/app/components/app/deploy/shared/deployment-configuration/credential-field.tsx
index c8d89dce08c..292b80ef096 100644
--- a/web/app/components/app/deploy/shared/deployment-configuration/credential-field.tsx
+++ b/web/app/components/app/deploy/shared/deployment-configuration/credential-field.tsx
@@ -28,8 +28,8 @@ export function CredentialField({
value?: string
onChange: (value: string) => void
}) {
- const { t } = useTranslation('deployments')
- const { t: tPlugin } = useTranslation('plugin')
+ const { t } = useTranslation(['deployments'])
+ const { t: tPlugin } = useTranslation(['plugin'])
const { getIconUrl } = useGetIcon()
const { theme } = useTheme()
const selectedOption = slot.candidates.find((candidate) => candidate.credential_id === value)
diff --git a/web/app/components/app/deploy/shared/deployment-configuration/credentials-section.tsx b/web/app/components/app/deploy/shared/deployment-configuration/credentials-section.tsx
index 210d46649a7..538528de1ee 100644
--- a/web/app/components/app/deploy/shared/deployment-configuration/credentials-section.tsx
+++ b/web/app/components/app/deploy/shared/deployment-configuration/credentials-section.tsx
@@ -45,8 +45,8 @@ export const CredentialsSection = memo(
horizontalPaddingClassName: string
onChange: DeploymentConfigurationValuesController['setCredential']
}) => {
- const { t } = useTranslation('deployments')
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t } = useTranslation(['deployments'])
+ const { t: tWorkflow } = useTranslation(['workflow'])
const appCredentialSlots = credentialSlots.filter((slot) => !slot.workflow_as_tool_dependency)
const subworkflowCredentialSlots = credentialSlots.filter(
(slot) => slot.workflow_as_tool_dependency,
diff --git a/web/app/components/app/deploy/shared/deployment-configuration/deployment-precheck-alert.tsx b/web/app/components/app/deploy/shared/deployment-configuration/deployment-precheck-alert.tsx
index b2821e6239d..5a25230e03d 100644
--- a/web/app/components/app/deploy/shared/deployment-configuration/deployment-precheck-alert.tsx
+++ b/web/app/components/app/deploy/shared/deployment-configuration/deployment-precheck-alert.tsx
@@ -114,7 +114,7 @@ function groupUnsupportedNodes(nodes: UnsupportedNode[]): UnsupportedNodeGroup[]
}
export function DeploymentPrecheckAlert({ nodes }: { nodes: UnsupportedNode[] }) {
- const { t } = useTranslation('deployments')
+ const { t } = useTranslation(['deployments'])
const getProviderIcon = useGetProviderIcon(nodes)
const nodeGroups = useMemo(() => groupUnsupportedNodes(nodes), [nodes])
diff --git a/web/app/components/app/deploy/shared/deployment-configuration/environment-variable-field.tsx b/web/app/components/app/deploy/shared/deployment-configuration/environment-variable-field.tsx
index 4cdf9d6f2f8..bc7366dddce 100644
--- a/web/app/components/app/deploy/shared/deployment-configuration/environment-variable-field.tsx
+++ b/web/app/components/app/deploy/shared/deployment-configuration/environment-variable-field.tsx
@@ -63,8 +63,8 @@ export const EnvironmentVariableField = memo(
) => EnvironmentVariableSelection | undefined
onChange: (workflowId: string, key: string, value: EnvironmentVariableSelection) => void
}) => {
- const { t } = useTranslation('deployments')
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t } = useTranslation(['deployments'])
+ const { t: tWorkflow } = useTranslation(['workflow'])
const [selection, setSelection] = useState(() =>
resolveEnvironmentVariableSelection(slot, getInitialSelection(workflowId, slot.key)),
)
diff --git a/web/app/components/app/deploy/shared/deployment-configuration/environment-variables-section.tsx b/web/app/components/app/deploy/shared/deployment-configuration/environment-variables-section.tsx
index eae0486fda1..c6559db0fd1 100644
--- a/web/app/components/app/deploy/shared/deployment-configuration/environment-variables-section.tsx
+++ b/web/app/components/app/deploy/shared/deployment-configuration/environment-variables-section.tsx
@@ -65,7 +65,7 @@ export const EnvironmentVariablesSection = memo(
horizontalPaddingClassName: string
setEnvironmentVariableSelection: DeploymentConfigurationValuesController['setEnvironmentVariableSelection']
}) => {
- const { t } = useTranslation('deployments')
+ const { t } = useTranslation(['deployments'])
const visibleGroups = environmentVariableGroups.filter(
(group) => group.environment_variable_slots.length > 0,
)
diff --git a/web/app/components/app/deploy/shared/deployment-configuration/index.tsx b/web/app/components/app/deploy/shared/deployment-configuration/index.tsx
index aa9afd8cae9..df46add20fe 100644
--- a/web/app/components/app/deploy/shared/deployment-configuration/index.tsx
+++ b/web/app/components/app/deploy/shared/deployment-configuration/index.tsx
@@ -32,8 +32,8 @@ export function DeploymentConfiguration({
onClose: () => void
onDeploymentStarted?: (operationId: string) => void
}) {
- const { t } = useTranslation('deployments')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['deployments'])
+ const { t: tCommon } = useTranslation(['common'])
const configurationValues = useDeploymentConfigurationValues()
const queryState = useDeploymentConfigurationQueries({
appId,
diff --git a/web/app/components/app/deploy/shared/deployment-configuration/use-deployment-configuration-form.ts b/web/app/components/app/deploy/shared/deployment-configuration/use-deployment-configuration-form.ts
index c2b6efc7c2c..42755f5439b 100644
--- a/web/app/components/app/deploy/shared/deployment-configuration/use-deployment-configuration-form.ts
+++ b/web/app/components/app/deploy/shared/deployment-configuration/use-deployment-configuration-form.ts
@@ -35,9 +35,9 @@ export function useDeploymentConfigurationForm({
onClose: () => void
onDeploymentStarted?: (operationId: string) => void
}) {
- const { t: tCommon } = useTranslation('common')
- const { t: tDeployments } = useTranslation('deployments')
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t: tCommon } = useTranslation(['common'])
+ const { t: tDeployments } = useTranslation(['deployments'])
+ const { t: tWorkflow } = useTranslation(['workflow'])
const deployMutation = useDeployWorkflow({
appId,
invalidateAppEnvironmentsOnSuccess,
diff --git a/web/app/components/app/deploy/shared/deployment-configuration/workflow-source-popover.tsx b/web/app/components/app/deploy/shared/deployment-configuration/workflow-source-popover.tsx
index c1ff3566a8c..0b4536e4c63 100644
--- a/web/app/components/app/deploy/shared/deployment-configuration/workflow-source-popover.tsx
+++ b/web/app/components/app/deploy/shared/deployment-configuration/workflow-source-popover.tsx
@@ -102,7 +102,7 @@ export function WorkflowDependencyPreview({
paths: WorkflowPath[]
subjectName: string
}) {
- const { t } = useTranslation('deployments')
+ const { t } = useTranslation(['deployments'])
const validPaths = uniqueWorkflowPaths(paths)
const firstLeafWorkflow = validPaths[0]?.workflows.at(-1)
diff --git a/web/app/components/app/deploy/shared/runtime-state.tsx b/web/app/components/app/deploy/shared/runtime-state.tsx
index 7c8918745b3..c1a364d7364 100644
--- a/web/app/components/app/deploy/shared/runtime-state.tsx
+++ b/web/app/components/app/deploy/shared/runtime-state.tsx
@@ -55,7 +55,7 @@ function getRuntimeStateLabel(
}
export function RuntimeStateIndicator({ runtimeState }: RuntimeStateIndicatorProps) {
- const { t } = useTranslation('deployments')
+ const { t } = useTranslation(['deployments'])
const label = getRuntimeStateLabel(runtimeState, t)
const isInProgress =
runtimeState === RuntimeState.RUNTIME_STATE_STARTING ||
diff --git a/web/app/components/app/deploy/shared/version-label.tsx b/web/app/components/app/deploy/shared/version-label.tsx
index d19fe65dbea..81aa75be390 100644
--- a/web/app/components/app/deploy/shared/version-label.tsx
+++ b/web/app/components/app/deploy/shared/version-label.tsx
@@ -22,7 +22,7 @@ export function VersionLabel({
versionsBehind?: number
isLatest?: boolean
}) {
- const { t } = useTranslation('deployments')
+ const { t } = useTranslation(['deployments', 'workflow'])
const { formatTimeFromNow } = useFormatTimeFromNow()
if (!version) return <span className="text-text-quaternary">--</span>
diff --git a/web/app/components/app/deploy/shared/version-selection/index.tsx b/web/app/components/app/deploy/shared/version-selection/index.tsx
index 1a1bb208368..6f8b7092483 100644
--- a/web/app/components/app/deploy/shared/version-selection/index.tsx
+++ b/web/app/components/app/deploy/shared/version-selection/index.tsx
@@ -20,8 +20,8 @@ export function VersionSelection({
request: DeploymentDialogRequest
onSelect: (version: DeploymentVersion) => void
}) {
- const { t } = useTranslation('deployments')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['deployments'])
+ const { t: tCommon } = useTranslation(['common'])
const title = versionSelectionTitle(
request,
t(($) => $['versions.deployTo'], { name: request.environment }),
@@ -70,8 +70,8 @@ export function EmbeddedVersionSelection({
onBack: () => void
onSelect: (version: DeploymentVersion) => void
}) {
- const { t } = useTranslation('deployments')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['deployments'])
+ const { t: tCommon } = useTranslation(['common'])
const title = versionSelectionTitle(
request,
t(($) => $['versions.deployTo'], { name: request.environment }),
diff --git a/web/app/components/app/deploy/shared/version-selection/version-list.tsx b/web/app/components/app/deploy/shared/version-selection/version-list.tsx
index 7226de85d54..32e2a5a3246 100644
--- a/web/app/components/app/deploy/shared/version-selection/version-list.tsx
+++ b/web/app/components/app/deploy/shared/version-selection/version-list.tsx
@@ -54,8 +54,8 @@ const VersionChoice = memo(
disabled?: boolean
onSelect: (version: DeploymentVersion) => void
}) => {
- const { t } = useTranslation('deployments')
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t } = useTranslation(['deployments'])
+ const { t: tWorkflow } = useTranslation(['workflow'])
const { formatTimeFromNow } = useFormatTimeFromNow()
return (
@@ -140,8 +140,8 @@ export function VersionList({
publishHref?: string
onSelect: (version: DeploymentVersion) => void
}) {
- const { t: tCommon } = useTranslation('common')
- const { t } = useTranslation('deployments')
+ const { t: tCommon } = useTranslation(['common'])
+ const { t } = useTranslation(['deployments'])
const versions = useAtomValue(appWorkflowVersionsAtom)
const versionsError = useAtomValue(appWorkflowVersionsErrorAtom)
const fetchNextPage = useAtomValue(appWorkflowVersionsFetchNextPageAtom)
diff --git a/web/app/components/app/deploy/state.ts b/web/app/components/app/deploy/state.ts
index 789889a54f5..557d378eed5 100644
--- a/web/app/components/app/deploy/state.ts
+++ b/web/app/components/app/deploy/state.ts
@@ -54,7 +54,7 @@ export function AppDeployStateBoundary({
appId: string
children: ReactNode
}) {
- const { t } = useTranslation('workflow')
+ const { t } = useTranslation(['workflow'])
useHydrateAtoms(
[
diff --git a/web/app/components/app/duplicate-modal/index.tsx b/web/app/components/app/duplicate-modal/index.tsx
index 9a00b50ae94..9bce608f4f1 100644
--- a/web/app/components/app/duplicate-modal/index.tsx
+++ b/web/app/components/app/duplicate-modal/index.tsx
@@ -43,7 +43,7 @@ const DuplicateAppModal = ({
onConfirm,
onHide,
}: DuplicateAppModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common', 'explore'])
const [name, setName] = React.useState(appName)
diff --git a/web/app/components/app/in-site-message/notification.tsx b/web/app/components/app/in-site-message/notification.tsx
index 753b37d6f1c..309fa89e20a 100644
--- a/web/app/components/app/in-site-message/notification.tsx
+++ b/web/app/components/app/in-site-message/notification.tsx
@@ -56,7 +56,7 @@ function parseNotificationBody(body: string): NotificationBodyPayload | null {
}
function InSiteMessageNotification() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const locale = useLocale()
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
diff --git a/web/app/components/app/log/archived-logs-notice.tsx b/web/app/components/app/log/archived-logs-notice.tsx
index 760de397b88..3cb6641c863 100644
--- a/web/app/components/app/log/archived-logs-notice.tsx
+++ b/web/app/components/app/log/archived-logs-notice.tsx
@@ -14,7 +14,7 @@ import { systemFeaturesQueryOptions } from '@/features/system-features/client'
import { consoleQuery } from '@/service/console'
export function ArchivedLogsNotice() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/app/log/empty-element.tsx b/web/app/components/app/log/empty-element.tsx
index c322d6d441b..c7614049333 100644
--- a/web/app/components/app/log/empty-element.tsx
+++ b/web/app/components/app/log/empty-element.tsx
@@ -35,7 +35,7 @@ const ThreeDotsIcon = ({ className }: SVGProps<SVGElement>) => {
}
const EmptyElement: FC<{ appDetail: App }> = ({ appDetail }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog'])
const { data: currentUserId } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.id,
diff --git a/web/app/components/app/log/filter.tsx b/web/app/components/app/log/filter.tsx
index c9564260d77..d75e54078c5 100644
--- a/web/app/components/app/log/filter.tsx
+++ b/web/app/components/app/log/filter.tsx
@@ -51,7 +51,7 @@ const Filter: FC<IFilterProps> = ({
setQueryParams,
}: IFilterProps) => {
const { data, isLoading } = useAnnotationsCount(appId)
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common'])
const planState = useCloudSandboxPlanStatus()
const isTimePeriodRestricted = isLogTimePeriodRestricted(planState)
const timePeriodEntries = Object.entries(TIME_PERIOD_MAPPING)
diff --git a/web/app/components/app/log/index.tsx b/web/app/components/app/log/index.tsx
index 949c1fa4582..355785fd5ca 100644
--- a/web/app/components/app/log/index.tsx
+++ b/web/app/components/app/log/index.tsx
@@ -52,7 +52,7 @@ const logsStateCache = new Map<
>()
const Logs: FC<ILogsProps> = ({ appDetail }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common'])
const docLink = useDocLink()
const router = useRouter()
const pathname = usePathname()
diff --git a/web/app/components/app/log/list.tsx b/web/app/components/app/log/list.tsx
index 84fb93e8538..f8538315472 100644
--- a/web/app/components/app/log/list.tsx
+++ b/web/app/components/app/log/list.tsx
@@ -196,7 +196,7 @@ function DetailPanel({ appDetail, detail, onClose, onFeedback }: IDetailPanel) {
currentLogModalActiveTab: state.currentLogModalActiveTab,
})),
)
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common'])
const [hasMore, setHasMore] = useState(true)
const [varValues, setVarValues] = useState<Record<string, string>>({})
const isLoadingRef = useRef(false)
@@ -661,7 +661,7 @@ const CompletionConversationDetailComp: FC<ConversationDetailProps> = ({
// Text Generator App Session Details Including Message List
const { data: conversationDetail, refetch: conversationDetailMutate } =
useCompletionConversationDetail(appDetail.id, conversationId)
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common'])
const handleFeedback = async (
mid: string,
@@ -724,7 +724,7 @@ const ChatConversationDetailComp: FC<ConversationDetailProps> = ({
onClose,
}) => {
const { data: conversationDetail } = useChatConversationDetail(appDetail.id, conversationId)
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common'])
const handleFeedback = async (
mid: string,
@@ -780,7 +780,7 @@ const ChatConversationDetailComp: FC<ConversationDetailProps> = ({
* Conversation list component including basic information
*/
const ConversationList: FC<IConversationList> = ({ logs, appDetail, onRefresh }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog'])
const { formatTime } = useTimestamp()
const [conversationIdInUrl, setConversationIdInUrl] = useQueryState(
'conversation_id',
diff --git a/web/app/components/app/log/model-info.tsx b/web/app/components/app/log/model-info.tsx
index c360308475e..fff5f044670 100644
--- a/web/app/components/app/log/model-info.tsx
+++ b/web/app/components/app/log/model-info.tsx
@@ -24,7 +24,7 @@ type Props = Readonly<{
}>
const ModelInfo: FC<Props> = ({ model }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog'])
const modelName = model.name
const providerName = model.provider
const { currentModel, currentProvider } = useTextGenerationCurrentProviderAndModelAndModelList({
diff --git a/web/app/components/app/log/retention-upgrade-notice.tsx b/web/app/components/app/log/retention-upgrade-notice.tsx
index c738465c0f4..6d338fcaa36 100644
--- a/web/app/components/app/log/retention-upgrade-notice.tsx
+++ b/web/app/components/app/log/retention-upgrade-notice.tsx
@@ -5,7 +5,7 @@ import UpgradeBtn from '@/app/components/billing/upgrade-btn'
import { useCloudSandboxPlanStatus } from './cloud-sandbox-retention'
export function RetentionUpgradeNotice() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog'])
const planState = useCloudSandboxPlanStatus()
if (planState !== 'sandbox') return null
diff --git a/web/app/components/app/log/var-panel.tsx b/web/app/components/app/log/var-panel.tsx
index 0322e28dc04..2f7b105ef0d 100644
--- a/web/app/components/app/log/var-panel.tsx
+++ b/web/app/components/app/log/var-panel.tsx
@@ -14,7 +14,7 @@ type Props = Readonly<{
}>
const VarPanel: FC<Props> = ({ varList, message_files }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog'])
const [isCollapse, { toggle: toggleCollapse }] = useBoolean(false)
const [imagePreviewUrl, setImagePreviewUrl] = useState('')
diff --git a/web/app/components/app/overview/apikey-info-panel/index.tsx b/web/app/components/app/overview/apikey-info-panel/index.tsx
index 5a25ff244cd..68c1626b3b1 100644
--- a/web/app/components/app/overview/apikey-info-panel/index.tsx
+++ b/web/app/components/app/overview/apikey-info-panel/index.tsx
@@ -30,7 +30,7 @@ const APIKeyInfoPanel: FC = () => {
)
const [, setSettingsDestination] = useQueryState(settingsQueryParamName, settingsQueryParser)
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview'])
const [isShow, setIsShow] = useState(true)
diff --git a/web/app/components/app/overview/app-chart.tsx b/web/app/components/app/overview/app-chart.tsx
index d4ce69c2193..facd81281a7 100644
--- a/web/app/components/app/overview/app-chart.tsx
+++ b/web/app/components/app/overview/app-chart.tsx
@@ -70,7 +70,7 @@ const Chart: React.FC<IChartProps> = ({
}) => {
const titleId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview'])
const statistics = chartData.data
const yField = getChartValueField(statistics, valueKey)
const options = buildChartOptions({
@@ -202,7 +202,7 @@ const createBizChartComponent = <TData extends ChartResponse>({
className,
}: BizChartConfig<TData>): FC<IBizChartProps> => {
const BizChart: FC<IBizChartProps> = ({ id, period }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview'])
const { data: response, isLoading } = useQuery(queryOptions(id, period.query))
if (isLoading || !response) return <LoadingPlaceholder />
diff --git a/web/app/components/app/overview/customize/index.tsx b/web/app/components/app/overview/customize/index.tsx
index bd148f55819..dd1bcba232a 100644
--- a/web/app/components/app/overview/customize/index.tsx
+++ b/web/app/components/app/overview/customize/index.tsx
@@ -59,7 +59,7 @@ const CustomizeModal: FC<IShareLinkProps> = ({
mode,
sourceCodeRepository,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview', 'common'])
const docLink = useDocLink()
const isChatApp = mode === AppModeEnum.CHAT || mode === AppModeEnum.ADVANCED_CHAT
const repository =
diff --git a/web/app/components/app/overview/embedded/index.tsx b/web/app/components/app/overview/embedded/index.tsx
index 45e6698d084..af9f90720e9 100644
--- a/web/app/components/app/overview/embedded/index.tsx
+++ b/web/app/components/app/overview/embedded/index.tsx
@@ -115,7 +115,7 @@ const EmbeddedContent = ({
hiddenInputs,
}: Required<Pick<Props, 'accessToken' | 'appBaseUrl'>> &
Pick<Props, 'siteInfo' | 'webAppRoute' | 'hiddenInputs'>) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview'])
const supportedHiddenInputs = useMemo<WorkflowHiddenStartVariable[]>(
() => (hiddenInputs ?? []).filter(isWorkflowLaunchInputSupported),
[hiddenInputs],
@@ -360,7 +360,7 @@ const Embedded = ({
hiddenInputs,
className,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview', 'common'])
return (
<Dialog
diff --git a/web/app/components/app/overview/settings/index.tsx b/web/app/components/app/overview/settings/index.tsx
index 33edace323a..c07e1e4e338 100644
--- a/web/app/components/app/overview/settings/index.tsx
+++ b/web/app/components/app/overview/settings/index.tsx
@@ -204,7 +204,7 @@ const SettingsModal: FC<ISettingsModalProps> = ({
const [inputInfo, setInputInfo] = useState(nextInputInfo)
const [language, setLanguage] = useState(default_language)
const [saveLoading, setSaveLoading] = useState(false)
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'appOverview', 'billing', 'common'])
const [showAppIconPicker, setShowAppIconPicker] = useState(false)
const [appIcon, setAppIcon] = useState<SettingsAppIconSelection>(nextAppIcon)
diff --git a/web/app/components/app/overview/workflow-launch-dialog/index.tsx b/web/app/components/app/overview/workflow-launch-dialog/index.tsx
index 016fdd1868a..bef156b62ee 100644
--- a/web/app/components/app/overview/workflow-launch-dialog/index.tsx
+++ b/web/app/components/app/overview/workflow-launch-dialog/index.tsx
@@ -26,7 +26,7 @@ function WorkflowLaunchForm({
targetUrl,
onClose,
}: WorkflowLaunchFormProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview', 'common'])
const [values, setValues] = useState<Record<string, WorkflowLaunchInputValue>>(() =>
createWorkflowLaunchInitialValues(hiddenVariables),
)
@@ -86,7 +86,7 @@ export function WorkflowLaunchDialog({
targetUrl,
onOpenChange,
}: WorkflowLaunchDialogProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview'])
const supportedVariables = hiddenVariables.filter(isWorkflowLaunchInputSupported)
if (!hiddenVariables.length) return null
diff --git a/web/app/components/app/switch-app-modal/index.tsx b/web/app/components/app/switch-app-modal/index.tsx
index c70a90a57e0..8ec6218b0c1 100644
--- a/web/app/components/app/switch-app-modal/index.tsx
+++ b/web/app/components/app/switch-app-modal/index.tsx
@@ -43,7 +43,7 @@ type SwitchAppModalProps = {
const SwitchAppModal = ({ show, appDetail, inAppDetail = false, onClose }: SwitchAppModalProps) => {
const { push, replace } = useRouter()
const nameInputId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const setAppDetail = useAppStore((s) => s.setAppDetail)
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const isRbacEnabled = systemFeatures.rbac_enabled
diff --git a/web/app/components/app/text-generate/item/action-groups.tsx b/web/app/components/app/text-generate/item/action-groups.tsx
index 1c16273a321..db74f2e9186 100644
--- a/web/app/components/app/text-generate/item/action-groups.tsx
+++ b/web/app/components/app/text-generate/item/action-groups.tsx
@@ -64,7 +64,7 @@ const GenerationActionGroups: FC<GenerationActionGroupsProps> = ({
voice,
workflowProcessData,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'share'])
const isTryApp = appSourceType === AppSourceTypeEnum.tryApp
const showCopyAction = (currentTab === 'RESULT' && workflowProcessData?.resultText) || !isWorkflow
diff --git a/web/app/components/app/text-generate/item/index.tsx b/web/app/components/app/text-generate/item/index.tsx
index 7541f973c6c..7882297f0de 100644
--- a/web/app/components/app/text-generate/item/index.tsx
+++ b/web/app/components/app/text-generate/item/index.tsx
@@ -92,7 +92,7 @@ const GenerationItem: FC<IGenerationItemProps> = ({
siteInfo,
inSidePanel,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'share'])
const params = useParams()
const isTop = depth === 1
const [completionRes, setCompletionRes] = useState('')
diff --git a/web/app/components/app/text-generate/item/workflow-body.tsx b/web/app/components/app/text-generate/item/workflow-body.tsx
index 864e74d1a37..394c3f28e32 100644
--- a/web/app/components/app/text-generate/item/workflow-body.tsx
+++ b/web/app/components/app/text-generate/item/workflow-body.tsx
@@ -39,7 +39,7 @@ const WorkflowBody: FC<WorkflowBodyProps> = ({
taskId,
workflowProcessData,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['runLog', 'share'])
if (!workflowProcessData) return null
diff --git a/web/app/components/app/text-generate/saved-items/index.tsx b/web/app/components/app/text-generate/saved-items/index.tsx
index bb7e80cd219..2d93968d4df 100644
--- a/web/app/components/app/text-generate/saved-items/index.tsx
+++ b/web/app/components/app/text-generate/saved-items/index.tsx
@@ -27,7 +27,7 @@ const SavedItems: FC<ISavedItemsProps> = ({
onRemove,
onStartCreateContent,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className={cn('space-y-4', className)}>
diff --git a/web/app/components/app/text-generate/saved-items/no-data/index.tsx b/web/app/components/app/text-generate/saved-items/no-data/index.tsx
index bc632b963c7..0108af0ddee 100644
--- a/web/app/components/app/text-generate/saved-items/no-data/index.tsx
+++ b/web/app/components/app/text-generate/saved-items/no-data/index.tsx
@@ -10,7 +10,7 @@ type INoDataProps = {
}
const NoData: FC<INoDataProps> = ({ onStartCreateContent }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
return (
<div className="rounded-xl bg-background-section-burn p-6">
diff --git a/web/app/components/app/type-selector/index.tsx b/web/app/components/app/type-selector/index.tsx
index 77b5a6d7b17..66a95404b80 100644
--- a/web/app/components/app/type-selector/index.tsx
+++ b/web/app/components/app/type-selector/index.tsx
@@ -24,7 +24,7 @@ const allTypes: AppModeEnum[] = [
]
const AppTypeSelector = ({ value, onChange }: AppSelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const triggerLabel =
value.length === 0
? t(($) => $['typeSelector.all'], { ns: 'app' })
@@ -156,7 +156,7 @@ export const AppTypeIcon = React.memo(
)
function AppTypeSelectTrigger({ values }: { readonly values: AppSelectorProps['value'] }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
if (!values || values.length === 0) {
return (
<div className={cn('flex h-8 items-center justify-between gap-1')}>
@@ -244,7 +244,7 @@ type AppTypeLabelProps = {
className?: string
}
export function AppTypeLabel({ type, className }: AppTypeLabelProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
return <span className={className}>{getAppTypeLabel(type, t)}</span>
}
diff --git a/web/app/components/app/use-export-app-dsl.ts b/web/app/components/app/use-export-app-dsl.ts
index 68a93c3f90a..0bee44e7ca4 100644
--- a/web/app/components/app/use-export-app-dsl.ts
+++ b/web/app/components/app/use-export-app-dsl.ts
@@ -102,8 +102,8 @@ async function downloadAppDsl(input: ExportAppDslInput, messages: ExportAppDslMe
}
function useExportAppDslMessages() {
- const { t: tApp } = useTranslation('app')
- const { t: tCommon } = useTranslation('common')
+ const { t: tApp } = useTranslation(['app'])
+ const { t: tCommon } = useTranslation(['common'])
return {
loading: tCommon(($) => $['operation.exporting']),
diff --git a/web/app/components/app/workflow-log/detail.tsx b/web/app/components/app/workflow-log/detail.tsx
index ff84116931c..8bbe0cfd880 100644
--- a/web/app/components/app/workflow-log/detail.tsx
+++ b/web/app/components/app/workflow-log/detail.tsx
@@ -15,7 +15,7 @@ type ILogDetail = {
}
const DetailPanel: FC<ILogDetail> = ({ runID, onClose, canReplay = false }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common'])
const appDetail = useStore((state) => state.appDetail)
const router = useRouter()
diff --git a/web/app/components/app/workflow-log/filter.tsx b/web/app/components/app/workflow-log/filter.tsx
index 7101084ad9c..934a8e86da0 100644
--- a/web/app/components/app/workflow-log/filter.tsx
+++ b/web/app/components/app/workflow-log/filter.tsx
@@ -42,7 +42,7 @@ type IFilterProps = {
}
const Filter: FC<IFilterProps> = ({ queryParams, setQueryParams }: IFilterProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common'])
const planState = useCloudSandboxPlanStatus()
const isTimePeriodRestricted = isLogTimePeriodRestricted(planState)
const timePeriodEntries = Object.entries(TIME_PERIOD_MAPPING)
diff --git a/web/app/components/app/workflow-log/index.tsx b/web/app/components/app/workflow-log/index.tsx
index 650825c5c86..7fb955cf4f8 100644
--- a/web/app/components/app/workflow-log/index.tsx
+++ b/web/app/components/app/workflow-log/index.tsx
@@ -42,7 +42,7 @@ export type QueryParam = {
}
const Logs: FC<ILogsProps> = ({ appDetail }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common'])
const { data: timezone } = useQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.timezone ?? undefined,
diff --git a/web/app/components/app/workflow-log/list.tsx b/web/app/components/app/workflow-log/list.tsx
index 97b6464de12..28e8ac3f57f 100644
--- a/web/app/components/app/workflow-log/list.tsx
+++ b/web/app/components/app/workflow-log/list.tsx
@@ -37,7 +37,7 @@ type ILogs = {
const defaultValue = 'N/A'
const WorkflowAppLogList: FC<ILogs> = ({ logs, appDetail, onRefresh }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog'])
const { formatTime } = useTimestamp()
const media = useBreakpoints()
diff --git a/web/app/components/app/workflow-log/trigger-by-display.tsx b/web/app/components/app/workflow-log/trigger-by-display.tsx
index e11cf9be106..d2ec0f9f7e9 100644
--- a/web/app/components/app/workflow-log/trigger-by-display.tsx
+++ b/web/app/components/app/workflow-log/trigger-by-display.tsx
@@ -1,4 +1,5 @@
'use client'
+
import type { TFunction } from 'i18next'
import type { FC } from 'react'
import type { TriggerMetadata } from '@/models/log'
@@ -19,7 +20,7 @@ type TriggerByDisplayProps = {
const getTriggerDisplayName = (
triggeredFrom: WorkflowRunTriggeredFrom,
- t: TFunction,
+ t: TFunction<['appLog']>,
metadata?: TriggerMetadata,
) => {
if (triggeredFrom === WorkflowRunTriggeredFrom.PLUGIN && metadata?.event_name)
@@ -116,7 +117,7 @@ const TriggerByDisplay: FC<TriggerByDisplayProps> = ({
showText = true,
triggerMetadata,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog'])
const { theme } = useTheme()
const displayName = getTriggerDisplayName(triggeredFrom, t, triggerMetadata)
diff --git a/web/app/components/apps/app-card/index.tsx b/web/app/components/apps/app-card/index.tsx
index 7bcaccc3880..eb739cea2d1 100644
--- a/web/app/components/apps/app-card/index.tsx
+++ b/web/app/components/apps/app-card/index.tsx
@@ -49,7 +49,7 @@ export const AppCard = memo(
stepByStepTourCardHighlightPart,
stepByStepTourActionMenuHighlightPart,
}: AppCardProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common', 'time'])
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const { data: currentUserId } = useSuspenseQuery({
...userProfileQueryOptions(),
diff --git a/web/app/components/apps/app-card/interactions.tsx b/web/app/components/apps/app-card/interactions.tsx
index 075e6209b18..a00f6a62fa1 100644
--- a/web/app/components/apps/app-card/interactions.tsx
+++ b/web/app/components/apps/app-card/interactions.tsx
@@ -124,7 +124,7 @@ function AppCardOperationsMenuItems({
onDelete,
onAccessConfig,
}: AppCardOperationsMenuItemsProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const openAsyncWindow = useAsyncWindowOpen()
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const { data: userCanAccessApp, isLoading: isGettingUserCanAccessApp } = useGetUserCanAccessApp({
@@ -267,7 +267,7 @@ export function AppCardInteractions({
stepByStepTourActionMenuOpen = false,
stepByStepTourActionMenuHighlightPart,
}: AppCardInteractionsProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const { data: currentUserId } = useSuspenseQuery({
...userProfileQueryOptions(),
diff --git a/web/app/components/apps/app-list-catalog.tsx b/web/app/components/apps/app-list-catalog.tsx
index ef016678bc8..e34a7a8d8e1 100644
--- a/web/app/components/apps/app-list-catalog.tsx
+++ b/web/app/components/apps/app-list-catalog.tsx
@@ -65,7 +65,7 @@ type AppListCatalogContentProps = Omit<AppListCatalogProps, 'appListQuery'> &
}>
function CatalogSkeleton() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className="relative grow" role="status" aria-label={t(($) => $.loading, { ns: 'common' })}>
@@ -98,7 +98,7 @@ function AppListCatalogContent({
scrollViewportRef,
systemFeatures,
}: AppListCatalogContentProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const apps = useMemo(() => appListPages.flatMap(({ data: pageApps }) => pageApps), [appListPages])
const workflowOnlineUserAppIds = useMemo(() => {
diff --git a/web/app/components/apps/app-list-header.tsx b/web/app/components/apps/app-list-header.tsx
index afff219ed27..d07f760ed10 100644
--- a/web/app/components/apps/app-list-header.tsx
+++ b/web/app/components/apps/app-list-header.tsx
@@ -63,7 +63,7 @@ export function AppListHeader({
onOpenTagManagement,
showCreateButton,
}: AppListHeaderProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const activeStepByStepTourTaskId = useAtomValue(activeStepByStepTourTaskIdAtom)
const activeStepByStepTourGuideIndex = useAtomValue(activeStepByStepTourGuideIndexAtom)
const activeStepByStepTourGuideGroup = useAtomValue(activeStepByStepTourGuideGroupAtom)
diff --git a/web/app/components/apps/app-sort-filter.tsx b/web/app/components/apps/app-sort-filter.tsx
index be7c96da6b1..1cda36e7d19 100644
--- a/web/app/components/apps/app-sort-filter.tsx
+++ b/web/app/components/apps/app-sort-filter.tsx
@@ -21,7 +21,7 @@ type AppSortFilterProps = {
}
export function AppSortFilter({ value, onChange }: AppSortFilterProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const options = useMemo(
() =>
diff --git a/web/app/components/apps/app-type-filter.tsx b/web/app/components/apps/app-type-filter.tsx
index 89692100f66..06f2704df8e 100644
--- a/web/app/components/apps/app-type-filter.tsx
+++ b/web/app/components/apps/app-type-filter.tsx
@@ -25,7 +25,7 @@ type AppTypeFilterProps = {
}
export function AppTypeFilter({ value, onChange }: AppTypeFilterProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const options = useMemo(() => {
const optionsByCategory = {
diff --git a/web/app/components/apps/creators-filter.tsx b/web/app/components/apps/creators-filter.tsx
index cd348aa4f93..89bd932055f 100644
--- a/web/app/components/apps/creators-filter.tsx
+++ b/web/app/components/apps/creators-filter.tsx
@@ -40,7 +40,7 @@ const baseChipClassName =
'flex h-8 items-center whitespace-nowrap rounded-lg border-[0.5px] px-2 text-[13px] leading-4 outline-hidden transition-colors focus-visible:ring-2 focus-visible:ring-state-accent-solid'
const CreatorsFilter = ({ value, onChange }: CreatorsFilterProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const { data: currentUserId } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.id,
diff --git a/web/app/components/apps/empty.tsx b/web/app/components/apps/empty.tsx
index 93fa7ce0322..a148ed15a1d 100644
--- a/web/app/components/apps/empty.tsx
+++ b/web/app/components/apps/empty.tsx
@@ -8,7 +8,7 @@ type EmptyProps = {
}
const Empty = ({ message, stepByStepTourTarget }: EmptyProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
return (
<FilterEmptyState
diff --git a/web/app/components/apps/first-empty-state/index.tsx b/web/app/components/apps/first-empty-state/index.tsx
index b798fde778c..b31a2b7ffa7 100644
--- a/web/app/components/apps/first-empty-state/index.tsx
+++ b/web/app/components/apps/first-empty-state/index.tsx
@@ -40,7 +40,7 @@ function FirstEmptyState({
onTryLearnDify,
showLearnDify,
}: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const actions: EmptyCreateAction[] = [
{
diff --git a/web/app/components/apps/import-from-marketplace-template-modal.tsx b/web/app/components/apps/import-from-marketplace-template-modal.tsx
index 13227a97bb9..5d23f4c93e9 100644
--- a/web/app/components/apps/import-from-marketplace-template-modal.tsx
+++ b/web/app/components/apps/import-from-marketplace-template-modal.tsx
@@ -24,7 +24,7 @@ const ImportFromMarketplaceTemplateModal = ({
onClose,
onConfirm,
}: ImportFromMarketplaceTemplateModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const { data, isLoading, isError } = useMarketplaceTemplateDetail(templateId)
const template = data?.data
const [importing, setImporting] = useState(false)
diff --git a/web/app/components/apps/index.tsx b/web/app/components/apps/index.tsx
index 7d0fa6124ab..fa6bc95fcab 100644
--- a/web/app/components/apps/index.tsx
+++ b/web/app/components/apps/index.tsx
@@ -30,7 +30,7 @@ const ImportFromMarketplaceTemplateModal = dynamic(
const AppListProvider = AppListContext.Provider
const AppsContent = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const searchParams = useSearchParams()
const { replace } = useRouter()
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
diff --git a/web/app/components/apps/starred-app-card.tsx b/web/app/components/apps/starred-app-card.tsx
index a3e21df7210..08bd7adc6da 100644
--- a/web/app/components/apps/starred-app-card.tsx
+++ b/web/app/components/apps/starred-app-card.tsx
@@ -27,7 +27,7 @@ type StarredAppCardProps = {
export const StarredAppCard = memo(
({ app, stepByStepTourCardTarget, stepByStepTourCardHighlightPart }: StarredAppCardProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common', 'time'])
const { data: currentUserId } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.id,
diff --git a/web/app/components/apps/starred-app-list.tsx b/web/app/components/apps/starred-app-list.tsx
index 9d1a1e41695..e76d5ad67fd 100644
--- a/web/app/components/apps/starred-app-list.tsx
+++ b/web/app/components/apps/starred-app-list.tsx
@@ -33,7 +33,7 @@ export function StarredAppList({
stepByStepTourCardHighlightPart,
stepByStepTourHighlightedCardCount = 0,
}: StarredAppListProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
if (apps.length === 0) return null
diff --git a/web/app/components/base/access-point/url.tsx b/web/app/components/base/access-point/url.tsx
index 24e102cedd0..fb3c671f5ff 100644
--- a/web/app/components/base/access-point/url.tsx
+++ b/web/app/components/base/access-point/url.tsx
@@ -60,7 +60,7 @@ export function AccessPointUrl({
unavailableLabel,
value,
}: AccessPointUrlProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const detailsAvailable = !loading && !unavailable
const disabledOpenButton = (
<Button
diff --git a/web/app/components/base/agent-log-modal/detail.tsx b/web/app/components/base/agent-log-modal/detail.tsx
index d32076e7db3..f56bc612ff8 100644
--- a/web/app/components/base/agent-log-modal/detail.tsx
+++ b/web/app/components/base/agent-log-modal/detail.tsx
@@ -27,7 +27,7 @@ const AgentLogDetail: FC<AgentLogDetailProps> = ({
messageID,
log,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['runLog'])
const [currentTab, setCurrentTab] = useState<string>(activeTab)
const appDetail = useAppStore((s) => s.appDetail)
const [loading, setLoading] = useState<boolean>(true)
diff --git a/web/app/components/base/agent-log-modal/index.tsx b/web/app/components/base/agent-log-modal/index.tsx
index f629f6e6dcd..ad5f26cdd1b 100644
--- a/web/app/components/base/agent-log-modal/index.tsx
+++ b/web/app/components/base/agent-log-modal/index.tsx
@@ -15,7 +15,7 @@ type AgentLogModalProps = Readonly<{
onCancel: () => void
}>
const AgentLogModal: FC<AgentLogModalProps> = ({ currentLogItem, width, floating, onCancel }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common'])
const ref = useRef(null)
const [mounted, setMounted] = useState(false)
diff --git a/web/app/components/base/agent-log-modal/iteration.tsx b/web/app/components/base/agent-log-modal/iteration.tsx
index 889ffdbe6f8..7b62654f0bb 100644
--- a/web/app/components/base/agent-log-modal/iteration.tsx
+++ b/web/app/components/base/agent-log-modal/iteration.tsx
@@ -13,7 +13,7 @@ type Props = Readonly<{
}>
const Iteration: FC<Props> = ({ iterationInfo, isFinal, index }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog'])
return (
<div className={cn('px-4 py-2')}>
diff --git a/web/app/components/base/agent-log-modal/result.tsx b/web/app/components/base/agent-log-modal/result.tsx
index ec901ba85a0..ce11afda408 100644
--- a/web/app/components/base/agent-log-modal/result.tsx
+++ b/web/app/components/base/agent-log-modal/result.tsx
@@ -32,7 +32,7 @@ const ResultPanel: FC<ResultPanelProps> = ({
tools,
iterations,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'appLog', 'runLog'])
const { formatTime } = useTimestamp()
return (
diff --git a/web/app/components/base/alert.tsx b/web/app/components/base/alert.tsx
index a89d52aa414..bcf044b5bcf 100644
--- a/web/app/components/base/alert.tsx
+++ b/web/app/components/base/alert.tsx
@@ -17,7 +17,7 @@ const bgVariants = cva('', {
},
})
const Alert: React.FC<Props> = ({ type = 'info', message, onHide, className }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className={cn('pointer-events-none w-full', className)}>
diff --git a/web/app/components/base/app-icon-picker/ImageInput.tsx b/web/app/components/base/app-icon-picker/ImageInput.tsx
index 860429f1994..6506645e605 100644
--- a/web/app/components/base/app-icon-picker/ImageInput.tsx
+++ b/web/app/components/base/app-icon-picker/ImageInput.tsx
@@ -22,7 +22,7 @@ type UploaderProps = {
}
const ImageInput: FC<UploaderProps> = ({ className, cropShape, onImageInput }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [inputImage, setInputImage] = useState<{ file: File; url: string }>()
const [isAnimatedImage, setIsAnimatedImage] = useState<boolean>(false)
useEffect(() => {
diff --git a/web/app/components/base/app-icon-picker/index.tsx b/web/app/components/base/app-icon-picker/index.tsx
index c87ffd44578..3bdb30a5fba 100644
--- a/web/app/components/base/app-icon-picker/index.tsx
+++ b/web/app/components/base/app-icon-picker/index.tsx
@@ -89,7 +89,7 @@ function AppIconPickerContent({
onOpenChange,
onSelect,
}: AppIconPickerContentProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const tabs = [
{
diff --git a/web/app/components/base/app-unavailable.tsx b/web/app/components/base/app-unavailable.tsx
index 0a5d1511cf3..0ae257ca445 100644
--- a/web/app/components/base/app-unavailable.tsx
+++ b/web/app/components/base/app-unavailable.tsx
@@ -17,7 +17,7 @@ const AppUnavailable: FC<IAppUnavailableProps> = ({
unknownReason,
className,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
return (
<div className={cn('flex h-screen w-screen items-center justify-center', className)}>
diff --git a/web/app/components/base/audio-gallery/AudioPlayer.tsx b/web/app/components/base/audio-gallery/AudioPlayer.tsx
index a4718c3b469..c363ac91d4a 100644
--- a/web/app/components/base/audio-gallery/AudioPlayer.tsx
+++ b/web/app/components/base/audio-gallery/AudioPlayer.tsx
@@ -11,7 +11,7 @@ type AudioPlayerProps = Readonly<{
srcs?: string[] // Support multiple sources
}>
const AudioPlayer: React.FC<AudioPlayerProps> = ({ src, srcs }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [isPlaying, setIsPlaying] = useState(false)
const [currentTime, setCurrentTime] = useState(0)
const [duration, setDuration] = useState(0)
diff --git a/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx b/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx
index 8459acdc922..3c91652fd22 100644
--- a/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx
+++ b/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx
@@ -30,7 +30,7 @@ import { getLastAnswer, isValidGeneratedAnswer } from '../utils'
import { useChatWithHistoryContext } from './context'
const ChatWrapper = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
const {
appParams,
appPrevChatTree,
diff --git a/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx b/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx
index d8b9b471eb6..b7a5f6ce8a1 100644
--- a/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx
+++ b/web/app/components/base/chat/chat-with-history/header-in-mobile.tsx
@@ -43,7 +43,7 @@ const HeaderInMobile = () => {
conversationRenaming,
inputsForms,
} = useChatWithHistoryContext()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'layout', 'share'])
const isPin = pinnedConversationList.some((item) => item.id === currentConversationId)
const [showConfirm, setShowConfirm] = useState<ConversationItem | null>(null)
const [showRename, setShowRename] = useState<ConversationItem | null>(null)
diff --git a/web/app/components/base/chat/chat-with-history/header/index.tsx b/web/app/components/base/chat/chat-with-history/header/index.tsx
index 5447484cf07..922cc42e8c7 100644
--- a/web/app/components/base/chat/chat-with-history/header/index.tsx
+++ b/web/app/components/base/chat/chat-with-history/header/index.tsx
@@ -38,7 +38,7 @@ const Header = ({ toggleButtonRef }: { toggleButtonRef?: Ref<HTMLButtonElement>
handleSidebarCollapse,
isResponding,
} = useChatWithHistoryContext()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'layout', 'share'])
const isSidebarCollapsed = sidebarCollapseState
const isPin = pinnedConversationList.some((item) => item.id === currentConversationId)
diff --git a/web/app/components/base/chat/chat-with-history/header/mobile-operation-dropdown.tsx b/web/app/components/base/chat/chat-with-history/header/mobile-operation-dropdown.tsx
index 568d45fdc81..29404d4b7a3 100644
--- a/web/app/components/base/chat/chat-with-history/header/mobile-operation-dropdown.tsx
+++ b/web/app/components/base/chat/chat-with-history/header/mobile-operation-dropdown.tsx
@@ -18,7 +18,7 @@ const MobileOperationDropdown = ({
handleViewChatSettings,
hideViewChatSettings = false,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'share'])
const handleMenuAction = (callback: () => void) => {
queueMicrotask(callback)
}
diff --git a/web/app/components/base/chat/chat-with-history/header/operation.tsx b/web/app/components/base/chat/chat-with-history/header/operation.tsx
index 39e9f85d62f..2cb22a28f6f 100644
--- a/web/app/components/base/chat/chat-with-history/header/operation.tsx
+++ b/web/app/components/base/chat/chat-with-history/header/operation.tsx
@@ -32,7 +32,7 @@ const Operation: FC<Props> = ({
isShowDelete,
onDelete,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['explore'])
return (
<DropdownMenu>
diff --git a/web/app/components/base/chat/chat-with-history/hooks.tsx b/web/app/components/base/chat/chat-with-history/hooks.tsx
index c39b263122d..881bb1b965f 100644
--- a/web/app/components/base/chat/chat-with-history/hooks.tsx
+++ b/web/app/components/base/chat/chat-with-history/hooks.tsx
@@ -263,7 +263,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledAppResponse) => {
const pinnedConversationList = useMemo(() => {
return appPinnedConversationData?.data || []
}, [appPinnedConversationData])
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'share'])
const newConversationInputsRef = useRef<Record<string, any>>({})
const [newConversationInputs, setNewConversationInputs] = useState<Record<string, any>>({})
const [initInputs, setInitInputs] = useState<Record<string, any>>({})
diff --git a/web/app/components/base/chat/chat-with-history/inputs-form/content.tsx b/web/app/components/base/chat/chat-with-history/inputs-form/content.tsx
index 8edb52a96e3..cd63613b2d5 100644
--- a/web/app/components/base/chat/chat-with-history/inputs-form/content.tsx
+++ b/web/app/components/base/chat/chat-with-history/inputs-form/content.tsx
@@ -24,7 +24,7 @@ type Props = Readonly<{
}>
const InputsFormContent = ({ showTip }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share', 'workflow'])
const baseId = useId()
const {
appParams,
diff --git a/web/app/components/base/chat/chat-with-history/inputs-form/index.tsx b/web/app/components/base/chat/chat-with-history/inputs-form/index.tsx
index 97576b6d929..40eaf6b3c01 100644
--- a/web/app/components/base/chat/chat-with-history/inputs-form/index.tsx
+++ b/web/app/components/base/chat/chat-with-history/inputs-form/index.tsx
@@ -12,7 +12,7 @@ type Props = Readonly<{
}>
const InputsFormNode = ({ collapsed, setCollapsed }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'share'])
const { isMobile, currentConversationId, handleStartChat, allInputsHidden, theme, inputsForms } =
useChatWithHistoryContext()
diff --git a/web/app/components/base/chat/chat-with-history/inputs-form/view-form-dropdown.tsx b/web/app/components/base/chat/chat-with-history/inputs-form/view-form-dropdown.tsx
index de92e60c198..cb37c562d8c 100644
--- a/web/app/components/base/chat/chat-with-history/inputs-form/view-form-dropdown.tsx
+++ b/web/app/components/base/chat/chat-with-history/inputs-form/view-form-dropdown.tsx
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'
import InputsFormContent from '@/app/components/base/chat/chat-with-history/inputs-form/content'
const ViewFormDropdown = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
return (
<Popover>
<PopoverTrigger
diff --git a/web/app/components/base/chat/chat-with-history/sidebar/index.tsx b/web/app/components/base/chat/chat-with-history/sidebar/index.tsx
index 9916da3e7d5..5acf89ae58c 100644
--- a/web/app/components/base/chat/chat-with-history/sidebar/index.tsx
+++ b/web/app/components/base/chat/chat-with-history/sidebar/index.tsx
@@ -30,7 +30,7 @@ type Props = Readonly<{
}>
const Sidebar = ({ isPanel, toggleButtonRef }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'layout', 'share'])
const {
isInstalledApp,
appData,
diff --git a/web/app/components/base/chat/chat-with-history/sidebar/operation.tsx b/web/app/components/base/chat/chat-with-history/sidebar/operation.tsx
index bbe2b5070d6..b9194e3e7a0 100644
--- a/web/app/components/base/chat/chat-with-history/sidebar/operation.tsx
+++ b/web/app/components/base/chat/chat-with-history/sidebar/operation.tsx
@@ -33,7 +33,7 @@ const Operation: FC<Props> = ({
isShowDelete,
onDelete,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'explore'])
const handleDeferredAction = useCallback((action?: () => void) => {
if (!action) return
queueMicrotask(action)
diff --git a/web/app/components/base/chat/chat-with-history/sidebar/rename-modal.tsx b/web/app/components/base/chat/chat-with-history/sidebar/rename-modal.tsx
index 6a44415f374..b7ba386d92f 100644
--- a/web/app/components/base/chat/chat-with-history/sidebar/rename-modal.tsx
+++ b/web/app/components/base/chat/chat-with-history/sidebar/rename-modal.tsx
@@ -18,7 +18,7 @@ type IRenameModalProps = {
}
const RenameModal: FC<IRenameModalProps> = ({ isShow, saveLoading, name, onClose, onSave }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [tempName, setTempName] = useState(name)
const conversationNamePlaceholder =
t(($) => $['chat.conversationNamePlaceholder'], { ns: 'common' }) || ''
diff --git a/web/app/components/base/chat/chat/answer/agent-roster-response-content.tsx b/web/app/components/base/chat/chat/answer/agent-roster-response-content.tsx
index c2ea6e10755..d916af14325 100644
--- a/web/app/components/base/chat/chat/answer/agent-roster-response-content.tsx
+++ b/web/app/components/base/chat/chat/answer/agent-roster-response-content.tsx
@@ -4,6 +4,7 @@ import type { Locale } from '@/i18n'
import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from '@langgenius/dify-ui/collapsible'
import { useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
+import { useLocale } from '#i18n'
import { FileList } from '@/app/components/base/file-uploader'
import { Markdown } from '@/app/components/base/markdown'
import { getPluginLanguage, renderI18nObject } from '@/i18n/metadata'
@@ -178,7 +179,7 @@ function ResponseMessage({ content }: { content: string }) {
}
function ToolActivityItem({ tool }: { tool: ToolActivity }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['agentV2', 'tools'])
const hasDetails = !!tool.input || !!tool.output
const label =
tool.name === 'shell_run' && tool.label === tool.name
@@ -260,8 +261,8 @@ function AgentActivityItem({
thought: ThoughtItem
responding?: boolean
}) {
- const { i18n } = useTranslation()
- const tools = getToolActivities(thought, i18n.language, responding)
+ const locale = useLocale()
+ const tools = getToolActivities(thought, locale, responding)
return (
<div className="flex w-full max-w-full min-w-0 flex-col py-0.5">
@@ -292,7 +293,7 @@ function AgentActivityDisclosure({
responding?: boolean
defaultOpen?: boolean
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const workingDuration = useWorkingDuration(responding)
const latency = Number(item.more?.latency)
const duration = responding
diff --git a/web/app/components/base/chat/chat/answer/human-input-content/content-wrapper.tsx b/web/app/components/base/chat/chat/answer/human-input-content/content-wrapper.tsx
index c20ba265a39..f047f952270 100644
--- a/web/app/components/base/chat/chat/answer/human-input-content/content-wrapper.tsx
+++ b/web/app/components/base/chat/chat/answer/human-input-content/content-wrapper.tsx
@@ -19,7 +19,7 @@ const ContentWrapper = ({
className,
expanded = false,
}: ContentWrapperProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
const [isExpanded, setIsExpanded] = useState(expanded)
const handleToggleExpand = useCallback(() => {
diff --git a/web/app/components/base/chat/chat/answer/human-input-content/expiration-time.tsx b/web/app/components/base/chat/chat/answer/human-input-content/expiration-time.tsx
index 5d0e9bf98fd..6518ab396f0 100644
--- a/web/app/components/base/chat/chat/answer/human-input-content/expiration-time.tsx
+++ b/web/app/components/base/chat/chat/answer/human-input-content/expiration-time.tsx
@@ -9,7 +9,7 @@ type ExpirationTimeProps = {
}
const ExpirationTime = ({ expirationTime }: ExpirationTimeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
const locale = useLocale()
const relativeTime = getRelativeTime(expirationTime, locale)
const isSameOrAfter = isRelativeTimeSameOrAfter(expirationTime)
diff --git a/web/app/components/base/chat/chat/answer/human-input-content/tips.tsx b/web/app/components/base/chat/chat/answer/human-input-content/tips.tsx
index e20b8df03d8..fd298343d0e 100644
--- a/web/app/components/base/chat/chat/answer/human-input-content/tips.tsx
+++ b/web/app/components/base/chat/chat/answer/human-input-content/tips.tsx
@@ -29,7 +29,7 @@ const EmailDebugTip = () => {
}
const Tips = ({ showEmailTip, isEmailDebugMode, showDebugModeTip }: TipsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<>
diff --git a/web/app/components/base/chat/chat/answer/index.tsx b/web/app/components/base/chat/chat/answer/index.tsx
index f39eca3d619..60b4f536878 100644
--- a/web/app/components/base/chat/chat/answer/index.tsx
+++ b/web/app/components/base/chat/chat/answer/index.tsx
@@ -63,7 +63,7 @@ const Answer: FC<AnswerProps> = ({
renderAgentContent,
onHumanInputFormSubmit,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation'])
const {
content,
citation,
diff --git a/web/app/components/base/chat/chat/answer/more.tsx b/web/app/components/base/chat/chat/answer/more.tsx
index 952c2f3ad91..4afdb9015cd 100644
--- a/web/app/components/base/chat/chat/answer/more.tsx
+++ b/web/app/components/base/chat/chat/answer/more.tsx
@@ -8,7 +8,7 @@ type MoreProps = {
more: ChatItem['more']
}
const More: FC<MoreProps> = ({ more }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog'])
return (
<div
diff --git a/web/app/components/base/chat/chat/answer/operation.tsx b/web/app/components/base/chat/chat/answer/operation.tsx
index 05db31c0633..0a7035a304c 100644
--- a/web/app/components/base/chat/chat/answer/operation.tsx
+++ b/web/app/components/base/chat/chat/answer/operation.tsx
@@ -90,7 +90,7 @@ function Operation({
hasWorkflowProcess,
noChatInput,
}: OperationProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common'])
const {
config,
onAnnotationAdded,
diff --git a/web/app/components/base/chat/chat/answer/tool-detail.tsx b/web/app/components/base/chat/chat/answer/tool-detail.tsx
index 662846a1d13..52a6ef0504e 100644
--- a/web/app/components/base/chat/chat/answer/tool-detail.tsx
+++ b/web/app/components/base/chat/chat/answer/tool-detail.tsx
@@ -8,7 +8,7 @@ type ToolDetailProps = {
payload: ToolInfoInThought
}
const ToolDetail = ({ payload }: ToolDetailProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset', 'tools'])
const { name, label, input, isFinished, output } = payload
const toolLabel = name.startsWith('dataset_') ? t(($) => $.knowledge, { ns: 'dataset' }) : label
const [expand, setExpand] = useState(false)
diff --git a/web/app/components/base/chat/chat/answer/workflow-process.tsx b/web/app/components/base/chat/chat/answer/workflow-process.tsx
index 91d988ff118..807a0528286 100644
--- a/web/app/components/base/chat/chat/answer/workflow-process.tsx
+++ b/web/app/components/base/chat/chat/answer/workflow-process.tsx
@@ -20,7 +20,7 @@ const WorkflowProcessItem = ({
hideProcessDetail = false,
readonly = false,
}: WorkflowProcessProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [collapse, setCollapse] = useState(!expand)
const running = data.status === WorkflowRunningStatus.Running
const succeeded = data.status === WorkflowRunningStatus.Succeeded
diff --git a/web/app/components/base/chat/chat/chat-input-area/index.tsx b/web/app/components/base/chat/chat/chat-input-area/index.tsx
index 240fb7b5ae3..279ca210b2e 100644
--- a/web/app/components/base/chat/chat/chat-input-area/index.tsx
+++ b/web/app/components/base/chat/chat/chat-input-area/index.tsx
@@ -88,7 +88,7 @@ const ChatInputArea = ({
}: ChatInputAreaProps) => {
const footerNoticeLabelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const {
wrapperRef,
textareaRef,
diff --git a/web/app/components/base/chat/chat/chat-input-area/operation.tsx b/web/app/components/base/chat/chat/chat-input-area/operation.tsx
index 3cb1cfbcdbd..0d54f15cd04 100644
--- a/web/app/components/base/chat/chat/chat-input-area/operation.tsx
+++ b/web/app/components/base/chat/chat/chat-input-area/operation.tsx
@@ -33,7 +33,7 @@ const Operation: FC<OperationProps> = ({
disabled,
theme,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className={cn('flex shrink-0 items-center justify-end')}>
diff --git a/web/app/components/base/chat/chat/check-input-forms-hooks.ts b/web/app/components/base/chat/chat/check-input-forms-hooks.ts
index 3237a0d804f..8348581d3cf 100644
--- a/web/app/components/base/chat/chat/check-input-forms-hooks.ts
+++ b/web/app/components/base/chat/chat/check-input-forms-hooks.ts
@@ -6,7 +6,7 @@ import { toast } from '@/app/notifications'
import { TransferMethod } from '@/types/app'
export const useCheckInputsForms = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const checkInputsForm = useCallback(
(inputs: Record<string, any>, inputsForm: InputForm[]) => {
let hasEmptyInput = ''
diff --git a/web/app/components/base/chat/chat/citation/index.tsx b/web/app/components/base/chat/chat/citation/index.tsx
index 8053e79f9b1..f885439edc1 100644
--- a/web/app/components/base/chat/chat/citation/index.tsx
+++ b/web/app/components/base/chat/chat/citation/index.tsx
@@ -21,7 +21,7 @@ const Citation: FC<CitationProps> = ({
showHitInfo,
containerClassName = 'chat-answer-container',
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'share'])
const elesRef = useRef<HTMLDivElement[]>([])
const [limitNumberInOneLine, setLimitNumberInOneLine] = useState(0)
const [showMore, setShowMore] = useState(false)
diff --git a/web/app/components/base/chat/chat/citation/popup.tsx b/web/app/components/base/chat/chat/citation/popup.tsx
index ebe5a75bb87..1afd685ca49 100644
--- a/web/app/components/base/chat/chat/citation/popup.tsx
+++ b/web/app/components/base/chat/chat/citation/popup.tsx
@@ -16,7 +16,7 @@ type PopupProps = {
}
const Popup: FC<PopupProps> = ({ data, showHitInfo = false }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const fileType =
data.dataSourceType !== 'notion' ? /\.([^.]*)$/.exec(data.documentName)?.[1] || '' : 'notion'
diff --git a/web/app/components/base/chat/chat/citation/progress-tooltip.tsx b/web/app/components/base/chat/chat/citation/progress-tooltip.tsx
index b941a6c7bb2..8fca1459771 100644
--- a/web/app/components/base/chat/chat/citation/progress-tooltip.tsx
+++ b/web/app/components/base/chat/chat/citation/progress-tooltip.tsx
@@ -7,7 +7,7 @@ type ProgressTooltipProps = {
}
const ProgressTooltip: FC<ProgressTooltipProps> = ({ data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<Tooltip>
diff --git a/web/app/components/base/chat/chat/hooks.ts b/web/app/components/base/chat/chat/hooks.ts
index 5bd16f0b853..145bfd3b8fe 100644
--- a/web/app/components/base/chat/chat/hooks.ts
+++ b/web/app/components/base/chat/chat/hooks.ts
@@ -198,7 +198,7 @@ export const useChat = (
initialConversationId?: string,
options: UseChatOptions = {},
) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const { formatTime } = useTimestamp({ timezone: options.timezone })
const conversationIdRef = useRef(initialConversationId ?? '')
const initialConversationIdRef = useRef(initialConversationId ?? '')
diff --git a/web/app/components/base/chat/chat/index.tsx b/web/app/components/base/chat/chat/index.tsx
index 7c3d0a41778..799e8e61f73 100644
--- a/web/app/components/base/chat/chat/index.tsx
+++ b/web/app/components/base/chat/chat/index.tsx
@@ -146,7 +146,7 @@ const Chat: FC<ChatProps> = ({
onHumanInputFormSubmit,
getHumanInputNodeData,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['agentV2', 'appDebug'])
const responseStatusRef = useRef<HTMLDivElement>(null)
const wasRespondingRef = useRef(false)
const hasAgentContent = !!renderAgentContent
diff --git a/web/app/components/base/chat/chat/log/index.tsx b/web/app/components/base/chat/chat/log/index.tsx
index 887bbe6ddd1..665deca1853 100644
--- a/web/app/components/base/chat/chat/log/index.tsx
+++ b/web/app/components/base/chat/chat/log/index.tsx
@@ -9,7 +9,7 @@ type LogProps = {
logItem: IChatItem
}
const Log: FC<LogProps> = ({ logItem }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const setCurrentLogItem = useAppStore((s) => s.setCurrentLogItem)
const setShowPromptLogModal = useAppStore((s) => s.setShowPromptLogModal)
const setShowAgentLogModal = useAppStore((s) => s.setShowAgentLogModal)
diff --git a/web/app/components/base/chat/chat/question.tsx b/web/app/components/base/chat/chat/question.tsx
index df6e57e34a8..c14b77c3ef7 100644
--- a/web/app/components/base/chat/chat/question.tsx
+++ b/web/app/components/base/chat/chat/question.tsx
@@ -32,7 +32,7 @@ const Question: FC<QuestionProps> = ({
switchSibling,
hideAvatar,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { content, message_files } = item
diff --git a/web/app/components/base/chat/chat/try-to-ask.tsx b/web/app/components/base/chat/chat/try-to-ask.tsx
index ce2862846c6..8a498ddc213 100644
--- a/web/app/components/base/chat/chat/try-to-ask.tsx
+++ b/web/app/components/base/chat/chat/try-to-ask.tsx
@@ -10,7 +10,7 @@ type TryToAskProps = {
onSend: OnSend
}
const TryToAsk: FC<TryToAskProps> = ({ suggestedQuestions, onSend }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
return (
<div className="mb-2 py-2">
diff --git a/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx b/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx
index 6dbc9dd2fd6..1a8bf16e50b 100644
--- a/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx
+++ b/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx
@@ -30,7 +30,7 @@ import { useEmbeddedChatbotContext } from './context'
import { isDify } from './utils'
const ChatWrapper = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
const {
appData,
appParams,
diff --git a/web/app/components/base/chat/embedded-chatbot/header/index.tsx b/web/app/components/base/chat/embedded-chatbot/header/index.tsx
index b48510d1c6f..574a996a690 100644
--- a/web/app/components/base/chat/embedded-chatbot/header/index.tsx
+++ b/web/app/components/base/chat/embedded-chatbot/header/index.tsx
@@ -31,7 +31,7 @@ const Header: FC<IHeaderProps> = ({
theme,
onCreateNewChat,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
const { appData, currentConversationId, inputsForms, allInputsHidden } =
useEmbeddedChatbotContext()
diff --git a/web/app/components/base/chat/embedded-chatbot/hooks.tsx b/web/app/components/base/chat/embedded-chatbot/hooks.tsx
index 4cb7a2cd050..bda9ecc6db0 100644
--- a/web/app/components/base/chat/embedded-chatbot/hooks.tsx
+++ b/web/app/components/base/chat/embedded-chatbot/hooks.tsx
@@ -164,7 +164,7 @@ export const useEmbeddedChatbot = (appSourceType: AppSourceType, tryAppId?: stri
const pinnedConversationList = useMemo(() => {
return appPinnedConversationData?.data || []
}, [appPinnedConversationData])
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'share'])
const newConversationInputsRef = useRef<Record<string, any>>({})
const [newConversationInputs, setNewConversationInputs] = useState<Record<string, any>>({})
const [initInputs, setInitInputs] = useState<Record<string, any>>({})
diff --git a/web/app/components/base/chat/embedded-chatbot/index.tsx b/web/app/components/base/chat/embedded-chatbot/index.tsx
index 446322be7e6..cbb13e1a6c6 100644
--- a/web/app/components/base/chat/embedded-chatbot/index.tsx
+++ b/web/app/components/base/chat/embedded-chatbot/index.tsx
@@ -28,7 +28,7 @@ const Chatbot = () => {
handleNewConversation,
theme,
} = useEmbeddedChatbotContext()
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const site = appData?.site
diff --git a/web/app/components/base/chat/embedded-chatbot/inputs-form/content.tsx b/web/app/components/base/chat/embedded-chatbot/inputs-form/content.tsx
index 0b820fe5ef5..1a9a45cfe78 100644
--- a/web/app/components/base/chat/embedded-chatbot/inputs-form/content.tsx
+++ b/web/app/components/base/chat/embedded-chatbot/inputs-form/content.tsx
@@ -24,7 +24,7 @@ type Props = Readonly<{
}>
const InputsFormContent = ({ showTip }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share', 'workflow'])
const baseId = useId()
const {
appParams,
diff --git a/web/app/components/base/chat/embedded-chatbot/inputs-form/index.tsx b/web/app/components/base/chat/embedded-chatbot/inputs-form/index.tsx
index 10f75074807..a3739672912 100644
--- a/web/app/components/base/chat/embedded-chatbot/inputs-form/index.tsx
+++ b/web/app/components/base/chat/embedded-chatbot/inputs-form/index.tsx
@@ -13,7 +13,7 @@ type Props = Readonly<{
}>
const InputsFormNode = ({ collapsed, setCollapsed }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'share'])
const {
appSourceType,
isMobile,
diff --git a/web/app/components/base/chat/embedded-chatbot/inputs-form/view-form-dropdown.tsx b/web/app/components/base/chat/embedded-chatbot/inputs-form/view-form-dropdown.tsx
index 772de1b4b50..24c7afff537 100644
--- a/web/app/components/base/chat/embedded-chatbot/inputs-form/view-form-dropdown.tsx
+++ b/web/app/components/base/chat/embedded-chatbot/inputs-form/view-form-dropdown.tsx
@@ -10,7 +10,7 @@ type Props = Readonly<{
}>
const ViewFormDropdown = ({ iconColor }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
return (
<Popover>
<PopoverTrigger
diff --git a/web/app/components/base/checkbox-list/index.tsx b/web/app/components/base/checkbox-list/index.tsx
index aacb01316c4..201a0b0fea4 100644
--- a/web/app/components/base/checkbox-list/index.tsx
+++ b/web/app/components/base/checkbox-list/index.tsx
@@ -54,7 +54,7 @@ export const CheckboxList = ({
showSearch = true,
maxHeight,
}: CheckboxListProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [searchQuery, setSearchQuery] = useState('')
const filteredOptions = useMemo(() => {
diff --git a/web/app/components/base/chip/index.tsx b/web/app/components/base/chip/index.tsx
index 239e1509f42..8ff5f1066a7 100644
--- a/web/app/components/base/chip/index.tsx
+++ b/web/app/components/base/chip/index.tsx
@@ -44,7 +44,7 @@ function Chip<T extends ItemValue>({
onSelect,
onClear,
}: Props<T>) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const selectedItem = items.find((item) => Object.is(item.value, value))
const triggerContent = selectedItem?.triggerName || selectedItem?.name || ''
const hasValue = selectedItem !== undefined && value !== ''
diff --git a/web/app/components/base/copy-feedback/index.tsx b/web/app/components/base/copy-feedback/index.tsx
index e748ce21710..47c4d959eb3 100644
--- a/web/app/components/base/copy-feedback/index.tsx
+++ b/web/app/components/base/copy-feedback/index.tsx
@@ -21,7 +21,7 @@ export function CopyFeedback({
copyLabel,
onCopyError,
}: CopyFeedbackProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
// Rely on useClipboard's own timer to flip `copied` back to false so the
// "Copied" tooltip stays visible long enough to be read, matching the
// KeyValueItem pattern. Do NOT reset on mouse leave.
diff --git a/web/app/components/base/copy-icon/index.tsx b/web/app/components/base/copy-icon/index.tsx
index 59b6067b0eb..f6b6f5ee93b 100644
--- a/web/app/components/base/copy-icon/index.tsx
+++ b/web/app/components/base/copy-icon/index.tsx
@@ -11,7 +11,7 @@ type Props = Readonly<{
const prefixEmbedded = 'overview.appInfo.embedded'
const CopyIcon = ({ content }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview'])
const { copied, copy, reset } = useClipboard()
const handleCopy = useCallback(() => {
diff --git a/web/app/components/base/date-and-time-picker/calendar/item.tsx b/web/app/components/base/date-and-time-picker/calendar/item.tsx
index 06b93ca417e..6639cea4caf 100644
--- a/web/app/components/base/date-and-time-picker/calendar/item.tsx
+++ b/web/app/components/base/date-and-time-picker/calendar/item.tsx
@@ -8,7 +8,7 @@ import dayjs from '../utils/dayjs'
const Item: FC<CalendarItemProps> = ({ day, selectedDate, onClick, isDisabled }) => {
const locale = useLocale()
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const selectedDescriptionId = React.useId()
const { date, isCurrentMonth } = day
const isSelected = selectedDate?.isSame(date, 'date')
diff --git a/web/app/components/base/date-and-time-picker/date-picker/footer.tsx b/web/app/components/base/date-and-time-picker/date-picker/footer.tsx
index 00975777740..849335d11e8 100644
--- a/web/app/components/base/date-and-time-picker/date-picker/footer.tsx
+++ b/web/app/components/base/date-and-time-picker/date-picker/footer.tsx
@@ -15,7 +15,7 @@ const Footer: FC<DatePickerFooterProps> = ({
handleSelectCurrentDate,
handleConfirmDate,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['time'])
return (
<div
diff --git a/web/app/components/base/date-and-time-picker/date-picker/index.tsx b/web/app/components/base/date-and-time-picker/date-picker/index.tsx
index 029a3210f1e..dda231b7211 100644
--- a/web/app/components/base/date-and-time-picker/date-picker/index.tsx
+++ b/web/app/components/base/date-and-time-picker/date-picker/index.tsx
@@ -36,7 +36,7 @@ const DatePicker = ({
noConfirm,
getIsDateDisabled,
}: DatePickerProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'time'])
const [isOpen, setIsOpen] = useState(false)
const [view, setView] = useState<ViewType>(ViewType.date)
const dateConfirmationViews: readonly ViewType[] = [ViewType.date, ViewType.time]
diff --git a/web/app/components/base/date-and-time-picker/date-range-picker/index.tsx b/web/app/components/base/date-and-time-picker/date-range-picker/index.tsx
index 5dda95a3117..05105b825f5 100644
--- a/web/app/components/base/date-and-time-picker/date-range-picker/index.tsx
+++ b/web/app/components/base/date-and-time-picker/date-range-picker/index.tsx
@@ -42,7 +42,7 @@ const DateRangePicker: FC<DateRangePickerProps> = ({
getIsEndDateDisabled,
className,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const locale = useLocale()
const renderDate = (
diff --git a/web/app/components/base/date-and-time-picker/hooks.ts b/web/app/components/base/date-and-time-picker/hooks.ts
index 58db75cea6e..1df105bb936 100644
--- a/web/app/components/base/date-and-time-picker/hooks.ts
+++ b/web/app/components/base/date-and-time-picker/hooks.ts
@@ -7,7 +7,7 @@ const YEAR_RANGE = 100
const daysInWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] as const
export const useDaysOfWeek = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['time'])
return daysInWeek.map((day) => t(($) => $[`daysInWeek.${day}`], { ns: 'time' }))
}
@@ -27,7 +27,7 @@ const monthNames = [
] as const
export const useMonths = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['time'])
return monthNames.map((month) => t(($) => $[`months.${month}`], { ns: 'time' }))
}
diff --git a/web/app/components/base/date-and-time-picker/time-picker/footer.tsx b/web/app/components/base/date-and-time-picker/time-picker/footer.tsx
index fd2b7b7a4a8..4637371ea06 100644
--- a/web/app/components/base/date-and-time-picker/time-picker/footer.tsx
+++ b/web/app/components/base/date-and-time-picker/time-picker/footer.tsx
@@ -5,7 +5,7 @@ import * as React from 'react'
import { useTranslation } from 'react-i18next'
const Footer: FC<TimePickerFooterProps> = ({ handleSelectCurrentTime, handleConfirm }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['time'])
return (
<div className="flex items-center justify-between border-t-[0.5px] border-divider-regular p-2">
diff --git a/web/app/components/base/date-and-time-picker/time-picker/header.tsx b/web/app/components/base/date-and-time-picker/time-picker/header.tsx
index defd3aa699a..0204ff293da 100644
--- a/web/app/components/base/date-and-time-picker/time-picker/header.tsx
+++ b/web/app/components/base/date-and-time-picker/time-picker/header.tsx
@@ -5,7 +5,7 @@ type Props = Readonly<{
title?: string
}>
const Header = ({ title }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['time'])
return (
<div className="flex flex-col border-b-[0.5px] border-divider-regular">
diff --git a/web/app/components/base/date-and-time-picker/time-picker/index.tsx b/web/app/components/base/date-and-time-picker/time-picker/index.tsx
index 5b76c54c73b..69cf18c530f 100644
--- a/web/app/components/base/date-and-time-picker/time-picker/index.tsx
+++ b/web/app/components/base/date-and-time-picker/time-picker/index.tsx
@@ -31,7 +31,7 @@ const TimePicker = ({
triggerFullWidth = false,
showTimezone = false,
}: TimePickerProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'time'])
const [isOpen, setIsOpen] = useState(false)
const isInitialRef = useRef(true)
diff --git a/web/app/components/base/date-and-time-picker/year-and-month-picker/footer.tsx b/web/app/components/base/date-and-time-picker/year-and-month-picker/footer.tsx
index a8325fcfb28..5d20011d5ba 100644
--- a/web/app/components/base/date-and-time-picker/year-and-month-picker/footer.tsx
+++ b/web/app/components/base/date-and-time-picker/year-and-month-picker/footer.tsx
@@ -8,7 +8,7 @@ const Footer: FC<YearAndMonthPickerFooterProps> = ({
handleYearMonthCancel,
handleYearMonthConfirm,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['time'])
return (
<div className="grid grid-cols-2 gap-x-1 p-2">
diff --git a/web/app/components/base/emoji-picker/Inner.tsx b/web/app/components/base/emoji-picker/Inner.tsx
index 4feeda8108b..cb0a4769155 100644
--- a/web/app/components/base/emoji-picker/Inner.tsx
+++ b/web/app/components/base/emoji-picker/Inner.tsx
@@ -54,7 +54,7 @@ const listComponents: NonNullable<React.ComponentProps<typeof EmojiPicker.List>[
}
function EmojiPickerInner({ emoji, background, onSelect, className }: IEmojiPickerInnerProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const [search, setSearch] = useState('')
const scrollRef = useRef<HTMLDivElement>(null)
const recentEmojis = useRecentEmojisValue()
diff --git a/web/app/components/base/emoji-picker/index.tsx b/web/app/components/base/emoji-picker/index.tsx
index fe00163f1f2..a5522e32f85 100644
--- a/web/app/components/base/emoji-picker/index.tsx
+++ b/web/app/components/base/emoji-picker/index.tsx
@@ -33,7 +33,7 @@ type EmojiPickerContentProps = {
}
function EmojiPickerContent({ className, onOpenChange, onSelect }: EmojiPickerContentProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const [selectedEmoji, setSelectedEmoji] = useState('')
const [selectedBackground, setSelectedBackground] = useState(defaultEmojiBackground)
const [, setRecentEmojis] = useRecentEmojis()
diff --git a/web/app/components/base/encrypted-bottom/index.tsx b/web/app/components/base/encrypted-bottom/index.tsx
index 3b484499030..ce86d3a61b9 100644
--- a/web/app/components/base/encrypted-bottom/index.tsx
+++ b/web/app/components/base/encrypted-bottom/index.tsx
@@ -16,7 +16,7 @@ const DEFAULT_FRONT_KEY: EncryptedKey = 'provider.encrypted.front'
const DEFAULT_BACK_KEY: EncryptedKey = 'provider.encrypted.back'
export const EncryptedBottom = (props: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { frontTextKey = DEFAULT_FRONT_KEY, backTextKey = DEFAULT_BACK_KEY, className } = props
return (
diff --git a/web/app/components/base/error-boundary/index.tsx b/web/app/components/base/error-boundary/index.tsx
index f71f9341c55..0c30e9a8cff 100644
--- a/web/app/components/base/error-boundary/index.tsx
+++ b/web/app/components/base/error-boundary/index.tsx
@@ -189,7 +189,7 @@ class ErrorBoundaryInner extends React.Component<
// Main functional component wrapper
const ErrorBoundary: React.FC<ErrorBoundaryProps> = (props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [errorBoundaryKey, setErrorBoundaryKey] = useState(0)
const resetKeysRef = useRef(props.resetKeys)
const prevResetKeysRef = useRef<Array<string | number> | undefined>(undefined)
diff --git a/web/app/components/base/features/new-feature-panel/annotation-reply/annotation-ctrl-button.tsx b/web/app/components/base/features/new-feature-panel/annotation-reply/annotation-ctrl-button.tsx
index 80dce9ca088..af1203900ef 100644
--- a/web/app/components/base/features/new-feature-panel/annotation-reply/annotation-ctrl-button.tsx
+++ b/web/app/components/base/features/new-feature-panel/annotation-reply/annotation-ctrl-button.tsx
@@ -31,7 +31,7 @@ const AnnotationCtrlButton: FC<Props> = ({
onAdded,
onEdit,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const deploymentEdition = useAtomValue(deploymentEditionAtom)
const { data: annotationQuota } = useQuery(
consoleQuery.features.get.queryOptions({
diff --git a/web/app/components/base/features/new-feature-panel/annotation-reply/config-param-modal.tsx b/web/app/components/base/features/new-feature-panel/annotation-reply/config-param-modal.tsx
index b7d13a8a29c..a4a718563d5 100644
--- a/web/app/components/base/features/new-feature-panel/annotation-reply/config-param-modal.tsx
+++ b/web/app/components/base/features/new-feature-panel/annotation-reply/config-param-modal.tsx
@@ -35,7 +35,7 @@ const ConfigParamModal: FC<Props> = ({
isInit,
annotationConfig: oldAnnotationConfig,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appAnnotation', 'appDebug', 'common'])
const {
modelList: embeddingsModelList,
defaultModel: embeddingsDefaultModel,
diff --git a/web/app/components/base/features/new-feature-panel/annotation-reply/index.tsx b/web/app/components/base/features/new-feature-panel/annotation-reply/index.tsx
index 7a2315b5e6c..b0e5b10a6f0 100644
--- a/web/app/components/base/features/new-feature-panel/annotation-reply/index.tsx
+++ b/web/app/components/base/features/new-feature-panel/annotation-reply/index.tsx
@@ -22,7 +22,7 @@ type Props = Readonly<{
}>
const AnnotationReply = ({ disabled, onChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const pathname = usePathname()
const matched = /\/app\/([^/]+)/.exec(pathname)
const appId = matched?.length && matched[1] ? matched[1] : ''
diff --git a/web/app/components/base/features/new-feature-panel/annotation-reply/score-slider/index.tsx b/web/app/components/base/features/new-feature-panel/annotation-reply/score-slider/index.tsx
index 5a6781f0215..f170d00ed5f 100644
--- a/web/app/components/base/features/new-feature-panel/annotation-reply/score-slider/index.tsx
+++ b/web/app/components/base/features/new-feature-panel/annotation-reply/score-slider/index.tsx
@@ -27,7 +27,7 @@ const SCORE_MIN = 0
const SCORE_MAX = 100
const ScoreSlider: FC<Props> = ({ className, value, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const safeValue = clamp(value, SCORE_MIN, SCORE_MAX)
return (
diff --git a/web/app/components/base/features/new-feature-panel/citation.tsx b/web/app/components/base/features/new-feature-panel/citation.tsx
index e627cfa1b1b..7cce8a2e0d2 100644
--- a/web/app/components/base/features/new-feature-panel/citation.tsx
+++ b/web/app/components/base/features/new-feature-panel/citation.tsx
@@ -13,7 +13,7 @@ type Props = Readonly<{
}>
const Citation = ({ disabled, onChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const features = useFeatures((s) => s.features)
const featuresStore = useFeaturesStore()
diff --git a/web/app/components/base/features/new-feature-panel/conversation-opener/index.tsx b/web/app/components/base/features/new-feature-panel/conversation-opener/index.tsx
index f54b56fa6e9..f4613810817 100644
--- a/web/app/components/base/features/new-feature-panel/conversation-opener/index.tsx
+++ b/web/app/components/base/features/new-feature-panel/conversation-opener/index.tsx
@@ -27,7 +27,7 @@ const ConversationOpener = ({
workflowVariables,
onAutoAddPromptVariable,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const { setShowOpeningModal } = useModalContext()
const opening = useFeatures((s) => s.features.opening)
const featuresStore = useFeaturesStore()
diff --git a/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx b/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx
index 4d4bc4846cc..46c9a2d0ea1 100644
--- a/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx
+++ b/web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx
@@ -40,7 +40,7 @@ const OpeningSettingModal = ({
}: OpeningSettingModalProps) => {
const questionsLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const [tempValue, setTempValue] = useState(data?.opening_statement || '')
useEffect(() => {
// oxlint-disable-next-line eslint-react/set-state-in-effect
diff --git a/web/app/components/base/features/new-feature-panel/feature-bar.tsx b/web/app/components/base/features/new-feature-panel/feature-bar.tsx
index b64605b02aa..332812a1f4a 100644
--- a/web/app/components/base/features/new-feature-panel/feature-bar.tsx
+++ b/web/app/components/base/features/new-feature-panel/feature-bar.tsx
@@ -23,7 +23,7 @@ const FeatureBar = ({
onFeatureBarClick,
hideEditEntrance = false,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const features = useFeatures((s) => s.features)
const [modalOpen, setModalOpen] = useState(false)
diff --git a/web/app/components/base/features/new-feature-panel/file-upload/index.tsx b/web/app/components/base/features/new-feature-panel/file-upload/index.tsx
index 96e8bc43594..6e966d48048 100644
--- a/web/app/components/base/features/new-feature-panel/file-upload/index.tsx
+++ b/web/app/components/base/features/new-feature-panel/file-upload/index.tsx
@@ -16,7 +16,7 @@ type Props = Readonly<{
}>
const FileUpload = ({ disabled, onChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const file = useFeatures((s) => s.features.file)
const featuresStore = useFeaturesStore()
const [modalOpen, setModalOpen] = useState(false)
diff --git a/web/app/components/base/features/new-feature-panel/file-upload/setting-content.tsx b/web/app/components/base/features/new-feature-panel/file-upload/setting-content.tsx
index 10373949d31..fb88979c9b2 100644
--- a/web/app/components/base/features/new-feature-panel/file-upload/setting-content.tsx
+++ b/web/app/components/base/features/new-feature-panel/file-upload/setting-content.tsx
@@ -16,7 +16,7 @@ type SettingContentProps = {
onChange?: OnFeaturesChange
}
const SettingContent = ({ imageUpload, onClose, onChange }: SettingContentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const featuresStore = useFeaturesStore()
const file = useFeatures((state) => state.features.file)
const fileSettingPayload = useMemo(() => {
diff --git a/web/app/components/base/features/new-feature-panel/follow-up-setting-modal.tsx b/web/app/components/base/features/new-feature-panel/follow-up-setting-modal.tsx
index 708e23ef9a2..b0ebb3cf489 100644
--- a/web/app/components/base/features/new-feature-panel/follow-up-setting-modal.tsx
+++ b/web/app/components/base/features/new-feature-panel/follow-up-setting-modal.tsx
@@ -52,7 +52,7 @@ const PROMPT_MODE = {
type PromptMode = (typeof PROMPT_MODE)[keyof typeof PROMPT_MODE]
const FollowUpSettingModal = ({ data, onSave, onCancel }: FollowUpSettingModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const [model, setModel] = useState<Model>(() => getInitialModel(data.model))
const [prompt, setPrompt] = useState(data.prompt || '')
const [promptMode, setPromptMode] = useState<PromptMode>(
diff --git a/web/app/components/base/features/new-feature-panel/follow-up.tsx b/web/app/components/base/features/new-feature-panel/follow-up.tsx
index 91549af4236..16c243be8d8 100644
--- a/web/app/components/base/features/new-feature-panel/follow-up.tsx
+++ b/web/app/components/base/features/new-feature-panel/follow-up.tsx
@@ -19,7 +19,7 @@ type Props = Readonly<{
}>
const FollowUp = ({ disabled, onChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const suggested = useFeatures((s) => s.features.suggested)
const featuresStore = useFeaturesStore()
const [isHovering, setIsHovering] = useState(false)
diff --git a/web/app/components/base/features/new-feature-panel/image-upload/index.tsx b/web/app/components/base/features/new-feature-panel/image-upload/index.tsx
index 1f6785a89ab..5023e7059db 100644
--- a/web/app/components/base/features/new-feature-panel/image-upload/index.tsx
+++ b/web/app/components/base/features/new-feature-panel/image-upload/index.tsx
@@ -17,7 +17,7 @@ type Props = Readonly<{
}>
const FileUpload = ({ disabled, onChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const file = useFeatures((s) => s.features.file)
const featuresStore = useFeaturesStore()
const [modalOpen, setModalOpen] = useState(false)
diff --git a/web/app/components/base/features/new-feature-panel/index.tsx b/web/app/components/base/features/new-feature-panel/index.tsx
index 0a95c117ed6..d9e77fb3f4c 100644
--- a/web/app/components/base/features/new-feature-panel/index.tsx
+++ b/web/app/components/base/features/new-feature-panel/index.tsx
@@ -60,7 +60,7 @@ const NewFeaturePanel = ({
drawerClassName,
}: Props) => {
const [pricing] = useQueryState(pricingQueryParamName, pricingQueryParser)
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const { data: speech2textDefaultModel } = useDefaultModel(ModelTypeEnum.speech2text)
const { data: text2speechDefaultModel } = useDefaultModel(ModelTypeEnum.tts)
const { hasBlockingModalOpen } = useModalContext()
diff --git a/web/app/components/base/features/new-feature-panel/moderation/index.tsx b/web/app/components/base/features/new-feature-panel/moderation/index.tsx
index 80b0842df56..d979de50ca2 100644
--- a/web/app/components/base/features/new-feature-panel/moderation/index.tsx
+++ b/web/app/components/base/features/new-feature-panel/moderation/index.tsx
@@ -17,7 +17,7 @@ type Props = Readonly<{
}>
const Moderation = ({ disabled, onChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const { setShowModerationSettingModal } = useModalContext()
const locale = useLocale()
const featuresStore = useFeaturesStore()
diff --git a/web/app/components/base/features/new-feature-panel/moderation/moderation-content.tsx b/web/app/components/base/features/new-feature-panel/moderation/moderation-content.tsx
index f393feefbfd..0b789cefdc9 100644
--- a/web/app/components/base/features/new-feature-panel/moderation/moderation-content.tsx
+++ b/web/app/components/base/features/new-feature-panel/moderation/moderation-content.tsx
@@ -19,7 +19,7 @@ const ModerationContent: FC<ModerationContentProps> = ({
config,
onConfigChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const [presetResponse, setPresetResponse] = useState(config.preset_response || '')
const handleConfigChange = (field: string, value: boolean | string) => {
diff --git a/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx b/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx
index dd8b3c1722c..fcc4dfb18b0 100644
--- a/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx
+++ b/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx
@@ -57,7 +57,7 @@ type ModerationSettingModalProps = {
}
const ModerationSettingModal: FC<ModerationSettingModalProps> = ({ data, onCancel, onSave }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const docLink = useDocLink()
const locale = useLocale()
const { data: modelProviders, isPending: isLoading } = useModelProviderDetails()
diff --git a/web/app/components/base/features/new-feature-panel/more-like-this.tsx b/web/app/components/base/features/new-feature-panel/more-like-this.tsx
index b5f9c9a8a18..a2d69040ded 100644
--- a/web/app/components/base/features/new-feature-panel/more-like-this.tsx
+++ b/web/app/components/base/features/new-feature-panel/more-like-this.tsx
@@ -14,7 +14,7 @@ type Props = Readonly<{
}>
const MoreLikeThis = ({ disabled, onChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const features = useFeatures((s) => s.features)
const featuresStore = useFeaturesStore()
diff --git a/web/app/components/base/features/new-feature-panel/speech-to-text.tsx b/web/app/components/base/features/new-feature-panel/speech-to-text.tsx
index dae5cb1e284..387e1789347 100644
--- a/web/app/components/base/features/new-feature-panel/speech-to-text.tsx
+++ b/web/app/components/base/features/new-feature-panel/speech-to-text.tsx
@@ -13,7 +13,7 @@ type Props = Readonly<{
}>
const SpeechToText = ({ disabled, onChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const features = useFeatures((s) => s.features)
const featuresStore = useFeaturesStore()
diff --git a/web/app/components/base/features/new-feature-panel/text-to-speech/index.tsx b/web/app/components/base/features/new-feature-panel/text-to-speech/index.tsx
index d6867bd5609..626af49f812 100644
--- a/web/app/components/base/features/new-feature-panel/text-to-speech/index.tsx
+++ b/web/app/components/base/features/new-feature-panel/text-to-speech/index.tsx
@@ -18,7 +18,7 @@ type Props = Readonly<{
}>
const TextToSpeech = ({ disabled, onChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const textToSpeech = useFeatures((s) => s.features.text2speech) // .language .voice .autoPlay
const languageInfo = languages.find((i) => i.value === textToSpeech?.language)
const [modalOpen, setModalOpen] = useState(false)
diff --git a/web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx b/web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx
index b0e69c1d54d..5fe42f49880 100644
--- a/web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx
+++ b/web/app/components/base/features/new-feature-panel/text-to-speech/param-config-content.tsx
@@ -38,7 +38,7 @@ type VoiceParamConfigProps = {
const VoiceParamConfig = ({ onClose, onChange }: VoiceParamConfigProps) => {
const languageLabelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appApi', 'appDebug', 'common'])
const params = useParams<{ appId?: string; agentId?: string }>()
const text2speech = useFeatures((state) => state.features.text2speech)
const featuresStore = useFeaturesStore()
diff --git a/web/app/components/base/file-uploader/__tests__/utils.spec.ts b/web/app/components/base/file-uploader/__tests__/utils.spec.ts
index 982d7ebb4c3..6b030d1e10f 100644
--- a/web/app/components/base/file-uploader/__tests__/utils.spec.ts
+++ b/web/app/components/base/file-uploader/__tests__/utils.spec.ts
@@ -33,7 +33,7 @@ describe('file-uploader utils', () => {
const createMockT = () =>
withSelectorKey(
(key: string, _options?: Record<string, unknown>) => key,
- ) as unknown as TFunction
+ ) as unknown as TFunction<['common']>
it('should return forbidden message when error code is forbidden', () => {
const error = { response: { code: 'forbidden', message: 'Access denied' } }
diff --git a/web/app/components/base/file-uploader/audio-preview.tsx b/web/app/components/base/file-uploader/audio-preview.tsx
index 02599f43cf2..63c5416c5dc 100644
--- a/web/app/components/base/file-uploader/audio-preview.tsx
+++ b/web/app/components/base/file-uploader/audio-preview.tsx
@@ -8,7 +8,7 @@ type AudioPreviewProps = {
onCancel: () => void
}
const AudioPreview: FC<AudioPreviewProps> = ({ url, title, onCancel }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<Dialog
diff --git a/web/app/components/base/file-uploader/file-from-link-or-local/index.tsx b/web/app/components/base/file-uploader/file-from-link-or-local/index.tsx
index b76f9f1b365..d009eeaeb2f 100644
--- a/web/app/components/base/file-uploader/file-from-link-or-local/index.tsx
+++ b/web/app/components/base/file-uploader/file-from-link-or-local/index.tsx
@@ -23,7 +23,7 @@ const FileFromLinkOrLocal = ({
trigger,
fileConfig,
}: FileFromLinkOrLocalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const files = useStore((s) => s.files)
const [url, setUrl] = useState('')
const [showError, setShowError] = useState(false)
diff --git a/web/app/components/base/file-uploader/file-list-in-log.tsx b/web/app/components/base/file-uploader/file-list-in-log.tsx
index 724dc028a69..7a72b14384f 100644
--- a/web/app/components/base/file-uploader/file-list-in-log.tsx
+++ b/web/app/components/base/file-uploader/file-list-in-log.tsx
@@ -27,7 +27,7 @@ const FileListInLog = ({
noBorder = false,
noPadding = false,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog'])
const [expanded, setExpanded] = useState(isExpanded)
const fullList = useMemo(() => {
return fileList.reduce((acc: FileEntity[], { list }) => {
diff --git a/web/app/components/base/file-uploader/file-uploader-in-attachment/file-item.tsx b/web/app/components/base/file-uploader/file-uploader-in-attachment/file-item.tsx
index 399baaa04dc..48eec8d72db 100644
--- a/web/app/components/base/file-uploader/file-uploader-in-attachment/file-item.tsx
+++ b/web/app/components/base/file-uploader/file-uploader-in-attachment/file-item.tsx
@@ -32,7 +32,7 @@ const FileInAttachmentItem = ({
canPreview,
previewMode = PreviewMode.CurrentPage,
}: FileInAttachmentItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'custom'])
const { id, name, type, progress, supportFileType, base64Url, url, isRemote } = file
const ext = getFileExtension(name, type, isRemote)
const isImageFile = supportFileType === SupportUploadFileTypes.image
diff --git a/web/app/components/base/file-uploader/file-uploader-in-attachment/index.tsx b/web/app/components/base/file-uploader/file-uploader-in-attachment/index.tsx
index a1728874648..9f0b6de57c5 100644
--- a/web/app/components/base/file-uploader/file-uploader-in-attachment/index.tsx
+++ b/web/app/components/base/file-uploader/file-uploader-in-attachment/index.tsx
@@ -22,7 +22,7 @@ type FileUploaderInAttachmentProps = {
fileConfig: FileUpload
}
const FileUploaderInAttachment = ({ isDisabled, fileConfig }: FileUploaderInAttachmentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const files = useStore((s) => s.files)
const { handleRemoveFile, handleReUploadFile } = useFile(fileConfig)
const options = [
diff --git a/web/app/components/base/file-uploader/file-uploader-in-chat-input/file-image-item.tsx b/web/app/components/base/file-uploader/file-uploader-in-chat-input/file-image-item.tsx
index f27abffc5b9..b2eda966d22 100644
--- a/web/app/components/base/file-uploader/file-uploader-in-chat-input/file-image-item.tsx
+++ b/web/app/components/base/file-uploader/file-uploader-in-chat-input/file-image-item.tsx
@@ -24,7 +24,7 @@ const FileImageItem = ({
onRemove,
onReUpload,
}: FileImageItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'custom'])
const { id, progress, base64Url, url, name } = file
const [imagePreviewUrl, setImagePreviewUrl] = useState('')
const download_url = url ? `${url}&as_attachment=true` : base64Url
diff --git a/web/app/components/base/file-uploader/file-uploader-in-chat-input/file-item.tsx b/web/app/components/base/file-uploader/file-uploader-in-chat-input/file-item.tsx
index 7ee4edae4dd..5d5b0f5e3e8 100644
--- a/web/app/components/base/file-uploader/file-uploader-in-chat-input/file-item.tsx
+++ b/web/app/components/base/file-uploader/file-uploader-in-chat-input/file-item.tsx
@@ -28,7 +28,7 @@ const FileItem = ({
onReUpload,
canPreview,
}: FileItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'custom'])
const { id, name, type, progress, url, base64Url, isRemote } = file
const [previewUrl, setPreviewUrl] = useState('')
const ext = getFileExtension(name, type, isRemote)
diff --git a/web/app/components/base/file-uploader/file-uploader-in-chat-input/index.tsx b/web/app/components/base/file-uploader/file-uploader-in-chat-input/index.tsx
index 847362548ba..93a3c1fa24d 100644
--- a/web/app/components/base/file-uploader/file-uploader-in-chat-input/index.tsx
+++ b/web/app/components/base/file-uploader/file-uploader-in-chat-input/index.tsx
@@ -10,7 +10,7 @@ type FileUploaderInChatInputProps = {
readonly?: boolean
}
const FileUploaderInChatInput = ({ fileConfig, readonly }: FileUploaderInChatInputProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const renderTrigger = useCallback(() => {
return (
<button
diff --git a/web/app/components/base/file-uploader/hooks.ts b/web/app/components/base/file-uploader/hooks.ts
index da92adbdd09..8a1871fcde1 100644
--- a/web/app/components/base/file-uploader/hooks.ts
+++ b/web/app/components/base/file-uploader/hooks.ts
@@ -55,7 +55,7 @@ export const useFileSizeLimit = (fileUploadConfig?: FileUploadConfigResponse) =>
}
export const useFile = (fileConfig: FileUpload, noNeedToCheckEnable = true) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const fileStore = useFileStore()
const params = useParams()
const pathname = usePathname()
diff --git a/web/app/components/base/file-uploader/pdf-preview.tsx b/web/app/components/base/file-uploader/pdf-preview.tsx
index beb76dbf5cb..779e9692e15 100644
--- a/web/app/components/base/file-uploader/pdf-preview.tsx
+++ b/web/app/components/base/file-uploader/pdf-preview.tsx
@@ -16,7 +16,7 @@ type PdfPreviewProps = {
}
const PdfPreview: FC<PdfPreviewProps> = ({ url, onCancel }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const media = useBreakpoints()
const [scale, setScale] = useState(1)
const [position, setPosition] = useState({ x: 0, y: 0 })
diff --git a/web/app/components/base/file-uploader/utils.ts b/web/app/components/base/file-uploader/utils.ts
index 0147f06ee47..241b1a50be4 100644
--- a/web/app/components/base/file-uploader/utils.ts
+++ b/web/app/components/base/file-uploader/utils.ts
@@ -18,7 +18,7 @@ import { FileAppearanceTypeEnum } from './types'
export const getFileUploadErrorMessage = (
error: any,
defaultMessage: string,
- t: TFunction,
+ t: TFunction<['common']>,
): string => {
const errorCode = error?.response?.code
diff --git a/web/app/components/base/file-uploader/video-preview.tsx b/web/app/components/base/file-uploader/video-preview.tsx
index 3491406aaa9..cd1039f8afe 100644
--- a/web/app/components/base/file-uploader/video-preview.tsx
+++ b/web/app/components/base/file-uploader/video-preview.tsx
@@ -8,7 +8,7 @@ type VideoPreviewProps = {
onCancel: () => void
}
const VideoPreview: FC<VideoPreviewProps> = ({ url, title, onCancel }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<Dialog
diff --git a/web/app/components/base/float-right-container/index.tsx b/web/app/components/base/float-right-container/index.tsx
index 9dafde68eeb..21b76222778 100644
--- a/web/app/components/base/float-right-container/index.tsx
+++ b/web/app/components/base/float-right-container/index.tsx
@@ -36,7 +36,7 @@ const FloatRightContainer = ({
mask = true,
finalFocus,
}: IFloatRightContainerProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<>
diff --git a/web/app/components/base/form/components/base/base-field.tsx b/web/app/components/base/form/components/base/base-field.tsx
index eabe33a66f4..8698542771b 100644
--- a/web/app/components/base/form/components/base/base-field.tsx
+++ b/web/app/components/base/form/components/base/base-field.tsx
@@ -133,7 +133,7 @@ const BaseField = ({
const textFieldTypes: readonly FormTypeEnum[] = [FormTypeEnum.textInput, FormTypeEnum.secretInput]
const renderI18nObject = useRenderI18nObject()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const {
name,
label,
diff --git a/web/app/components/base/form/components/field/input-type-select/hooks.tsx b/web/app/components/base/form/components/field/input-type-select/hooks.tsx
index 74dce50e128..b9f13744c8f 100644
--- a/web/app/components/base/form/components/field/input-type-select/hooks.tsx
+++ b/web/app/components/base/form/components/field/input-type-select/hooks.tsx
@@ -46,7 +46,7 @@ const DATA_TYPE = {
}
export const useInputTypeOptions = (supportFile: boolean) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const options = supportFile
? InputTypeEnum.options
: InputTypeEnum.exclude(['file', 'file-list']).options
diff --git a/web/app/components/base/form/components/field/input-type-select/trigger.tsx b/web/app/components/base/form/components/field/input-type-select/trigger.tsx
index 4d102d4b9ba..a57a98f8786 100644
--- a/web/app/components/base/form/components/field/input-type-select/trigger.tsx
+++ b/web/app/components/base/form/components/field/input-type-select/trigger.tsx
@@ -7,7 +7,7 @@ type TriggerProps = {
}
const Trigger = ({ option }: TriggerProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
if (!option)
return <span className="grow p-1">{t(($) => $['placeholder.select'], { ns: 'common' })}</span>
diff --git a/web/app/components/base/form/components/field/select.tsx b/web/app/components/base/form/components/field/select.tsx
index de2f1553f56..01e3fa25721 100644
--- a/web/app/components/base/form/components/field/select.tsx
+++ b/web/app/components/base/form/components/field/select.tsx
@@ -53,7 +53,7 @@ const SelectField = ({
disabled,
popupProps,
}: SelectFieldProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const field = useFieldContext<string>()
const placeholderText = placeholder || t(($) => $['placeholder.select'], { ns: 'common' })
diff --git a/web/app/components/base/form/components/field/upload-method.tsx b/web/app/components/base/form/components/field/upload-method.tsx
index e57cd7ec080..3087932f52c 100644
--- a/web/app/components/base/form/components/field/upload-method.tsx
+++ b/web/app/components/base/form/components/field/upload-method.tsx
@@ -18,7 +18,7 @@ type UploadMethodFieldProps = {
const UploadMethodField = ({ label, labelOptions, className }: UploadMethodFieldProps) => {
const labelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const field = useFieldContext<TransferMethod[]>()
const { value } = field.state
diff --git a/web/app/components/base/form/components/form/actions.tsx b/web/app/components/base/form/components/form/actions.tsx
index 646f0baf7c6..65f7291e847 100644
--- a/web/app/components/base/form/components/form/actions.tsx
+++ b/web/app/components/base/form/components/form/actions.tsx
@@ -15,7 +15,7 @@ type ActionsProps = {
}
const Actions = ({ CustomActions }: ActionsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const form = useFormContext()
const [isSubmitting, canSubmit] = useStore(form.store, (state) => [
diff --git a/web/app/components/base/form/components/label.tsx b/web/app/components/base/form/components/label.tsx
index 4bc00c825c8..53bf0aff5b7 100644
--- a/web/app/components/base/form/components/label.tsx
+++ b/web/app/components/base/form/components/label.tsx
@@ -15,7 +15,7 @@ export type LabelProps = {
const Label = ({ htmlFor, label, isRequired, showOptional, tooltip, className }: LabelProps) => {
const labelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className="flex h-6 items-center">
diff --git a/web/app/components/base/form/hooks/use-get-validators.ts b/web/app/components/base/form/hooks/use-get-validators.ts
index 0145dc50e30..3e6e5c42e47 100644
--- a/web/app/components/base/form/hooks/use-get-validators.ts
+++ b/web/app/components/base/form/hooks/use-get-validators.ts
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'
import { useRenderI18nObject } from '@/hooks/use-i18n'
export const useGetValidators = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const renderI18nObject = useRenderI18nObject()
const getLabel = useCallback((label: string | Record<string, string> | ReactNode) => {
if (isValidElement(label)) return ''
diff --git a/web/app/components/base/image-gallery/index.tsx b/web/app/components/base/image-gallery/index.tsx
index c713ae05f07..5a2ac45a742 100644
--- a/web/app/components/base/image-gallery/index.tsx
+++ b/web/app/components/base/image-gallery/index.tsx
@@ -31,7 +31,7 @@ const getWidthStyle = (imgNum: number) => {
}
const ImageGallery: FC<Props> = ({ srcs, onPreviewOpenChange }) => {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const [imagePreviewUrl, setImagePreviewUrl] = useState('')
const isPreviewOpen = Boolean(imagePreviewUrl)
diff --git a/web/app/components/base/image-uploader/__tests__/utils.spec.ts b/web/app/components/base/image-uploader/__tests__/utils.spec.ts
index 309841e37ba..56e7d47d8fc 100644
--- a/web/app/components/base/image-uploader/__tests__/utils.spec.ts
+++ b/web/app/components/base/image-uploader/__tests__/utils.spec.ts
@@ -16,7 +16,7 @@ describe('image-uploader utils', () => {
describe('getImageUploadErrorMessage', () => {
it('should return backend message when error code is forbidden', () => {
const translate = vi.fn((key: string, _options?: Record<string, unknown>) => key)
- const t = withSelectorKey(translate) as unknown as TFunction
+ const t = withSelectorKey(translate) as unknown as TFunction<['common']>
const result = getImageUploadErrorMessage(
{ response: { code: 'forbidden', message: 'Forbidden by policy' } },
@@ -30,7 +30,7 @@ describe('image-uploader utils', () => {
it('should return translated message when error code is file_extension_blocked', () => {
const translate = vi.fn(() => 'common.fileUploader.fileExtensionBlocked')
- const t = withSelectorKey(translate) as unknown as TFunction
+ const t = withSelectorKey(translate) as unknown as TFunction<['common']>
const result = getImageUploadErrorMessage(
{ response: { code: 'file_extension_blocked' } },
@@ -44,7 +44,7 @@ describe('image-uploader utils', () => {
it('should return default message when error code is unknown', () => {
const translate = vi.fn((key: string, _options?: Record<string, unknown>) => key)
- const t = withSelectorKey(translate) as unknown as TFunction
+ const t = withSelectorKey(translate) as unknown as TFunction<['common']>
const result = getImageUploadErrorMessage(
{ response: { code: 'unexpected_error' } },
@@ -58,7 +58,7 @@ describe('image-uploader utils', () => {
it('should return default message when error is missing response code', () => {
const translate = vi.fn((key: string, _options?: Record<string, unknown>) => key)
- const t = withSelectorKey(translate) as unknown as TFunction
+ const t = withSelectorKey(translate) as unknown as TFunction<['common']>
const result = getImageUploadErrorMessage(undefined, 'Default error', t)
diff --git a/web/app/components/base/image-uploader/hooks.ts b/web/app/components/base/image-uploader/hooks.ts
index e8d12b193b8..31fbcb6ead3 100644
--- a/web/app/components/base/image-uploader/hooks.ts
+++ b/web/app/components/base/image-uploader/hooks.ts
@@ -8,7 +8,7 @@ import { getImageUploadErrorMessage, imageUpload } from './utils'
export const useImageFiles = () => {
const params = useParams()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [files, setFiles] = useState<ImageFile[]>([])
const filesRef = useRef<ImageFile[]>([])
const handleUpload = (imageFile: ImageFile) => {
@@ -145,7 +145,7 @@ export const useLocalFileUploader = ({
onUpload,
}: useLocalUploaderProps) => {
const params = useParams()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const handleLocalFileUpload = useCallback(
(file: File) => {
if (disabled) {
diff --git a/web/app/components/base/image-uploader/image-link-input.tsx b/web/app/components/base/image-uploader/image-link-input.tsx
index 513b10a1041..cc33b05415b 100644
--- a/web/app/components/base/image-uploader/image-link-input.tsx
+++ b/web/app/components/base/image-uploader/image-link-input.tsx
@@ -11,7 +11,7 @@ type ImageLinkInputProps = {
}
const regex = /^(?:https?|ftp):\/\//
const ImageLinkInput: FC<ImageLinkInputProps> = ({ onUpload, disabled }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [imageLink, setImageLink] = useState('')
const placeholder = t(($) => $['imageUploader.pasteImageLinkInputPlaceholder'], { ns: 'common' })
diff --git a/web/app/components/base/image-uploader/image-list.tsx b/web/app/components/base/image-uploader/image-list.tsx
index db2c1f3d91b..3630401721c 100644
--- a/web/app/components/base/image-uploader/image-list.tsx
+++ b/web/app/components/base/image-uploader/image-list.tsx
@@ -24,7 +24,7 @@ const ImageList: FC<ImageListProps> = ({
onImageLinkLoadSuccess,
onImageLinkLoadError,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [imagePreviewUrl, setImagePreviewUrl] = useState('')
const handleImageLinkLoadSuccess = (item: ImageFile) => {
diff --git a/web/app/components/base/image-uploader/image-preview.tsx b/web/app/components/base/image-uploader/image-preview.tsx
index 4a67f19b11d..b95ea920509 100644
--- a/web/app/components/base/image-uploader/image-preview.tsx
+++ b/web/app/components/base/image-uploader/image-preview.tsx
@@ -51,7 +51,7 @@ const fetchImageAsPng = async (url: string): Promise<Blob> => {
}
const ImagePreview: FC<ImagePreviewProps> = ({ url, title, onCancel, onPrev, onNext }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [scale, setScale] = useState(1)
const [position, setPosition] = useState({ x: 0, y: 0 })
const [isDragging, setIsDragging] = useState(false)
diff --git a/web/app/components/base/image-uploader/text-generation-image-uploader.tsx b/web/app/components/base/image-uploader/text-generation-image-uploader.tsx
index 6aad2465436..fd39f0673b6 100644
--- a/web/app/components/base/image-uploader/text-generation-image-uploader.tsx
+++ b/web/app/components/base/image-uploader/text-generation-image-uploader.tsx
@@ -14,7 +14,7 @@ type PasteImageLinkButtonProps = {
disabled?: boolean
}
const PasteImageLinkButton: FC<PasteImageLinkButtonProps> = ({ onUpload, disabled }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [open, setOpen] = useState(false)
const handleUpload = (imageFile: ImageFile) => {
@@ -63,7 +63,7 @@ const TextGenerationImageUploader: FC<TextGenerationImageUploaderProps> = ({
onFilesChange,
disabled,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { files, onUpload, onRemove, onImageLinkLoadError, onImageLinkLoadSuccess, onReUpload } =
useImageFiles()
diff --git a/web/app/components/base/image-uploader/utils.ts b/web/app/components/base/image-uploader/utils.ts
index aeaa112f86d..8e7a36c718a 100644
--- a/web/app/components/base/image-uploader/utils.ts
+++ b/web/app/components/base/image-uploader/utils.ts
@@ -11,7 +11,7 @@ import { upload } from '@/service/base'
export const getImageUploadErrorMessage = (
error: any,
defaultMessage: string,
- t: TFunction,
+ t: TFunction<['common']>,
): string => {
const errorCode = error?.response?.code
diff --git a/web/app/components/base/inline-delete-confirm/index.tsx b/web/app/components/base/inline-delete-confirm/index.tsx
index bc9e1258527..efde27c8f80 100644
--- a/web/app/components/base/inline-delete-confirm/index.tsx
+++ b/web/app/components/base/inline-delete-confirm/index.tsx
@@ -24,7 +24,7 @@ const InlineDeleteConfirm: FC<InlineDeleteConfirmProps> = ({
className,
variant = 'delete',
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const titleId = useId()
const descriptionId = useId()
diff --git a/web/app/components/base/keyboard-sortable/use-keyboard-sortable.tsx b/web/app/components/base/keyboard-sortable/use-keyboard-sortable.tsx
index aa54eaae3ce..497e03e0758 100644
--- a/web/app/components/base/keyboard-sortable/use-keyboard-sortable.tsx
+++ b/web/app/components/base/keyboard-sortable/use-keyboard-sortable.tsx
@@ -27,7 +27,7 @@ export function useKeyboardSortable<T>({
minIndex = 0,
getItemLabel,
}: Options<T>) {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const descriptionId = useId()
const [session, setSession] = useState<SortSession<T> | null>(null)
const [message, setMessage] = useState('')
diff --git a/web/app/components/base/loading-placeholder/index.tsx b/web/app/components/base/loading-placeholder/index.tsx
index cd0b9f7896b..c89ba8ae16a 100644
--- a/web/app/components/base/loading-placeholder/index.tsx
+++ b/web/app/components/base/loading-placeholder/index.tsx
@@ -10,7 +10,7 @@ type LoadingPlaceholderProps = {
}
function LoadingPlaceholder({ label, className }: LoadingPlaceholderProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className={cn('flex w-full items-center justify-center', className)}>
diff --git a/web/app/components/base/markdown-blocks/thinking-details.tsx b/web/app/components/base/markdown-blocks/thinking-details.tsx
index 31f5ff2fbdf..95e3a601059 100644
--- a/web/app/components/base/markdown-blocks/thinking-details.tsx
+++ b/web/app/components/base/markdown-blocks/thinking-details.tsx
@@ -20,7 +20,7 @@ const ThinkingDetails = ({
children,
...rest
}: ThinkingDetailsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<details {...rest} className={cn('group', className)} open={isComplete ? open : true}>
diff --git a/web/app/components/base/mermaid/index.tsx b/web/app/components/base/mermaid/index.tsx
index 97e35585950..13cd1fcc377 100644
--- a/web/app/components/base/mermaid/index.tsx
+++ b/web/app/components/base/mermaid/index.tsx
@@ -113,7 +113,7 @@ type FlowchartProps = {
}
const Flowchart = (props: FlowchartProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const [svgString, setSvgString] = useState<string | null>(null)
const [look, setLook] = useState<'classic' | 'handDrawn'>('classic')
const [isInitialized, setIsInitialized] = useState(false)
diff --git a/web/app/components/base/message-log-modal/index.tsx b/web/app/components/base/message-log-modal/index.tsx
index 5a81027d799..ffab535f636 100644
--- a/web/app/components/base/message-log-modal/index.tsx
+++ b/web/app/components/base/message-log-modal/index.tsx
@@ -27,7 +27,7 @@ const MessageLogModal: FC<MessageLogModalProps> = ({
fixedWidth,
onCancel,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common'])
const ref = useRef(null)
const appDetail = useStore((state) => state.appDetail)
diff --git a/web/app/components/base/new-audio-button/index.tsx b/web/app/components/base/new-audio-button/index.tsx
index 493a967bce7..68ce0136c9a 100644
--- a/web/app/components/base/new-audio-button/index.tsx
+++ b/web/app/components/base/new-audio-button/index.tsx
@@ -16,7 +16,7 @@ type AudioBtnProps = Readonly<{
type AudioState = 'initial' | 'loading' | 'playing' | 'paused' | 'ended'
const AudioBtn = ({ id, voice, value }: AudioBtnProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appApi'])
const [audioState, setAudioState] = useState<AudioState>('initial')
const params = useParams()
diff --git a/web/app/components/base/notion-connector/index.tsx b/web/app/components/base/notion-connector/index.tsx
index 3cac4380908..28c648501ab 100644
--- a/web/app/components/base/notion-connector/index.tsx
+++ b/web/app/components/base/notion-connector/index.tsx
@@ -7,7 +7,7 @@ type NotionConnectorProps = {
}
const NotionConnector = ({ onSetting }: NotionConnectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
return (
<div className="flex flex-col items-start rounded-2xl bg-workflow-process-bg p-6">
diff --git a/web/app/components/base/notion-page-selector/base.tsx b/web/app/components/base/notion-page-selector/base.tsx
index 4ab85546e0d..6fccd5e6b13 100644
--- a/web/app/components/base/notion-page-selector/base.tsx
+++ b/web/app/components/base/notion-page-selector/base.tsx
@@ -44,7 +44,7 @@ const NotionPageSelector = ({
credentialList,
onSelectCredential,
}: NotionPageSelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [searchValue, setSearchValue] = useState('')
const [, setSettingsDestination] = useQueryState(settingsQueryParamName, settingsQueryParser)
diff --git a/web/app/components/base/notion-page-selector/page-selector/index.tsx b/web/app/components/base/notion-page-selector/page-selector/index.tsx
index 28c69d01d90..65ea77809c5 100644
--- a/web/app/components/base/notion-page-selector/page-selector/index.tsx
+++ b/web/app/components/base/notion-page-selector/page-selector/index.tsx
@@ -26,7 +26,7 @@ const PageSelector = ({
previewPageId,
onPreview,
}: PageSelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const {
currentPreviewPageId,
effectiveSearchValue,
diff --git a/web/app/components/base/notion-page-selector/page-selector/page-row.tsx b/web/app/components/base/notion-page-selector/page-selector/page-row.tsx
index ea5289fd64e..169d817c1f1 100644
--- a/web/app/components/base/notion-page-selector/page-selector/page-row.tsx
+++ b/web/app/components/base/notion-page-selector/page-selector/page-row.tsx
@@ -35,7 +35,7 @@ const NotionPageRow = ({
showPreview,
style,
}: NotionPageRowProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const pageId = row.page.page_id
const breadcrumbs = row.ancestors.length
? [...row.ancestors, row.page.page_name]
diff --git a/web/app/components/base/notion-page-selector/page-selector/virtual-page-list.tsx b/web/app/components/base/notion-page-selector/page-selector/virtual-page-list.tsx
index 0d9a0d7df94..69effe7bbb8 100644
--- a/web/app/components/base/notion-page-selector/page-selector/virtual-page-list.tsx
+++ b/web/app/components/base/notion-page-selector/page-selector/virtual-page-list.tsx
@@ -34,7 +34,7 @@ const VirtualPageList = ({
selectionMode,
showPreview,
}: VirtualPageListProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const scrollRef = useRef<HTMLDivElement>(null)
const rowVirtualizer = useVirtualizer({
diff --git a/web/app/components/base/notion-page-selector/search-input/index.tsx b/web/app/components/base/notion-page-selector/search-input/index.tsx
index 2373e7f33e7..c871b0e6c94 100644
--- a/web/app/components/base/notion-page-selector/search-input/index.tsx
+++ b/web/app/components/base/notion-page-selector/search-input/index.tsx
@@ -8,7 +8,7 @@ type SearchInputProps = {
onChange: (v: string) => void
}
const SearchInput = ({ value, onChange }: SearchInputProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const handleClear = useCallback(() => {
onChange('')
diff --git a/web/app/components/base/page-unavailable.tsx b/web/app/components/base/page-unavailable.tsx
index f41e816281d..e032d60404b 100644
--- a/web/app/components/base/page-unavailable.tsx
+++ b/web/app/components/base/page-unavailable.tsx
@@ -8,7 +8,7 @@ type PageUnavailableProps = {
}
const PageUnavailable = ({ className }: PageUnavailableProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className={cn('flex h-screen w-screen items-center justify-center', className)}>
diff --git a/web/app/components/base/param-item/score-threshold-item.tsx b/web/app/components/base/param-item/score-threshold-item.tsx
index 8db21dcd19a..f6b257af127 100644
--- a/web/app/components/base/param-item/score-threshold-item.tsx
+++ b/web/app/components/base/param-item/score-threshold-item.tsx
@@ -38,7 +38,7 @@ const ScoreThresholdItem: FC<Props> = ({
onSwitchChange,
disabled = false,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const handleParamChange = (key: string, nextValue: number) => {
onChange(key, normalizeScoreThreshold(nextValue))
}
diff --git a/web/app/components/base/param-item/top-k-item.tsx b/web/app/components/base/param-item/top-k-item.tsx
index 8c23563de98..75eca496d25 100644
--- a/web/app/components/base/param-item/top-k-item.tsx
+++ b/web/app/components/base/param-item/top-k-item.tsx
@@ -22,7 +22,7 @@ const VALUE_LIMIT = {
}
const TopKItem: FC<Props> = ({ className, value, enable, onChange, disabled = false }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const handleParamChange = (key: string, value: number) => {
let notOutRangeValue = Number.parseInt(value.toFixed(0))
notOutRangeValue = Math.max(VALUE_LIMIT.min, notOutRangeValue)
diff --git a/web/app/components/base/prompt-editor/plugins/agent-output-block/component.tsx b/web/app/components/base/prompt-editor/plugins/agent-output-block/component.tsx
index 6743ca3edeb..e6518ab57ab 100644
--- a/web/app/components/base/prompt-editor/plugins/agent-output-block/component.tsx
+++ b/web/app/components/base/prompt-editor/plugins/agent-output-block/component.tsx
@@ -67,7 +67,7 @@ const AgentOutputBlockComponent = ({
onChange,
onEdit,
}: AgentOutputBlockComponentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [editor] = useLexicalComposerContext()
const selected = getAgentOutputTypeOption(outputType)
const [draftName, setDraftName] = useState(name)
diff --git a/web/app/components/base/prompt-editor/plugins/component-picker-block/hooks.tsx b/web/app/components/base/prompt-editor/plugins/component-picker-block/hooks.tsx
index 08fdef71709..f335617f40d 100644
--- a/web/app/components/base/prompt-editor/plugins/component-picker-block/hooks.tsx
+++ b/web/app/components/base/prompt-editor/plugins/component-picker-block/hooks.tsx
@@ -33,7 +33,7 @@ export const usePromptOptions = (
historyBlock?: HistoryBlockType,
requestURLBlock?: RequestURLBlockType,
) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [editor] = useLexicalComposerContext()
const promptOptions: PickerBlockMenuOption[] = []
@@ -158,7 +158,7 @@ export const useVariableOptions = (
variableBlock?: VariableBlockType,
queryString?: string,
): PickerBlockMenuOption[] => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [editor] = useLexicalComposerContext()
const options = useMemo(() => {
@@ -238,7 +238,7 @@ export const useExternalToolOptions = (
externalToolBlockType?: ExternalToolBlockType,
queryString?: string,
) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [editor] = useLexicalComposerContext()
const options = useMemo(() => {
diff --git a/web/app/components/base/prompt-editor/plugins/component-picker-block/index.tsx b/web/app/components/base/prompt-editor/plugins/component-picker-block/index.tsx
index 4eeade8dfaa..21f83bcb498 100644
--- a/web/app/components/base/prompt-editor/plugins/component-picker-block/index.tsx
+++ b/web/app/components/base/prompt-editor/plugins/component-picker-block/index.tsx
@@ -69,7 +69,7 @@ const ComponentPicker = ({
lastRunBlock,
isSupportFileVar,
}: ComponentPickerProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { eventEmitter } = useEventEmitterContextContext()
const { refs, floatingStyles, isPositioned } = useFloating({
placement: 'bottom-start',
diff --git a/web/app/components/base/prompt-editor/plugins/context-block/component.tsx b/web/app/components/base/prompt-editor/plugins/context-block/component.tsx
index 11fb66da406..a55edcab1be 100644
--- a/web/app/components/base/prompt-editor/plugins/context-block/component.tsx
+++ b/web/app/components/base/prompt-editor/plugins/context-block/component.tsx
@@ -22,7 +22,7 @@ const ContextBlockComponent: FC<ContextBlockComponentProps> = ({
onAddContext,
canNotAddContext,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [ref, isSelected] = useSelectOrDelete(nodeKey, DELETE_CONTEXT_BLOCK_COMMAND)
const [triggerRef, open, setOpen] = useTrigger<HTMLButtonElement>()
const { eventEmitter } = useEventEmitterContextContext()
diff --git a/web/app/components/base/prompt-editor/plugins/history-block/component.tsx b/web/app/components/base/prompt-editor/plugins/history-block/component.tsx
index 337b20ef2bd..2dd6e7b8137 100644
--- a/web/app/components/base/prompt-editor/plugins/history-block/component.tsx
+++ b/web/app/components/base/prompt-editor/plugins/history-block/component.tsx
@@ -21,7 +21,7 @@ const HistoryBlockComponent: FC<HistoryBlockComponentProps> = ({
roleName = { user: '', assistant: '' },
onEditRole,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [ref, isSelected] = useSelectOrDelete(nodeKey, DELETE_HISTORY_BLOCK_COMMAND)
const [triggerRef, open, setOpen] = useTrigger()
const { eventEmitter } = useEventEmitterContextContext()
diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/component-ui.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/component-ui.tsx
index 22a17a548f8..c331fcfb870 100644
--- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/component-ui.tsx
+++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/component-ui.tsx
@@ -52,7 +52,7 @@ const HITLInputComponentUI: FC<HITLInputComponentUIProps> = ({
ragVariables,
readonly,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'workflow'])
const resolvedFormInput = formInput || createDefaultParagraphFormInput(varName)
const paragraphDefault = isParagraphFormInput(resolvedFormInput)
? resolvedFormInput.default
diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/input-field.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/input-field.tsx
index 71eec20702a..224e11bba9d 100644
--- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/input-field.tsx
+++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/input-field.tsx
@@ -49,7 +49,7 @@ const InputField: React.FC<InputFieldProps> = ({
onCancel,
}) => {
const outputVariableNameInputId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'workflow'])
const [tempPayload, setTempPayload] = useState<FormInputItem>(
() => payload || createDefaultParagraphFormInput(),
)
diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/pre-populate.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/pre-populate.tsx
index 4710d132c8f..23acb844483 100644
--- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/pre-populate.tsx
+++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/pre-populate.tsx
@@ -35,7 +35,7 @@ type PlaceholderProps = {
onTypeClick: (isVariable: boolean) => void
}
const Placeholder = ({ varPickerProps, onTypeClick }: PlaceholderProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="mt-1 h-20 rounded-lg bg-components-input-bg-normal px-3 pt-2 system-sm-regular text-text-tertiary">
<div className="flex flex-wrap items-center leading-5">
@@ -74,7 +74,7 @@ const PrePopulate: FC<Props> = ({
value,
onValueChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [onPlaceholderClicked, setOnPlaceholderClicked] = useState(false)
const handleTypeChange = useCallback(
(isVar: boolean) => {
diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/type-switch.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/type-switch.tsx
index 46c348e88bf..51d67b79668 100644
--- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/type-switch.tsx
+++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/type-switch.tsx
@@ -11,7 +11,7 @@ type Props = Readonly<{
}>
const TypeSwitch: FC<Props> = ({ className, isVariable, onIsVariableChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<button
type="button"
diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/variable-block.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/variable-block.tsx
index 585028e7a16..3c05651cc18 100644
--- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/variable-block.tsx
+++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/variable-block.tsx
@@ -44,7 +44,7 @@ const HITLInputVariableBlockComponent = ({
conversationVariables,
ragVariables,
}: HITLInputVariableBlockComponentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [editor] = useLexicalComposerContext()
const variablesLength = variables.length
const isRagVar = isRagVariableVar(variables)
diff --git a/web/app/components/base/prompt-editor/plugins/placeholder.tsx b/web/app/components/base/prompt-editor/plugins/placeholder.tsx
index 489d55400d0..00db3781601 100644
--- a/web/app/components/base/prompt-editor/plugins/placeholder.tsx
+++ b/web/app/components/base/prompt-editor/plugins/placeholder.tsx
@@ -12,7 +12,7 @@ const Placeholder = ({
value?: ReactNode
className?: string
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div
diff --git a/web/app/components/base/prompt-editor/plugins/query-block/component.tsx b/web/app/components/base/prompt-editor/plugins/query-block/component.tsx
index ef04216f6fc..e69ee8ea294 100644
--- a/web/app/components/base/prompt-editor/plugins/query-block/component.tsx
+++ b/web/app/components/base/prompt-editor/plugins/query-block/component.tsx
@@ -8,7 +8,7 @@ type QueryBlockComponentProps = {
}
const QueryBlockComponent: FC<QueryBlockComponentProps> = ({ nodeKey }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [ref, isSelected] = useSelectOrDelete(nodeKey, DELETE_QUERY_BLOCK_COMMAND)
return (
diff --git a/web/app/components/base/prompt-editor/plugins/request-url-block/component.tsx b/web/app/components/base/prompt-editor/plugins/request-url-block/component.tsx
index eed2603e944..4ac0ef4a6c7 100644
--- a/web/app/components/base/prompt-editor/plugins/request-url-block/component.tsx
+++ b/web/app/components/base/prompt-editor/plugins/request-url-block/component.tsx
@@ -10,7 +10,7 @@ type RequestURLBlockComponentProps = {
}
const RequestURLBlockComponent: FC<RequestURLBlockComponentProps> = ({ nodeKey }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [ref, isSelected] = useSelectOrDelete(nodeKey, DELETE_REQUEST_URL_BLOCK_COMMAND)
return (
diff --git a/web/app/components/base/prompt-editor/plugins/workflow-variable-block/component.tsx b/web/app/components/base/prompt-editor/plugins/workflow-variable-block/component.tsx
index afb6be3dcb3..fae11542237 100644
--- a/web/app/components/base/prompt-editor/plugins/workflow-variable-block/component.tsx
+++ b/web/app/components/base/prompt-editor/plugins/workflow-variable-block/component.tsx
@@ -46,7 +46,7 @@ const WorkflowVariableBlockComponent = ({
availableVariables,
getVarType,
}: WorkflowVariableBlockComponentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [editor] = useLexicalComposerContext()
const [ref, isSelected] = useSelectOrDelete(nodeKey, DELETE_WORKFLOW_VARIABLE_BLOCK_COMMAND)
const variablesLength = variables.length
diff --git a/web/app/components/base/prompt-log-modal/index.tsx b/web/app/components/base/prompt-log-modal/index.tsx
index 1505911e159..f232aef3da7 100644
--- a/web/app/components/base/prompt-log-modal/index.tsx
+++ b/web/app/components/base/prompt-log-modal/index.tsx
@@ -12,7 +12,7 @@ type PromptLogModalProps = {
onCancel: () => void
}
const PromptLogModal: FC<PromptLogModalProps> = ({ currentLogItem, width, onCancel }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const ref = useRef(null)
const [mounted, setMounted] = useState(false)
diff --git a/web/app/components/base/qrcode/index.tsx b/web/app/components/base/qrcode/index.tsx
index ad5227a6c9f..e8a0cf0261f 100644
--- a/web/app/components/base/qrcode/index.tsx
+++ b/web/app/components/base/qrcode/index.tsx
@@ -17,7 +17,7 @@ type Props = Readonly<{
const prefixEmbedded = 'overview.appInfo.qrcode.title'
const ShareQRCode = ({ content, downloadLabel, scanLabel, triggerLabel }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview'])
const [isShow, setIsShow] = useState<boolean>(false)
const qrCodeRef = useRef<HTMLDivElement>(null)
diff --git a/web/app/components/base/resize-handle/index.tsx b/web/app/components/base/resize-handle/index.tsx
index eb46db72b24..6b9b2e1cbc5 100644
--- a/web/app/components/base/resize-handle/index.tsx
+++ b/web/app/components/base/resize-handle/index.tsx
@@ -29,7 +29,7 @@ export default function ResizeHandle({
className,
...props
}: ResizeHandleProps) {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const horizontal = side === 'left' || side === 'right'
return (
diff --git a/web/app/components/base/search-input/index.tsx b/web/app/components/base/search-input/index.tsx
index 6a50f304ac5..2dfa3f12f0e 100644
--- a/web/app/components/base/search-input/index.tsx
+++ b/web/app/components/base/search-input/index.tsx
@@ -28,7 +28,7 @@ export function SearchInput({
'aria-describedby': ariaDescribedBy,
'aria-label': ariaLabel,
}: SearchInputProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const inputRef = useRef<HTMLInputElement>(null)
const isComposingRef = useRef<boolean>(false)
const compositionCommitRef = useRef<string | null>(null)
diff --git a/web/app/components/base/sort/index.tsx b/web/app/components/base/sort/index.tsx
index 228e978d35c..ecca7d7e041 100644
--- a/web/app/components/base/sort/index.tsx
+++ b/web/app/components/base/sort/index.tsx
@@ -22,7 +22,7 @@ type Props = Readonly<{
}>
function Sort({ order, value, items, onSelect }: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog'])
const triggerContent = useMemo(() => {
return items.find((item) => item.value === value)?.name || ''
diff --git a/web/app/components/base/svg-gallery/index.tsx b/web/app/components/base/svg-gallery/index.tsx
index 1d9213de2b5..5893e155437 100644
--- a/web/app/components/base/svg-gallery/index.tsx
+++ b/web/app/components/base/svg-gallery/index.tsx
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'
import ImagePreview from '@/app/components/base/image-uploader/image-preview'
const SVGRenderer = ({ content }: { content: string }) => {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const svgRef = useRef<HTMLDivElement>(null)
const [imagePreview, setImagePreview] = useState('')
diff --git a/web/app/components/base/tag-input/index.tsx b/web/app/components/base/tag-input/index.tsx
index 3250c00acc5..f439a06f907 100644
--- a/web/app/components/base/tag-input/index.tsx
+++ b/web/app/components/base/tag-input/index.tsx
@@ -33,7 +33,7 @@ const TagInput = ({
'aria-describedby': ariaDescribedBy,
'aria-invalid': ariaInvalid,
}: TagInputProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const [value, setValue] = useState('')
const [focused, setFocused] = useState(false)
const isSpecialMode = customizedConfirmKey === 'Tab'
diff --git a/web/app/components/base/text-generation/hooks.ts b/web/app/components/base/text-generation/hooks.ts
index b0a6738e655..c0c481057b1 100644
--- a/web/app/components/base/text-generation/hooks.ts
+++ b/web/app/components/base/text-generation/hooks.ts
@@ -8,7 +8,7 @@ type SendOptions = {
}
export const useTextGeneration = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const [isResponding, setIsResponding] = useState(false)
const [completion, setCompletion] = useState('')
const [messageId, setMessageId] = useState<string | null>(null)
diff --git a/web/app/components/base/theme-selector.tsx b/web/app/components/base/theme-selector.tsx
index 2e3927bf0db..53380205a3b 100644
--- a/web/app/components/base/theme-selector.tsx
+++ b/web/app/components/base/theme-selector.tsx
@@ -20,7 +20,7 @@ const isTheme = (value: string): value is Theme => {
}
export default function ThemeSelector() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { theme, setTheme } = useTheme()
const currentTheme: Theme = theme && isTheme(theme) ? theme : 'system'
diff --git a/web/app/components/base/video-gallery/VideoPlayer.tsx b/web/app/components/base/video-gallery/VideoPlayer.tsx
index 67f6d44ccfd..b146fa9909e 100644
--- a/web/app/components/base/video-gallery/VideoPlayer.tsx
+++ b/web/app/components/base/video-gallery/VideoPlayer.tsx
@@ -83,7 +83,7 @@ const FullscreenIcon = () => (
)
const VideoPlayer: React.FC<VideoPlayerProps> = ({ src, srcs }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [isPlaying, setIsPlaying] = useState(false)
const [currentTime, setCurrentTime] = useState(0)
const [duration, setDuration] = useState(0)
diff --git a/web/app/components/base/voice-input/index.tsx b/web/app/components/base/voice-input/index.tsx
index 8620127a708..b7450bca723 100644
--- a/web/app/components/base/voice-input/index.tsx
+++ b/web/app/components/base/voice-input/index.tsx
@@ -31,7 +31,7 @@ function VoiceInput({
onStartError,
target,
}: VoiceInputProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const recorderRef = useRef<VoiceRecorder | null>(null)
const canvasRef = useRef<HTMLCanvasElement | null>(null)
const canvasContextRef = useRef<CanvasRenderingContext2D | null>(null)
diff --git a/web/app/components/billing/annotation-full/index.tsx b/web/app/components/billing/annotation-full/index.tsx
index 3412259b8a8..4a576ebf39f 100644
--- a/web/app/components/billing/annotation-full/index.tsx
+++ b/web/app/components/billing/annotation-full/index.tsx
@@ -9,7 +9,7 @@ import s from './style.module.css'
import Usage from './usage'
const AnnotationFull: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
return (
<GridMask
diff --git a/web/app/components/billing/annotation-full/modal.tsx b/web/app/components/billing/annotation-full/modal.tsx
index 53da3e4ef42..98b6dc407e1 100644
--- a/web/app/components/billing/annotation-full/modal.tsx
+++ b/web/app/components/billing/annotation-full/modal.tsx
@@ -15,7 +15,7 @@ type Props = Readonly<{
onHide: () => void
}>
const AnnotationFullModal: FC<Props> = ({ show, onHide }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'common'])
return (
<Dialog
diff --git a/web/app/components/billing/annotation-full/usage.tsx b/web/app/components/billing/annotation-full/usage.tsx
index 3e47f9117fd..534ca75c3a1 100644
--- a/web/app/components/billing/annotation-full/usage.tsx
+++ b/web/app/components/billing/annotation-full/usage.tsx
@@ -12,7 +12,7 @@ type Props = Readonly<{
}>
const Usage: FC<Props> = ({ className }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
const { data: annotationQuota } = useQuery(
consoleQuery.features.get.queryOptions({
select: (features) => features.annotation_quota_limit,
diff --git a/web/app/components/billing/apps-full-in-dialog/index.tsx b/web/app/components/billing/apps-full-in-dialog/index.tsx
index 92fe2e606ef..e9d7e81c1a7 100644
--- a/web/app/components/billing/apps-full-in-dialog/index.tsx
+++ b/web/app/components/billing/apps-full-in-dialog/index.tsx
@@ -14,7 +14,7 @@ import UpgradeBtn from '../upgrade-btn'
import s from './style.module.css'
const AppsFull: FC<{ loc: string; className?: string }> = ({ loc, className }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
const { data: billing } = useQuery(
consoleQuery.features.get.queryOptions({
select: (data) => ({ plan: data.billing.subscription.plan, apps: data.apps }),
diff --git a/web/app/components/billing/billing-page/index.tsx b/web/app/components/billing/billing-page/index.tsx
index 74c0fd0eee3..5d064606406 100644
--- a/web/app/components/billing/billing-page/index.tsx
+++ b/web/app/components/billing/billing-page/index.tsx
@@ -12,7 +12,7 @@ import { consoleQuery } from '@/service/console'
import PlanComp from '../plan'
const Billing: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
const isCurrentWorkspaceManager = useAtomValue(isCurrentWorkspaceManagerAtom)
const deploymentEdition = useAtomValue(deploymentEditionAtom)
usePrefetchQuery(consoleQuery.features.vectorSpace.get.queryOptions())
diff --git a/web/app/components/billing/hooks/use-education-discount.ts b/web/app/components/billing/hooks/use-education-discount.ts
index a2ccd0ca101..2f1cd3de0b1 100644
--- a/web/app/components/billing/hooks/use-education-discount.ts
+++ b/web/app/components/billing/hooks/use-education-discount.ts
@@ -7,7 +7,7 @@ import { isCurrentWorkspaceManagerAtom } from '@/context/workspace-state'
import { consoleClient } from '@/service/console'
export function useEducationDiscount() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
const isCurrentWorkspaceManager = useAtomValue(isCurrentWorkspaceManagerAtom)
const [isEducationDiscountLoading, setIsEducationDiscountLoading] = useState(false)
diff --git a/web/app/components/billing/plan-upgrade-modal/index.tsx b/web/app/components/billing/plan-upgrade-modal/index.tsx
index 8ab65793132..a30db1bb283 100644
--- a/web/app/components/billing/plan-upgrade-modal/index.tsx
+++ b/web/app/components/billing/plan-upgrade-modal/index.tsx
@@ -29,7 +29,7 @@ export function PlanUpgradeModal({
show,
onClose,
}: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
const [, setPricing] = useQueryState(pricingQueryParamName, pricingQueryParser)
const handleUpgrade = useCallback(() => {
diff --git a/web/app/components/billing/plan/index.tsx b/web/app/components/billing/plan/index.tsx
index 346ea252dee..458a474ecd0 100644
--- a/web/app/components/billing/plan/index.tsx
+++ b/web/app/components/billing/plan/index.tsx
@@ -29,7 +29,7 @@ const selectEducationPlanStatus = ({ allow_refresh, is_student }: EducationStatu
})
const PlanComp: FC<Props> = ({ loc }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'education'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/billing/pricing/content.tsx b/web/app/components/billing/pricing/content.tsx
index 73e14e75a63..7bde6d8ee41 100644
--- a/web/app/components/billing/pricing/content.tsx
+++ b/web/app/components/billing/pricing/content.tsx
@@ -22,7 +22,7 @@ import { SelfHostedPlanItem } from './plans/self-hosted-plan-item'
type BillingInterval = GetBillingSubscriptionData['query']['interval']
export function PricingContent() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appApi', 'billing', 'common'])
const featuresQuery = useQuery(consoleQuery.features.get.queryOptions())
const { data: features } = featuresQuery
const educationEnabled = features?.education.enabled ?? false
diff --git a/web/app/components/billing/pricing/dialog-content.tsx b/web/app/components/billing/pricing/dialog-content.tsx
index 262266ac01c..b40f7be1ae9 100644
--- a/web/app/components/billing/pricing/dialog-content.tsx
+++ b/web/app/components/billing/pricing/dialog-content.tsx
@@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next'
import { PricingContent } from './content'
export function PricingDialogContent() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<>
diff --git a/web/app/components/billing/pricing/footer.tsx b/web/app/components/billing/pricing/footer.tsx
index f729dbecc90..64d2422bef1 100644
--- a/web/app/components/billing/pricing/footer.tsx
+++ b/web/app/components/billing/pricing/footer.tsx
@@ -13,7 +13,7 @@ export function PricingFooter({ category }: { category: 'cloud' | 'self-hosted'
const locale = useLocale()
const comparisonPage = category === 'cloud' ? 'dify-cloud' : 'dify-enterprise'
const pricingPageURL = `https://dify.ai${websiteLocalePaths[locale] ?? ''}/pricing/${comparisonPage}#compare`
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
return (
<div className="flex min-h-16 w-full justify-center border-t border-divider-accent px-10">
diff --git a/web/app/components/billing/pricing/header.tsx b/web/app/components/billing/pricing/header.tsx
index 64db8687753..cddbe4f37d3 100644
--- a/web/app/components/billing/pricing/header.tsx
+++ b/web/app/components/billing/pricing/header.tsx
@@ -6,7 +6,7 @@ import { DifyLogo } from '../../base/logo/dify-logo'
import styles from './header.module.css'
const Header = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
return (
<div className="flex min-h-26.25 w-full justify-center px-10">
diff --git a/web/app/components/billing/pricing/plans/cloud-plan-item/index.tsx b/web/app/components/billing/pricing/plans/cloud-plan-item/index.tsx
index 2468ed745d2..3079ac1e5b9 100644
--- a/web/app/components/billing/pricing/plans/cloud-plan-item/index.tsx
+++ b/web/app/components/billing/pricing/plans/cloud-plan-item/index.tsx
@@ -44,7 +44,7 @@ type CloudPlanItemProps = {
export function CloudPlanItem({ plan, billingInterval, billing }: CloudPlanItemProps) {
const currentPlan = billing?.currentPlan
const isEducationDiscountEligible = billing?.isEducationDiscountEligible
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'common', 'education'])
const canManageBilling = useAtomValue(isCurrentWorkspaceManagerAtom)
const [isPlanActionPending, setIsPlanActionPending] = React.useState(false)
const isYearly = billingInterval === 'year'
diff --git a/web/app/components/billing/pricing/plans/cloud-plan-item/list/index.tsx b/web/app/components/billing/pricing/plans/cloud-plan-item/list/index.tsx
index 6e7e5ba14e6..dbac701af20 100644
--- a/web/app/components/billing/pricing/plans/cloud-plan-item/list/index.tsx
+++ b/web/app/components/billing/pricing/plans/cloud-plan-item/list/index.tsx
@@ -5,7 +5,7 @@ import { ALL_PLANS, NUM_INFINITE } from '../../../../config'
import { CloudPlanFeature } from './item'
export function CloudPlanFeatures({ plan }: { plan: CloudPlan }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
const isFreePlan = plan === 'sandbox'
const planInfo = ALL_PLANS[plan]
diff --git a/web/app/components/billing/pricing/plans/self-hosted-plan-item/index.tsx b/web/app/components/billing/pricing/plans/self-hosted-plan-item/index.tsx
index f6f0680f5d2..a024953cbf3 100644
--- a/web/app/components/billing/pricing/plans/self-hosted-plan-item/index.tsx
+++ b/web/app/components/billing/pricing/plans/self-hosted-plan-item/index.tsx
@@ -40,7 +40,7 @@ const STYLE_MAP = {
}
export function SelfHostedPlanItem({ plan }: { plan: SelfHostedPlan }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
const { theme } = useTheme()
const i18nPrefix = `plans.${plan}` as const
const isFreePlan = plan === 'community'
diff --git a/web/app/components/billing/pricing/plans/self-hosted-plan-item/list/index.tsx b/web/app/components/billing/pricing/plans/self-hosted-plan-item/list/index.tsx
index b6ccaafce39..f84edfc0273 100644
--- a/web/app/components/billing/pricing/plans/self-hosted-plan-item/list/index.tsx
+++ b/web/app/components/billing/pricing/plans/self-hosted-plan-item/list/index.tsx
@@ -3,7 +3,7 @@ import { Trans, useTranslation } from 'react-i18next'
import { SelfHostedPlanFeature } from './item'
export function SelfHostedPlanFeatures({ plan }: { plan: SelfHostedPlan }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
const i18nPrefix = `plans.${plan}` as const
const features = t(($) => $[`${i18nPrefix}.features`], {
ns: 'billing',
diff --git a/web/app/components/billing/priority-label/index.tsx b/web/app/components/billing/priority-label/index.tsx
index 3c1140e6099..a6cb27fd09d 100644
--- a/web/app/components/billing/priority-label/index.tsx
+++ b/web/app/components/billing/priority-label/index.tsx
@@ -12,7 +12,7 @@ type PriorityLabelProps = {
}
const PriorityLabel = ({ className }: PriorityLabelProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
const deploymentEdition = useAtomValue(deploymentEditionAtom)
const { data: plan } = useQuery(
consoleQuery.features.get.queryOptions({
diff --git a/web/app/components/billing/trigger-events-limit-modal/index.tsx b/web/app/components/billing/trigger-events-limit-modal/index.tsx
index 624976264e9..01fd35639bc 100644
--- a/web/app/components/billing/trigger-events-limit-modal/index.tsx
+++ b/web/app/components/billing/trigger-events-limit-modal/index.tsx
@@ -18,7 +18,7 @@ export default function TriggerEventsLimitModal({
total,
resetInDays,
}: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
return (
<PlanUpgradeModal
diff --git a/web/app/components/billing/upgrade-btn/index.tsx b/web/app/components/billing/upgrade-btn/index.tsx
index d73184ccc69..ebd157bb2e8 100644
--- a/web/app/components/billing/upgrade-btn/index.tsx
+++ b/web/app/components/billing/upgrade-btn/index.tsx
@@ -41,7 +41,7 @@ const UpgradeBtn: FC<Props> = ({
loc,
labelKey,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/billing/usage-info/index.tsx b/web/app/components/billing/usage-info/index.tsx
index 24d20428eab..9b7b5a399be 100644
--- a/web/app/components/billing/usage-info/index.tsx
+++ b/web/app/components/billing/usage-info/index.tsx
@@ -49,7 +49,7 @@ const UsageInfo: FC<Props> = ({
}) => {
const labelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
const isBelowThreshold = !usageUnknown && storageMode && usage < storageThreshold
const isSandboxFull = !usageUnknown && storageMode && isSandboxPlan && usage >= storageThreshold
diff --git a/web/app/components/billing/usage-info/vector-space-info.tsx b/web/app/components/billing/usage-info/vector-space-info.tsx
index 984384192c5..c5829baa4f5 100644
--- a/web/app/components/billing/usage-info/vector-space-info.tsx
+++ b/web/app/components/billing/usage-info/vector-space-info.tsx
@@ -15,7 +15,7 @@ type Props = Readonly<{
const STORAGE_THRESHOLD_MB = getPlanVectorSpaceLimitMB('sandbox')
const VectorSpaceInfo: FC<Props> = ({ className }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
const [{ data: plan }, { data: vectorSpace }] = useSuspenseQueries({
queries: [
consoleQuery.features.get.queryOptions({
diff --git a/web/app/components/billing/vector-space-full/index.tsx b/web/app/components/billing/vector-space-full/index.tsx
index b19d5d01663..bbee0e888e5 100644
--- a/web/app/components/billing/vector-space-full/index.tsx
+++ b/web/app/components/billing/vector-space-full/index.tsx
@@ -9,7 +9,7 @@ import VectorSpaceInfo from '../usage-info/vector-space-info'
import s from './style.module.css'
const VectorSpaceFull: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
return (
<GridMask
diff --git a/web/app/components/billing/vector-space-unavailable/index.tsx b/web/app/components/billing/vector-space-unavailable/index.tsx
index 6491a6b71ae..ac0470622fe 100644
--- a/web/app/components/billing/vector-space-unavailable/index.tsx
+++ b/web/app/components/billing/vector-space-unavailable/index.tsx
@@ -9,7 +9,7 @@ type Props = {
}
const VectorSpaceUnavailable = ({ isRetrying, onRetry }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'common'])
return (
<div
diff --git a/web/app/components/custom/custom-page/index.tsx b/web/app/components/custom/custom-page/index.tsx
index e8042bc2aa4..cc3aa6cd7ad 100644
--- a/web/app/components/custom/custom-page/index.tsx
+++ b/web/app/components/custom/custom-page/index.tsx
@@ -11,7 +11,7 @@ import { consoleQuery } from '@/service/console'
import CustomWebAppBrand from '../custom-web-app-brand'
const CustomPage = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'custom'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/custom/custom-web-app-brand/hooks/use-web-app-brand.ts b/web/app/components/custom/custom-web-app-brand/hooks/use-web-app-brand.ts
index 65a52000335..18f952fbfc5 100644
--- a/web/app/components/custom/custom-web-app-brand/hooks/use-web-app-brand.ts
+++ b/web/app/components/custom/custom-web-app-brand/hooks/use-web-app-brand.ts
@@ -14,7 +14,7 @@ import { hasPermission } from '@/utils/permission'
const MAX_LOGO_FILE_SIZE = 5 * 1024 * 1024
const WEB_APP_LOGO_UPLOAD_URL = '/workspaces/custom-config/webapp-logo/upload'
const useWebAppBrand = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { data: canReplaceLogo } = useQuery(
consoleQuery.features.get.queryOptions({
select: (data) => data.can_replace_logo,
diff --git a/web/app/components/custom/custom-web-app-brand/index.tsx b/web/app/components/custom/custom-web-app-brand/index.tsx
index 5ce5f420e10..176a27488b7 100644
--- a/web/app/components/custom/custom-web-app-brand/index.tsx
+++ b/web/app/components/custom/custom-web-app-brand/index.tsx
@@ -10,7 +10,7 @@ import useWebAppBrand from './hooks/use-web-app-brand'
const ALLOW_FILE_EXTENSIONS = ['svg', 'png']
const CustomWebAppBrand = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview', 'common', 'custom'])
const {
fileId,
imgKey,
diff --git a/web/app/components/datasets/access-config/index.tsx b/web/app/components/datasets/access-config/index.tsx
index b4ae968f9b8..c7bdcfef987 100644
--- a/web/app/components/datasets/access-config/index.tsx
+++ b/web/app/components/datasets/access-config/index.tsx
@@ -30,7 +30,7 @@ type DatasetAccessConfigPageProps = {
}
const DatasetAccessConfigPage = ({ datasetId }: DatasetAccessConfigPageProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const locale = useLocale()
const language = useMemo(() => getAccessControlTemplateLanguage(locale), [locale])
const [currentPage, setCurrentPage] = useState(1)
diff --git a/web/app/components/datasets/common/chunking-mode-label.tsx b/web/app/components/datasets/common/chunking-mode-label.tsx
index 5cf83ff0afe..e12f5d3c5d5 100644
--- a/web/app/components/datasets/common/chunking-mode-label.tsx
+++ b/web/app/components/datasets/common/chunking-mode-label.tsx
@@ -11,7 +11,7 @@ type Props = Readonly<{
}>
const ChunkingModeLabel: FC<Props> = ({ isGeneralMode, isQAMode }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const iconClassName = isGeneralMode
? 'i-custom-vender-knowledge-general-chunk'
: 'i-custom-vender-knowledge-parent-child-chunk'
diff --git a/web/app/components/datasets/common/document-picker/index.tsx b/web/app/components/datasets/common/document-picker/index.tsx
index b9e38a49c1a..b9b65b86d81 100644
--- a/web/app/components/datasets/common/document-picker/index.tsx
+++ b/web/app/components/datasets/common/document-picker/index.tsx
@@ -61,7 +61,7 @@ function DocumentPickerTriggerValue({
document?: SimpleDocumentDetail | null
parentMode?: ParentMode
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const isGeneralMode = document?.doc_form === ChunkingMode.text
const isParentChild = document?.doc_form === ChunkingMode.parentChild
const isQAMode = document?.doc_form === ChunkingMode.qa
@@ -108,7 +108,7 @@ function DocumentPickerTriggerValue({
}
export function DocumentPicker({ datasetId, value, parentMode, onChange }: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [searchValue, setSearchValue] = useState('')
const debouncedSearchValue = useDebounce(searchValue, { wait: 500 })
diff --git a/web/app/components/datasets/common/document-picker/preview-document-picker.tsx b/web/app/components/datasets/common/document-picker/preview-document-picker.tsx
index 998c6d8d7c0..c49a994d814 100644
--- a/web/app/components/datasets/common/document-picker/preview-document-picker.tsx
+++ b/web/app/components/datasets/common/document-picker/preview-document-picker.tsx
@@ -19,7 +19,7 @@ type Props = Readonly<{
}>
const PreviewDocumentPicker: FC<Props> = ({ className, value, files, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const name = value?.name || ''
const extension = value?.extension
diff --git a/web/app/components/datasets/common/document-status-with-action/auto-disabled-document.tsx b/web/app/components/datasets/common/document-status-with-action/auto-disabled-document.tsx
index 7f91928582e..cba6d20fd12 100644
--- a/web/app/components/datasets/common/document-status-with-action/auto-disabled-document.tsx
+++ b/web/app/components/datasets/common/document-status-with-action/auto-disabled-document.tsx
@@ -15,7 +15,7 @@ type Props = Readonly<{
}>
const AutoDisabledDocument: FC<Props> = ({ datasetId }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const { data, isLoading } = useAutoDisabledDocuments(datasetId)
const invalidDisabledDocument = useInvalidDisabledDocument()
const documentIds = data?.document_ids
diff --git a/web/app/components/datasets/common/document-status-with-action/index-failed.tsx b/web/app/components/datasets/common/document-status-with-action/index-failed.tsx
index 22b8f8aae4d..4102874d960 100644
--- a/web/app/components/datasets/common/document-status-with-action/index-failed.tsx
+++ b/web/app/components/datasets/common/document-status-with-action/index-failed.tsx
@@ -34,7 +34,7 @@ const indexStateReducer = (state: IIndexState, action: IAction) => {
}
const RetryButton: FC<Props> = ({ datasetId }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const [indexState, dispatch] = useReducer(indexStateReducer, { value: 'success' })
const { data: errorDocs, isLoading, refetch: refetchErrorDocs } = useDatasetErrorDocs(datasetId)
diff --git a/web/app/components/datasets/common/economical-retrieval-method-config/index.tsx b/web/app/components/datasets/common/economical-retrieval-method-config/index.tsx
index b4c4b1ab436..14681c0f682 100644
--- a/web/app/components/datasets/common/economical-retrieval-method-config/index.tsx
+++ b/web/app/components/datasets/common/economical-retrieval-method-config/index.tsx
@@ -16,7 +16,7 @@ type Props = Readonly<{
}>
const EconomicalRetrievalMethodConfig: FC<Props> = ({ disabled = false, value, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset', 'datasetSettings'])
return (
<RadioGroup<RETRIEVE_METHOD>
diff --git a/web/app/components/datasets/common/image-previewer/index.tsx b/web/app/components/datasets/common/image-previewer/index.tsx
index 71336dea24d..679dfd7b80c 100644
--- a/web/app/components/datasets/common/image-previewer/index.tsx
+++ b/web/app/components/datasets/common/image-previewer/index.tsx
@@ -29,7 +29,7 @@ type ImagePreviewerProps = {
}
const ImagePreviewer = ({ images, initialIndex = 0, onClose }: ImagePreviewerProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [currentIndex, setCurrentIndex] = useState(initialIndex)
const [cachedImages, setCachedImages] = useState<Record<string, CachedImage>>(() => {
return images.reduce(
diff --git a/web/app/components/datasets/common/image-uploader/hooks/use-upload.ts b/web/app/components/datasets/common/image-uploader/hooks/use-upload.ts
index 30a2295ebcf..99986b8b93f 100644
--- a/web/app/components/datasets/common/image-uploader/hooks/use-upload.ts
+++ b/web/app/components/datasets/common/image-uploader/hooks/use-upload.ts
@@ -11,7 +11,7 @@ import { useFileStore } from '../store'
import { getFileType, getFileUploadConfig, traverseFileEntry } from '../utils'
export const useUpload = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset', 'datasetHitTesting'])
const fileStore = useFileStore()
const [dragging, setDragging] = useState(false)
diff --git a/web/app/components/datasets/common/image-uploader/image-uploader-in-chunk/image-input.tsx b/web/app/components/datasets/common/image-uploader/image-uploader-in-chunk/image-input.tsx
index 126c495d028..480fc8eb0a2 100644
--- a/web/app/components/datasets/common/image-uploader/image-uploader-in-chunk/image-input.tsx
+++ b/web/app/components/datasets/common/image-uploader/image-uploader-in-chunk/image-input.tsx
@@ -6,7 +6,7 @@ import { ACCEPT_TYPES } from '../constants'
import { useUpload } from '../hooks/use-upload'
const ImageUploader = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const {
dragging,
diff --git a/web/app/components/datasets/common/image-uploader/image-uploader-in-chunk/image-item.tsx b/web/app/components/datasets/common/image-uploader/image-uploader-in-chunk/image-item.tsx
index 6bd81861d00..dc781596974 100644
--- a/web/app/components/datasets/common/image-uploader/image-uploader-in-chunk/image-item.tsx
+++ b/web/app/components/datasets/common/image-uploader/image-uploader-in-chunk/image-item.tsx
@@ -14,7 +14,7 @@ type ImageItemProps = {
onPreview?: (fileId: string) => void
}
const ImageItem = ({ file, showDeleteAction, onRemove, onReUpload, onPreview }: ImageItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'custom'])
const { id, progress, base64Url, sourceUrl } = file
const handlePreview = useCallback(
diff --git a/web/app/components/datasets/common/image-uploader/image-uploader-in-retrieval-testing/image-input.tsx b/web/app/components/datasets/common/image-uploader/image-uploader-in-retrieval-testing/image-input.tsx
index 45d34530bfd..b246be3818e 100644
--- a/web/app/components/datasets/common/image-uploader/image-uploader-in-retrieval-testing/image-input.tsx
+++ b/web/app/components/datasets/common/image-uploader/image-uploader-in-retrieval-testing/image-input.tsx
@@ -7,7 +7,7 @@ import { useUpload } from '../hooks/use-upload'
import { useFileStoreWithSelector } from '../store'
const ImageUploader = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetHitTesting'])
const files = useFileStoreWithSelector((s) => s.files)
const { fileUploadConfig, uploaderRef, fileChangeHandle, selectHandle } = useUpload()
diff --git a/web/app/components/datasets/common/image-uploader/image-uploader-in-retrieval-testing/image-item.tsx b/web/app/components/datasets/common/image-uploader/image-uploader-in-retrieval-testing/image-item.tsx
index 0d8e0125161..f98f8206b7f 100644
--- a/web/app/components/datasets/common/image-uploader/image-uploader-in-retrieval-testing/image-item.tsx
+++ b/web/app/components/datasets/common/image-uploader/image-uploader-in-retrieval-testing/image-item.tsx
@@ -14,7 +14,7 @@ type ImageItemProps = {
onPreview?: (fileId: string) => void
}
const ImageItem = ({ file, showDeleteAction, onRemove, onReUpload, onPreview }: ImageItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'custom'])
const { id, progress, base64Url, sourceUrl } = file
const handlePreview = useCallback(
diff --git a/web/app/components/datasets/common/image-uploader/image-uploader-in-retrieval-testing/index.tsx b/web/app/components/datasets/common/image-uploader/image-uploader-in-retrieval-testing/index.tsx
index ba7ac3e7d61..d4b5a0783b8 100644
--- a/web/app/components/datasets/common/image-uploader/image-uploader-in-retrieval-testing/index.tsx
+++ b/web/app/components/datasets/common/image-uploader/image-uploader-in-retrieval-testing/index.tsx
@@ -23,7 +23,7 @@ const ImageUploaderInRetrievalTesting = ({
className,
actionAreaClassName,
}: ImageUploaderInRetrievalTestingProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetHitTesting'])
const files = useFileStoreWithSelector((s) => s.files)
const [previewIndex, setPreviewIndex] = useState(0)
const [previewImages, setPreviewImages] = useState<ImageInfo[]>([])
diff --git a/web/app/components/datasets/common/multimodal-retrieval-guidance/index.tsx b/web/app/components/datasets/common/multimodal-retrieval-guidance/index.tsx
index 59f1fa8d5c2..dd6aec4290d 100644
--- a/web/app/components/datasets/common/multimodal-retrieval-guidance/index.tsx
+++ b/web/app/components/datasets/common/multimodal-retrieval-guidance/index.tsx
@@ -35,7 +35,7 @@ const isVisionEmbeddingModel = (
}
const useVariantCopy = (variant: MultimodalRetrievalGuidanceVariant) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetSettings'])
if (variant === 'create') {
return {
@@ -70,7 +70,7 @@ const useVariantCopy = (variant: MultimodalRetrievalGuidanceVariant) => {
}
export const MultimodalRetrievalGuidanceLearnMore = ({ className }: { className?: string }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetSettings'])
return (
<div className={cn('flex items-center body-xs-regular text-text-tertiary', className)}>
@@ -98,7 +98,7 @@ export const MultimodalRetrievalGuidance = ({
embeddingModelList,
className,
}: MultimodalRetrievalGuidanceProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetSettings'])
const { title, description } = useVariantCopy(variant)
const dismissLabel = t(($) => $['form.multimodalRetrievalGuidance.dismiss'], {
ns: 'datasetSettings',
diff --git a/web/app/components/datasets/common/retrieval-method-config/index.tsx b/web/app/components/datasets/common/retrieval-method-config/index.tsx
index 59ef65d83e1..079c9d4f430 100644
--- a/web/app/components/datasets/common/retrieval-method-config/index.tsx
+++ b/web/app/components/datasets/common/retrieval-method-config/index.tsx
@@ -28,7 +28,7 @@ const RetrievalMethodConfig: FC<Props> = ({
showMultiModalTip = false,
onChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset', 'datasetSettings'])
const { data: retrievalSetting } = useQuery(
consoleQuery.datasets.retrievalSetting.get.queryOptions(),
)
diff --git a/web/app/components/datasets/common/retrieval-param-config/index.tsx b/web/app/components/datasets/common/retrieval-param-config/index.tsx
index fe2317f0d07..a3149c92b36 100644
--- a/web/app/components/datasets/common/retrieval-param-config/index.tsx
+++ b/web/app/components/datasets/common/retrieval-param-config/index.tsx
@@ -39,7 +39,7 @@ const RetrievalParamConfig: FC<Props> = ({
disabled = false,
onChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset', 'datasetSettings', 'workflow'])
const rerankLabelId = useId()
const canToggleRerankModalEnable = type !== RETRIEVE_METHOD.hybrid
const isEconomical = type === RETRIEVE_METHOD.keywordSearch
diff --git a/web/app/components/datasets/common/vector-space-admission-alert.tsx b/web/app/components/datasets/common/vector-space-admission-alert.tsx
index b1f6cdb184e..0102d17f044 100644
--- a/web/app/components/datasets/common/vector-space-admission-alert.tsx
+++ b/web/app/components/datasets/common/vector-space-admission-alert.tsx
@@ -12,7 +12,7 @@ const VectorSpaceAdmissionAlert = ({
estimatedMb,
planLimitMb,
}: VectorSpaceAdmissionAlertProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
return (
<div
diff --git a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/dsl-confirm-modal.tsx b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/dsl-confirm-modal.tsx
index 56965ebb472..d607e2aadd5 100644
--- a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/dsl-confirm-modal.tsx
+++ b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/dsl-confirm-modal.tsx
@@ -24,7 +24,7 @@ const DSLConfirmModal = ({
onConfirm,
confirmDisabled = false,
}: DSLConfirmModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
return (
<AlertDialog
diff --git a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/hooks/use-dsl-import.ts b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/hooks/use-dsl-import.ts
index bcb9ada1cb2..f1d1af9c504 100644
--- a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/hooks/use-dsl-import.ts
+++ b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/hooks/use-dsl-import.ts
@@ -54,7 +54,7 @@ export const useDSLImport = ({
onClose,
}: UseDSLImportOptions) => {
const { push } = useRouter()
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'datasetPipeline'])
const [currentFile, setDSLFile] = useState<File>()
const [fileContent, setFileContent] = useState<string>()
const [currentTab, setCurrentTab] = useState(activeTab)
diff --git a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/index.tsx b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/index.tsx
index 2233ff22331..adcf6bd3148 100644
--- a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/index.tsx
+++ b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/index.tsx
@@ -27,7 +27,7 @@ const CreateFromDSLModal = ({
activeTab = CreateFromDSLModalTab.FROM_FILE,
dslUrl = '',
}: CreateFromDSLModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const {
currentFile,
diff --git a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/uploader.tsx b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/uploader.tsx
index e68b40b68bb..bd0d8145fba 100644
--- a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/uploader.tsx
+++ b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/uploader.tsx
@@ -15,7 +15,7 @@ type Props = Readonly<{
className?: string
}>
const Uploader: FC<Props> = ({ file, updateFile, className }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common', 'datasetCreation'])
const [dragging, setDragging] = useState(false)
const dropRef = useRef<HTMLDivElement>(null)
const dragRef = useRef<HTMLDivElement>(null)
diff --git a/web/app/components/datasets/create-from-pipeline/footer.tsx b/web/app/components/datasets/create-from-pipeline/footer.tsx
index 8cc05e30eb2..60a56059f90 100644
--- a/web/app/components/datasets/create-from-pipeline/footer.tsx
+++ b/web/app/components/datasets/create-from-pipeline/footer.tsx
@@ -8,7 +8,7 @@ import { useInvalidDatasetList } from '@/service/knowledge/use-dataset'
import CreateFromDSLModal, { CreateFromDSLModalTab } from './create-options/create-from-dsl-modal'
const Footer = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const [showImportModal, setShowImportModal] = useState(false)
diff --git a/web/app/components/datasets/create-from-pipeline/header.tsx b/web/app/components/datasets/create-from-pipeline/header.tsx
index 8ae1abe6ac4..279e07cf791 100644
--- a/web/app/components/datasets/create-from-pipeline/header.tsx
+++ b/web/app/components/datasets/create-from-pipeline/header.tsx
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
import Link from '@/next/link'
const Header = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
return (
<div className="relative flex px-16 pt-5 pb-2 system-md-semibold text-text-primary">
diff --git a/web/app/components/datasets/create-from-pipeline/index.tsx b/web/app/components/datasets/create-from-pipeline/index.tsx
index 79d011db492..98ef4cb6cd9 100644
--- a/web/app/components/datasets/create-from-pipeline/index.tsx
+++ b/web/app/components/datasets/create-from-pipeline/index.tsx
@@ -7,7 +7,7 @@ import Header from './header'
import List from './list'
const CreateFromPipeline = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
useDocumentTitle(
t(($) => $['stepByStepTour.guides.knowledge.empty.pipeline.title'], { ns: 'common' }),
)
diff --git a/web/app/components/datasets/create-from-pipeline/list/create-card.tsx b/web/app/components/datasets/create-from-pipeline/list/create-card.tsx
index c9ed34224d0..3cb501b67cb 100644
--- a/web/app/components/datasets/create-from-pipeline/list/create-card.tsx
+++ b/web/app/components/datasets/create-from-pipeline/list/create-card.tsx
@@ -9,7 +9,7 @@ import { useCreatePipelineDataset } from '@/service/knowledge/use-create-dataset
import { useInvalidDatasetList } from '@/service/knowledge/use-dataset'
const CreateCard = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const { push } = useRouter()
const { mutateAsync: createEmptyDataset } = useCreatePipelineDataset()
diff --git a/web/app/components/datasets/create-from-pipeline/list/customized-list.tsx b/web/app/components/datasets/create-from-pipeline/list/customized-list.tsx
index 20e2fcef10d..cbbe5e6de2e 100644
--- a/web/app/components/datasets/create-from-pipeline/list/customized-list.tsx
+++ b/web/app/components/datasets/create-from-pipeline/list/customized-list.tsx
@@ -3,7 +3,7 @@ import { usePipelineTemplateList } from '@/service/use-pipeline'
import TemplateCard from './template-card'
const CustomizedList = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const { data: pipelineList, isLoading } = usePipelineTemplateList({ type: 'customized' })
const list = pipelineList?.pipeline_templates || []
diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/actions.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/actions.tsx
index 26915ac5b54..11bd8068214 100644
--- a/web/app/components/datasets/create-from-pipeline/list/template-card/actions.tsx
+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/actions.tsx
@@ -27,7 +27,7 @@ const Actions = ({
handleExportDSL,
handleDelete,
}: ActionsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetPipeline'])
const [isMoreOperationsOpen, setIsMoreOperationsOpen] = React.useState(false)
return (
diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/content.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/content.tsx
index d281791b150..ed1063da441 100644
--- a/web/app/components/datasets/create-from-pipeline/list/template-card/content.tsx
+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/content.tsx
@@ -13,7 +13,7 @@ type ContentProps = {
}
const Content = ({ name, description, iconInfo, chunkStructure }: ContentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const iconClassName =
DOC_FORM_ICON_CLASS_WITH_BG[chunkStructure] || 'i-custom-public-knowledge-dataset-card-general'
diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/details/hooks.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/details/hooks.tsx
index 8853dc6fbb3..d8bf5344e9f 100644
--- a/web/app/components/datasets/create-from-pipeline/list/template-card/details/hooks.tsx
+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/details/hooks.tsx
@@ -4,7 +4,7 @@ import { ChunkingMode } from '@/models/datasets'
import { EffectColor } from './types'
export const useChunkStructureConfig = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const GeneralOption: Option = {
icon: <span aria-hidden className="i-custom-vender-knowledge-general-chunk size-4" />,
diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/details/index.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/details/index.tsx
index 2037bf31d99..9e4e10cc7ad 100644
--- a/web/app/components/datasets/create-from-pipeline/list/template-card/details/index.tsx
+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/details/index.tsx
@@ -22,7 +22,7 @@ type DetailsProps = {
const Details = ({ id, type, onApplyTemplate, onClose }: DetailsProps) => {
const structureLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const { data: pipelineTemplateInfo } = usePipelineTemplateById(
{
template_id: id,
diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx
index 17cc8ef394e..19b5b0b144e 100644
--- a/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx
+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx
@@ -20,7 +20,7 @@ type EditPipelineInfoProps = {
}
const EditPipelineInfo = ({ onClose, pipeline }: EditPipelineInfoProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetPipeline'])
const [name, setName] = useState(pipeline.name)
const iconInfo = pipeline.icon
const [appIcon, setAppIcon] = useState<AppIconSelection>(
diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx
index 5bc3f8a5a43..73816d2baad 100644
--- a/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx
+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx
@@ -37,7 +37,7 @@ type TemplateCardProps = {
}
const TemplateCard = ({ pipeline, showMoreOperations = true, type }: TemplateCardProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetPipeline'])
const { push } = useRouter()
const [showEditModal, setShowEditModal] = useState(false)
const [showDeleteConfirm, setShowConfirmDelete] = useState(false)
diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/operations.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/operations.tsx
index ba28f0a6bcc..f2c8c0ebf37 100644
--- a/web/app/components/datasets/create-from-pipeline/list/template-card/operations.tsx
+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/operations.tsx
@@ -10,7 +10,7 @@ type OperationsProps = {
}
const Operations = ({ openEditModal, onDelete, onExport, onClose }: OperationsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetPipeline'])
const onClickEdit = (e: React.MouseEvent<HTMLDivElement>) => {
e.stopPropagation()
diff --git a/web/app/components/datasets/create/embedding-process/index.tsx b/web/app/components/datasets/create/embedding-process/index.tsx
index b892df1123d..9f1a93266bd 100644
--- a/web/app/components/datasets/create/embedding-process/index.tsx
+++ b/web/app/components/datasets/create/embedding-process/index.tsx
@@ -35,7 +35,7 @@ const StatusHeader: FC<{ isEmbedding: boolean; isCompleted: boolean }> = ({
isEmbedding,
isCompleted,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
return (
<div
@@ -60,7 +60,7 @@ const ActionButtons: FC<{
documentsHref: string
onNavigateToDocuments: () => void
}> = ({ apiReferenceUrl, documentsHref, onNavigateToDocuments }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
return (
<div className="mt-6 flex flex-wrap items-center gap-2 py-2">
diff --git a/web/app/components/datasets/create/embedding-process/indexing-progress-item.tsx b/web/app/components/datasets/create/embedding-process/indexing-progress-item.tsx
index a438a0799d0..039cd69baac 100644
--- a/web/app/components/datasets/create/embedding-process/indexing-progress-item.tsx
+++ b/web/app/components/datasets/create/embedding-process/indexing-progress-item.tsx
@@ -20,7 +20,7 @@ type IndexingProgressItemProps = {
// Status icon component for completed/error states
const StatusIcon: FC<{ status: string; error?: string }> = ({ status, error }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
if (status === 'completed')
return <RiCheckboxCircleFill aria-hidden="true" className="size-4 shrink-0 text-text-success" />
@@ -75,7 +75,7 @@ const IndexingProgressItem: FC<IndexingProgressItemProps> = ({
sourceType,
notionIcon,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const nameId = useId()
const isEmbedding = isSourceEmbedding(detail)
const percent = getSourcePercent(detail)
diff --git a/web/app/components/datasets/create/embedding-process/rule-detail.tsx b/web/app/components/datasets/create/embedding-process/rule-detail.tsx
index bcd00b114ba..b0d3d722946 100644
--- a/web/app/components/datasets/create/embedding-process/rule-detail.tsx
+++ b/web/app/components/datasets/create/embedding-process/rule-detail.tsx
@@ -33,7 +33,12 @@ const RETRIEVAL_ICON_MAP: Partial<Record<RETRIEVE_METHOD, string>> = {
const isNumber = (value: unknown): value is number => typeof value === 'number'
const RuleDetail: FC<RuleDetailProps> = ({ sourceData, indexingType, retrievalMethod }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation([
+ 'dataset',
+ 'datasetCreation',
+ 'datasetDocuments',
+ 'datasetSettings',
+ ])
const segmentationRuleLabels = {
mode: t(($) => $['embedding.mode'], { ns: 'datasetDocuments' }),
diff --git a/web/app/components/datasets/create/embedding-process/upgrade-banner.tsx b/web/app/components/datasets/create/embedding-process/upgrade-banner.tsx
index 50d44bd0cd0..9f71381db9d 100644
--- a/web/app/components/datasets/create/embedding-process/upgrade-banner.tsx
+++ b/web/app/components/datasets/create/embedding-process/upgrade-banner.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
import UpgradeBtn from '@/app/components/billing/upgrade-btn'
const UpgradeBanner: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
return (
<div className="flex h-14 items-center rounded-xl border-[0.5px] border-black/5 bg-white p-3 shadow-md">
diff --git a/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx b/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx
index 3903a785a6c..be333a7070a 100644
--- a/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx
+++ b/web/app/components/datasets/create/empty-dataset-creation-modal/index.tsx
@@ -22,7 +22,7 @@ type IProps = {
const EmptyDatasetCreationModal = ({ show = false, onHide }: IProps) => {
const [inputValue, setInputValue] = useState('')
const [isSubmitting, setIsSubmitting] = useState(false)
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetCreation'])
const router = useRouter()
const invalidDatasetList = useInvalidDatasetList()
const submit = async () => {
diff --git a/web/app/components/datasets/create/file-preview/index.tsx b/web/app/components/datasets/create/file-preview/index.tsx
index fe75adf523d..b1991bc1ada 100644
--- a/web/app/components/datasets/create/file-preview/index.tsx
+++ b/web/app/components/datasets/create/file-preview/index.tsx
@@ -16,7 +16,7 @@ type IProps = {
}
const FilePreview = ({ file, hidePreview }: IProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetCreation'])
const headingId = useId()
const fileID = file?.id
const { data, isPending, isError } = useQuery(
diff --git a/web/app/components/datasets/create/file-uploader/components/file-list-item.tsx b/web/app/components/datasets/create/file-uploader/components/file-list-item.tsx
index e65cfc17450..07173d49acb 100644
--- a/web/app/components/datasets/create/file-uploader/components/file-list-item.tsx
+++ b/web/app/components/datasets/create/file-uploader/components/file-list-item.tsx
@@ -22,7 +22,7 @@ export type FileListItemProps = {
}
const FileListItem = ({ fileItem, onPreview, onRemove }: FileListItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetCreation'])
const fileNameId = useId()
const previewLabelId = useId()
const removeLabelId = useId()
diff --git a/web/app/components/datasets/create/file-uploader/components/upload-dropzone.tsx b/web/app/components/datasets/create/file-uploader/components/upload-dropzone.tsx
index bcf3b783e9e..96e40254795 100644
--- a/web/app/components/datasets/create/file-uploader/components/upload-dropzone.tsx
+++ b/web/app/components/datasets/create/file-uploader/components/upload-dropzone.tsx
@@ -31,7 +31,7 @@ const UploadDropzone = ({
onSelectFile,
onFileChange,
}: UploadDropzoneProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const deploymentEdition = useAtomValue(deploymentEditionAtom)
return (
diff --git a/web/app/components/datasets/create/file-uploader/hooks/use-file-upload.ts b/web/app/components/datasets/create/file-uploader/hooks/use-file-upload.ts
index 006cf6668d9..161041945be 100644
--- a/web/app/components/datasets/create/file-uploader/hooks/use-file-upload.ts
+++ b/web/app/components/datasets/create/file-uploader/hooks/use-file-upload.ts
@@ -69,7 +69,7 @@ export const useFileUpload = ({
supportBatchUpload = false,
allowedExtensions,
}: UseFileUploadOptions): UseFileUploadReturn => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetCreation'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/datasets/create/file-uploader/index.tsx b/web/app/components/datasets/create/file-uploader/index.tsx
index 1aa1cd3b2a7..242adf07614 100644
--- a/web/app/components/datasets/create/file-uploader/index.tsx
+++ b/web/app/components/datasets/create/file-uploader/index.tsx
@@ -26,7 +26,7 @@ const FileUploader = ({
onPreview,
supportBatchUpload = false,
}: IFileUploaderProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetCreation'])
const {
dropRef,
diff --git a/web/app/components/datasets/create/index.tsx b/web/app/components/datasets/create/index.tsx
index 4b942d02529..f3605fa11da 100644
--- a/web/app/components/datasets/create/index.tsx
+++ b/web/app/components/datasets/create/index.tsx
@@ -54,7 +54,7 @@ const DEFAULT_CRAWL_OPTIONS: CrawlOptions = {
}
const DatasetUpdateForm = ({ datasetId }: DatasetUpdateFormProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const router = useRouter()
const [, setSettingsDestination] = useQueryState(settingsQueryParamName, settingsQueryParser)
const datasetDetail = useDatasetDetailContextWithSelector((state) => state.dataset)
diff --git a/web/app/components/datasets/create/notion-page-preview/index.tsx b/web/app/components/datasets/create/notion-page-preview/index.tsx
index 3020d87b1cc..efe6ce28bd0 100644
--- a/web/app/components/datasets/create/notion-page-preview/index.tsx
+++ b/web/app/components/datasets/create/notion-page-preview/index.tsx
@@ -17,7 +17,7 @@ type IProps = {
}
const NotionPagePreview = ({ currentPage, notionCredentialId, hidePreview }: IProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetCreation'])
const [previewContent, setPreviewContent] = useState('')
const [loading, setLoading] = useState(true)
diff --git a/web/app/components/datasets/create/step-one/components/data-source-type-selector.tsx b/web/app/components/datasets/create/step-one/components/data-source-type-selector.tsx
index acd4a2baeb4..58cc310acf6 100644
--- a/web/app/components/datasets/create/step-one/components/data-source-type-selector.tsx
+++ b/web/app/components/datasets/create/step-one/components/data-source-type-selector.tsx
@@ -58,7 +58,7 @@ function DataSourceTypeSelector({
onChange,
onClearPreviews,
}: DataSourceTypeSelectorProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const isWebEnabled =
ENABLE_WEBSITE_FIRECRAWL || ENABLE_WEBSITE_JINAREADER || ENABLE_WEBSITE_WATERCRAWL
diff --git a/web/app/components/datasets/create/step-one/components/next-step-button.tsx b/web/app/components/datasets/create/step-one/components/next-step-button.tsx
index a2d5b110e61..e107ee43e14 100644
--- a/web/app/components/datasets/create/step-one/components/next-step-button.tsx
+++ b/web/app/components/datasets/create/step-one/components/next-step-button.tsx
@@ -13,7 +13,7 @@ type NextStepButtonProps = {
* Reusable next step button component for dataset creation flow.
*/
function NextStepButton({ disabled, onClick }: NextStepButtonProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
return (
<div className="flex max-w-160 justify-end gap-2">
diff --git a/web/app/components/datasets/create/step-one/components/preview-panel.tsx b/web/app/components/datasets/create/step-one/components/preview-panel.tsx
index cb00517773f..03868900289 100644
--- a/web/app/components/datasets/create/step-one/components/preview-panel.tsx
+++ b/web/app/components/datasets/create/step-one/components/preview-panel.tsx
@@ -34,7 +34,7 @@ function PreviewPanel({
hideWebsitePreview,
hidePlanUpgradeModal,
}: PreviewPanelProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
return (
<div className="w-full min-w-0 xl:h-full xl:w-1/2 xl:overflow-y-auto">
diff --git a/web/app/components/datasets/create/step-one/index.tsx b/web/app/components/datasets/create/step-one/index.tsx
index cdd8e07b1f3..760bdb08334 100644
--- a/web/app/components/datasets/create/step-one/index.tsx
+++ b/web/app/components/datasets/create/step-one/index.tsx
@@ -99,7 +99,7 @@ const StepOne = ({
onCrawlOptionsChange,
authedDataSourceList,
}: IStepOneProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const sourceLabelId = useId()
const dataset = useDatasetDetailContextWithSelector((state) => state.dataset)
const deploymentEdition = useAtomValue(deploymentEditionAtom)
diff --git a/web/app/components/datasets/create/step-one/upgrade-card.tsx b/web/app/components/datasets/create/step-one/upgrade-card.tsx
index 112dc53fe29..8b918391e0c 100644
--- a/web/app/components/datasets/create/step-one/upgrade-card.tsx
+++ b/web/app/components/datasets/create/step-one/upgrade-card.tsx
@@ -14,7 +14,7 @@ import UpgradeBtn from '@/app/components/billing/upgrade-btn'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
const UpgradeCard: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/datasets/create/step-three/index.tsx b/web/app/components/datasets/create/step-three/index.tsx
index 76e6080135d..9f3dc3a23ca 100644
--- a/web/app/components/datasets/create/step-three/index.tsx
+++ b/web/app/components/datasets/create/step-three/index.tsx
@@ -24,7 +24,7 @@ const StepThree = ({
creationCache,
retrievalMethod,
}: StepThreeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation', 'datasetPipeline'])
const docLink = useDocLink()
const iconInfo = creationCache?.dataset?.icon_info || {
diff --git a/web/app/components/datasets/create/step-two/components/general-chunking-options.tsx b/web/app/components/datasets/create/step-two/components/general-chunking-options.tsx
index 0fc59968c49..d1f28a5243f 100644
--- a/web/app/components/datasets/create/step-two/components/general-chunking-options.tsx
+++ b/web/app/components/datasets/create/step-two/components/general-chunking-options.tsx
@@ -85,7 +85,7 @@ export const GeneralChunkingOptions: FC<GeneralChunkingOptionsProps> = ({
}) => {
const qaLabelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/datasets/create/step-two/components/indexing-mode-section.tsx b/web/app/components/datasets/create/step-two/components/indexing-mode-section.tsx
index 5188df3ac23..d6bddd5d088 100644
--- a/web/app/components/datasets/create/step-two/components/indexing-mode-section.tsx
+++ b/web/app/components/datasets/create/step-two/components/indexing-mode-section.tsx
@@ -71,7 +71,7 @@ export const IndexingModeSection: FC<IndexingModeSectionProps> = ({
onQAConfirmDialogClose,
onQAConfirmDialogConfirm,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation', 'datasetSettings'])
const docLink = useDocLink()
const getIndexingTechnique = () => indexType
diff --git a/web/app/components/datasets/create/step-two/components/inputs.tsx b/web/app/components/datasets/create/step-two/components/inputs.tsx
index 69b25ebcf52..d43407af237 100644
--- a/web/app/components/datasets/create/step-two/components/inputs.tsx
+++ b/web/app/components/datasets/create/step-two/components/inputs.tsx
@@ -43,7 +43,7 @@ export const DelimiterInput: FC<
> = ({ tooltip, onValueChange, value, ...rest }) => {
const labelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const generatedInputId = useId()
const inputId = rest.id ?? generatedInputId
const isComposing = useRef(false)
@@ -163,7 +163,7 @@ type LabeledCompoundNumberInputProps = Omit<CompoundNumberInputProps, 'label'>
export const MaxLengthInput: FC<LabeledCompoundNumberInputProps> = (props) => {
const maxValue = env.NEXT_PUBLIC_INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const label = t(($) => $['stepTwo.maxLength'], { ns: 'datasetCreation' })
return (
<FormField label={<div className="mb-1 system-sm-semibold">{label}</div>}>
@@ -182,7 +182,7 @@ export const MaxLengthInput: FC<LabeledCompoundNumberInputProps> = (props) => {
export const OverlapInput: FC<LabeledCompoundNumberInputProps> = (props) => {
const labelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const label = t(($) => $['stepTwo.overlap'], { ns: 'datasetCreation' })
return (
<FormField
diff --git a/web/app/components/datasets/create/step-two/components/parent-child-options.tsx b/web/app/components/datasets/create/step-two/components/parent-child-options.tsx
index f57305f4c14..07d3b02395e 100644
--- a/web/app/components/datasets/create/step-two/components/parent-child-options.tsx
+++ b/web/app/components/datasets/create/step-two/components/parent-child-options.tsx
@@ -75,7 +75,7 @@ export const ParentChildOptions: FC<ParentChildOptionsProps> = ({
onReset,
showSummaryIndexSetting,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/datasets/create/step-two/components/preview-panel.tsx b/web/app/components/datasets/create/step-two/components/preview-panel.tsx
index eb8781b809f..36a95eee36c 100644
--- a/web/app/components/datasets/create/step-two/components/preview-panel.tsx
+++ b/web/app/components/datasets/create/step-two/components/preview-panel.tsx
@@ -60,7 +60,7 @@ export const PreviewPanel: FC<PreviewPanelProps> = ({
isPending,
onPickerChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetCreation'])
return (
<FloatRightContainer
diff --git a/web/app/components/datasets/create/step-two/components/step-two-footer.tsx b/web/app/components/datasets/create/step-two/components/step-two-footer.tsx
index b6f11b6c2f6..17187b6aea1 100644
--- a/web/app/components/datasets/create/step-two/components/step-two-footer.tsx
+++ b/web/app/components/datasets/create/step-two/components/step-two-footer.tsx
@@ -20,7 +20,7 @@ export const StepTwoFooter: FC<StepTwoFooterProps> = ({
onCreate,
onCancel,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
if (!isSetting) {
return (
diff --git a/web/app/components/datasets/create/step-two/hooks/use-document-creation.ts b/web/app/components/datasets/create/step-two/hooks/use-document-creation.ts
index 54734679c11..841ce841dd2 100644
--- a/web/app/components/datasets/create/step-two/hooks/use-document-creation.ts
+++ b/web/app/components/datasets/create/step-two/hooks/use-document-creation.ts
@@ -62,7 +62,7 @@ type ValidationParams = {
retrievalConfig: RetrievalConfig
}
export const useDocumentCreation = (options: UseDocumentCreationOptions) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'datasetCreation'])
const {
datasetId,
isSetting,
diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx
index 3a29f2b7ba3..caf9111a3fc 100644
--- a/web/app/components/datasets/create/step-two/index.tsx
+++ b/web/app/components/datasets/create/step-two/index.tsx
@@ -59,7 +59,7 @@ const StepTwo: FC<StepTwoProps> = ({
}) => {
const generalChunkingModes: readonly ChunkingMode[] = [ChunkingMode.text, ChunkingMode.qa]
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const locale = useLocale()
const isMobile = useBreakpoints() === MediaType.mobile
const [isPreviewOpen, setIsPreviewOpen] = useState(false)
diff --git a/web/app/components/datasets/create/top-bar/index.tsx b/web/app/components/datasets/create/top-bar/index.tsx
index 4588e048c62..b112639ff45 100644
--- a/web/app/components/datasets/create/top-bar/index.tsx
+++ b/web/app/components/datasets/create/top-bar/index.tsx
@@ -20,7 +20,7 @@ const STEP_T_MAP = {
export const TopBar: FC<TopBarProps> = (props) => {
const { className, datasetId, ...rest } = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const fallbackRoute = useMemo(() => {
return datasetId ? `/datasets/${datasetId}/documents` : '/datasets'
diff --git a/web/app/components/datasets/create/website/base/crawled-result-item.tsx b/web/app/components/datasets/create/website/base/crawled-result-item.tsx
index 7301229af7a..f2522916dbd 100644
--- a/web/app/components/datasets/create/website/base/crawled-result-item.tsx
+++ b/web/app/components/datasets/create/website/base/crawled-result-item.tsx
@@ -22,7 +22,7 @@ const CrawledResultItem: FC<Props> = ({
onCheckChange,
onPreview,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
return (
<div
className={cn(
diff --git a/web/app/components/datasets/create/website/base/crawled-result.tsx b/web/app/components/datasets/create/website/base/crawled-result.tsx
index f9e1f53c274..2583d71dd68 100644
--- a/web/app/components/datasets/create/website/base/crawled-result.tsx
+++ b/web/app/components/datasets/create/website/base/crawled-result.tsx
@@ -27,7 +27,7 @@ const CrawledResult: FC<Props> = ({
onPreview,
usedTime,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const isCheckAll = checkedList.length === list.length
diff --git a/web/app/components/datasets/create/website/base/crawling.tsx b/web/app/components/datasets/create/website/base/crawling.tsx
index 9a0d193e3c3..4b09a951c59 100644
--- a/web/app/components/datasets/create/website/base/crawling.tsx
+++ b/web/app/components/datasets/create/website/base/crawling.tsx
@@ -10,7 +10,7 @@ type Props = Readonly<{
}>
const Crawling: FC<Props> = ({ className = '', crawledNum, totalNum }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
return (
<div className={className}>
diff --git a/web/app/components/datasets/create/website/base/options-wrap.tsx b/web/app/components/datasets/create/website/base/options-wrap.tsx
index 7968a301f42..bbf20a4f6fc 100644
--- a/web/app/components/datasets/create/website/base/options-wrap.tsx
+++ b/web/app/components/datasets/create/website/base/options-wrap.tsx
@@ -16,7 +16,7 @@ type Props = Readonly<{
}>
const OptionsWrap: FC<Props> = ({ className = '', children, controlFoldOptions }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const [fold, { toggle: foldToggle, setTrue: foldHide }] = useBoolean(false)
diff --git a/web/app/components/datasets/create/website/base/url-input.tsx b/web/app/components/datasets/create/website/base/url-input.tsx
index 860d8b26b06..c1300503095 100644
--- a/web/app/components/datasets/create/website/base/url-input.tsx
+++ b/web/app/components/datasets/create/website/base/url-input.tsx
@@ -15,7 +15,7 @@ type Props = Readonly<{
}>
const UrlInput: FC<Props> = ({ isRunning, onRun }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const docLink = useDocLink()
const [url, setUrl] = useState('')
const handleUrlChange = useCallback((url: string | number) => {
diff --git a/web/app/components/datasets/create/website/firecrawl/index.tsx b/web/app/components/datasets/create/website/firecrawl/index.tsx
index 5204e9a3d56..9635d59fc03 100644
--- a/web/app/components/datasets/create/website/firecrawl/index.tsx
+++ b/web/app/components/datasets/create/website/firecrawl/index.tsx
@@ -63,7 +63,7 @@ const FireCrawl: FC<Props> = ({
crawlOptions,
onCrawlOptionsChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetCreation'])
const [step, setStep] = useState<Step>(Step.init)
const controlFoldOptions = STEP_CONTROL_FOLD_OPTIONS[step]
const isMountedRef = useRef(true)
diff --git a/web/app/components/datasets/create/website/firecrawl/options.tsx b/web/app/components/datasets/create/website/firecrawl/options.tsx
index 9dc08583f69..6bba0286eb9 100644
--- a/web/app/components/datasets/create/website/firecrawl/options.tsx
+++ b/web/app/components/datasets/create/website/firecrawl/options.tsx
@@ -17,7 +17,7 @@ type Props = Readonly<{
}>
const Options: FC<Props> = ({ className = '', payload, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const handleChange = useCallback(
(key: keyof CrawlOptions) => {
diff --git a/web/app/components/datasets/create/website/index.tsx b/web/app/components/datasets/create/website/index.tsx
index e9325cc419e..44fc47953cc 100644
--- a/web/app/components/datasets/create/website/index.tsx
+++ b/web/app/components/datasets/create/website/index.tsx
@@ -45,7 +45,7 @@ const Website: FC<Props> = ({
onCrawlOptionsChange,
authedDataSourceList,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const providerLabelId = React.useId()
const [, setSettingsDestination] = useQueryState(settingsQueryParamName, settingsQueryParser)
const [selectedProvider, setSelectedProvider] = useState<DataSourceProvider>(
diff --git a/web/app/components/datasets/create/website/jina-reader/index.tsx b/web/app/components/datasets/create/website/jina-reader/index.tsx
index 6998baaea35..f30bed59c47 100644
--- a/web/app/components/datasets/create/website/jina-reader/index.tsx
+++ b/web/app/components/datasets/create/website/jina-reader/index.tsx
@@ -44,7 +44,7 @@ const JinaReader: FC<Props> = ({
crawlOptions,
onCrawlOptionsChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetCreation'])
const [step, setStep] = useState<Step>(Step.init)
const [controlFoldOptions, setControlFoldOptions] = useState<number>(0)
const [, setSettingsDestination] = useQueryState(settingsQueryParamName, settingsQueryParser)
diff --git a/web/app/components/datasets/create/website/jina-reader/options.tsx b/web/app/components/datasets/create/website/jina-reader/options.tsx
index 51540bc6c61..ac3dfb67d3d 100644
--- a/web/app/components/datasets/create/website/jina-reader/options.tsx
+++ b/web/app/components/datasets/create/website/jina-reader/options.tsx
@@ -17,7 +17,7 @@ type Props = Readonly<{
}>
const Options: FC<Props> = ({ className = '', payload, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const handleChange = useCallback(
(key: keyof CrawlOptions) => {
diff --git a/web/app/components/datasets/create/website/no-data.tsx b/web/app/components/datasets/create/website/no-data.tsx
index 582fbf4c314..eee9c884829 100644
--- a/web/app/components/datasets/create/website/no-data.tsx
+++ b/web/app/components/datasets/create/website/no-data.tsx
@@ -19,7 +19,7 @@ type Props = Readonly<{
}>
const NoData: FC<Props> = ({ onConfig, provider }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const providerConfig: Record<
DataSourceProvider,
diff --git a/web/app/components/datasets/create/website/preview.tsx b/web/app/components/datasets/create/website/preview.tsx
index e891d7619f8..22e70a94918 100644
--- a/web/app/components/datasets/create/website/preview.tsx
+++ b/web/app/components/datasets/create/website/preview.tsx
@@ -12,7 +12,7 @@ type IProps = {
}
const WebsitePreview = ({ payload, hidePreview }: IProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetCreation'])
return (
<div className={cn(s.filePreview, 'h-full')}>
diff --git a/web/app/components/datasets/create/website/watercrawl/index.tsx b/web/app/components/datasets/create/website/watercrawl/index.tsx
index 09f0c0cfd3d..97ce25cede2 100644
--- a/web/app/components/datasets/create/website/watercrawl/index.tsx
+++ b/web/app/components/datasets/create/website/watercrawl/index.tsx
@@ -49,7 +49,7 @@ const WaterCrawl: FC<Props> = ({
crawlOptions,
onCrawlOptionsChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetCreation'])
const [step, setStep] = useState<Step>(Step.init)
const controlFoldOptions = STEP_CONTROL_FOLD_OPTIONS[step]
const [, setSettingsDestination] = useQueryState(settingsQueryParamName, settingsQueryParser)
diff --git a/web/app/components/datasets/create/website/watercrawl/options.tsx b/web/app/components/datasets/create/website/watercrawl/options.tsx
index 9dc08583f69..6bba0286eb9 100644
--- a/web/app/components/datasets/create/website/watercrawl/options.tsx
+++ b/web/app/components/datasets/create/website/watercrawl/options.tsx
@@ -17,7 +17,7 @@ type Props = Readonly<{
}>
const Options: FC<Props> = ({ className = '', payload, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const handleChange = useCallback(
(key: keyof CrawlOptions) => {
diff --git a/web/app/components/datasets/documents/components/document-list/components/document-table-row.tsx b/web/app/components/datasets/documents/components/document-list/components/document-table-row.tsx
index a19255311b8..c61233b556e 100644
--- a/web/app/components/datasets/documents/components/document-list/components/document-table-row.tsx
+++ b/web/app/components/datasets/documents/components/document-list/components/document-table-row.tsx
@@ -59,7 +59,7 @@ const DocumentTableRow = React.memo(
onShowRenameModal,
onUpdate,
}: DocumentTableRowProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments', 'datasetHitTesting'])
const { formatTime } = useTimestamp()
const router = useRouter()
const searchParams = useSearchParams()
diff --git a/web/app/components/datasets/documents/components/document-list/hooks/use-document-actions.ts b/web/app/components/datasets/documents/components/document-list/hooks/use-document-actions.ts
index 8dead17f351..d29b03d2bfa 100644
--- a/web/app/components/datasets/documents/components/document-list/hooks/use-document-actions.ts
+++ b/web/app/components/datasets/documents/components/document-list/hooks/use-document-actions.ts
@@ -42,7 +42,7 @@ export const useDocumentActions = ({
onUpdate,
onClearSelection,
}: UseDocumentActionsOptions) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { mutateAsync: archiveDocument } = useDocumentArchive()
const { mutateAsync: generateSummary } = useDocumentSummary()
diff --git a/web/app/components/datasets/documents/components/documents-header.tsx b/web/app/components/datasets/documents/components/documents-header.tsx
index 35b5e3f6e18..5be287a3851 100644
--- a/web/app/components/datasets/documents/components/documents-header.tsx
+++ b/web/app/components/datasets/documents/components/documents-header.tsx
@@ -84,7 +84,7 @@ const DocumentsHeader: FC<DocumentsHeaderProps> = ({
onBuiltInEnabledChange,
onAddDocument,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset', 'datasetDocuments'])
const docLink = useDocLink()
const DOC_INDEX_STATUS_MAP = useIndexStatus()
diff --git a/web/app/components/datasets/documents/components/empty-element.tsx b/web/app/components/datasets/documents/components/empty-element.tsx
index 104f89655a6..084cef3cd7a 100644
--- a/web/app/components/datasets/documents/components/empty-element.tsx
+++ b/web/app/components/datasets/documents/components/empty-element.tsx
@@ -13,7 +13,7 @@ type EmptyElementProps = {
}
const EmptyElement: FC<EmptyElementProps> = ({ canAdd = false, onClick, type = 'upload' }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
return (
<div className={s.emptyWrapper}>
<div className={s.emptyElement}>
diff --git a/web/app/components/datasets/documents/components/list.tsx b/web/app/components/datasets/documents/components/list.tsx
index 588f21a185a..11b7657f70f 100644
--- a/web/app/components/datasets/documents/components/list.tsx
+++ b/web/app/components/datasets/documents/components/list.tsx
@@ -61,7 +61,7 @@ const DocumentList = ({
remoteSortValue,
onSortChange,
}: DocumentListProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const pageSize = pagination.limit ?? 10
const totalPages = Math.max(Math.ceil(pagination.total / pageSize), 1)
const datasetConfig = useDatasetDetailContext((s) => s.dataset)
diff --git a/web/app/components/datasets/documents/components/operations.tsx b/web/app/components/datasets/documents/components/operations.tsx
index f37c9e13b68..94c09896ed3 100644
--- a/web/app/components/datasets/documents/components/operations.tsx
+++ b/web/app/components/datasets/documents/components/operations.tsx
@@ -100,7 +100,7 @@ const Operations = ({
const [showModal, setShowModal] = useState(false)
const [isOperationsMenuOpen, setIsOperationsMenuOpen] = useState(false)
const [deleting, setDeleting] = useState(false)
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const router = useRouter()
const { mutateAsync: archiveDocument } = useDocumentArchive()
const { mutateAsync: unArchiveDocument } = useDocumentUnArchive()
diff --git a/web/app/components/datasets/documents/components/rename-modal.tsx b/web/app/components/datasets/documents/components/rename-modal.tsx
index 839c9947e17..2821fe475bc 100644
--- a/web/app/components/datasets/documents/components/rename-modal.tsx
+++ b/web/app/components/datasets/documents/components/rename-modal.tsx
@@ -21,7 +21,7 @@ type Props = Readonly<{
}>
const RenameModal: FC<Props> = ({ documentId, datasetId, name, onClose, onSaved }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const [newName, setNewName] = useState(name)
const [saveLoading, { setTrue: setSaveLoadingTrue, setFalse: setSaveLoadingFalse }] =
diff --git a/web/app/components/datasets/documents/create-from-pipeline/actions/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/actions/index.tsx
index 32eb39979a3..20360767932 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/actions/index.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/actions/index.tsx
@@ -27,7 +27,7 @@ const Actions = ({
onSelectAll,
tip = '',
}: ActionsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetCreation'])
const { datasetId } = useParams()
const indeterminate = useMemo(() => {
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/base/header.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/base/header.tsx
index 92a5fdd561b..21fc6c51eb6 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/base/header.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/base/header.tsx
@@ -14,7 +14,7 @@ type HeaderProps = {
} & CredentialSelectorProps
const Header = ({ docTitle, docLink, onClickConfiguration, pluginName, ...rest }: HeaderProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const configurationTip = t(($) => $.configurationTip, { ns: 'datasetPipeline', pluginName })
return (
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/components/upload-dropzone.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/components/upload-dropzone.tsx
index fb8e363bc45..39bc6e89d17 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/components/upload-dropzone.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/components/upload-dropzone.tsx
@@ -37,7 +37,7 @@ const UploadDropzone = ({
onFileChange,
allowedExtensions,
}: UploadDropzoneProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const deploymentEdition = useAtomValue(deploymentEditionAtom)
return (
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/page-selector/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/page-selector/index.tsx
index 0b8b9057b8e..226533e087a 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/page-selector/index.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/page-selector/index.tsx
@@ -28,7 +28,7 @@ const PageSelector = ({
isMultipleChoice = true,
currentCredentialId: _currentCredentialId,
}: PageSelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const selectionMode = isMultipleChoice ? 'multiple' : 'single'
const {
currentPreviewPageId,
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/title.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/title.tsx
index 9714268e022..f7999a9ea35 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/title.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/title.tsx
@@ -6,7 +6,7 @@ type TitleProps = {
}
const Title = ({ name }: TitleProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
return (
<div className="px-1.25 py-1 system-sm-medium text-text-secondary">
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/bucket.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/bucket.tsx
index fea774273a4..169633a34fa 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/bucket.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/bucket.tsx
@@ -18,7 +18,7 @@ const Bucket = ({
handleClickBucketName,
current,
}: BucketProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const allBucketsLabel = t(($) => $['onlineDrive.breadcrumbs.allBuckets'], {
ns: 'datasetPipeline',
})
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/drive.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/drive.tsx
index 3a970924188..e22019eeb2d 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/drive.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/drive.tsx
@@ -7,7 +7,7 @@ type DriveProps = {
}
export default function Drive({ breadcrumbs, handleBackToRoot }: DriveProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
return (
<BreadcrumbItem
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/dropdown/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/dropdown/index.tsx
index 3f4edb5320c..ec9c8076e24 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/dropdown/index.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/dropdown/index.tsx
@@ -16,7 +16,7 @@ type DropdownProps = {
}
const Dropdown = ({ startIndex, breadcrumbs, onBreadcrumbClick }: DropdownProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<>
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/index.tsx
index a1f1da2aff2..953d8261fd1 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/index.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/index.tsx
@@ -23,7 +23,7 @@ const Breadcrumbs = ({
searchResultsLength,
isInPipeline,
}: BreadcrumbsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const dataSourceStore = useDataSourceStore()
const hasBucket = useDataSourceStoreWithSelector((s) => s.hasBucket)
const showSearchResult = !!keywords && searchResultsLength > 0
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/index.tsx
index 7fe663087ec..a9d7fb8d34f 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/index.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/index.tsx
@@ -22,7 +22,7 @@ const Header = ({
searchResultsLength,
onSearchValueChange,
}: HeaderProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const searchLabel = t(($) => $['onlineDrive.breadcrumbs.searchPlaceholder'], {
ns: 'datasetPipeline',
})
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/empty-folder.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/empty-folder.tsx
index fd2b7d89bba..41f603f8dc3 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/empty-folder.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/empty-folder.tsx
@@ -2,7 +2,7 @@ import * as React from 'react'
import { useTranslation } from 'react-i18next'
const EmptyFolder = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
return (
<div className="flex size-full items-center justify-center rounded-[10px] bg-background-section px-1 py-1.5">
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/empty-search-result.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/empty-search-result.tsx
index 1c6494a04d8..5de875e0ae6 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/empty-search-result.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/empty-search-result.tsx
@@ -11,7 +11,7 @@ const EmptySearchResult = ({
}: EmptySearchResultProps & {
className?: string
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
return (
<div className="flex size-full flex-col items-center justify-center gap-y-2 rounded-[10px] bg-background-section p-6">
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/index.tsx
index c9f7245f2b3..db034dc4de6 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/index.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/index.tsx
@@ -31,7 +31,7 @@ const List = ({
isLoading,
supportBatchUpload,
}: FileListProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appApi', 'datasetPipeline'])
const anchorRef = useRef<HTMLDivElement>(null)
const observerRef = useRef<IntersectionObserver>(null)
const dataSourceStore = useDataSourceStore()
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/item.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/item.tsx
index 60fc2f2a0f5..4649c801ac7 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/item.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/item.tsx
@@ -25,7 +25,7 @@ const Item = ({
onSelect,
onOpen,
}: ItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const { name, type, size } = file
const isBucket = type === 'bucket'
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result-item.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result-item.tsx
index 21a62f00661..64dad533a8e 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result-item.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result-item.tsx
@@ -26,7 +26,7 @@ const CrawledResultItem = ({
showPreview,
isMultipleChoice = true,
}: CrawledResultItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
return (
<div
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result.tsx
index 6eb1148ffd8..44ab083477e 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result.tsx
@@ -33,7 +33,7 @@ const CrawledResult = ({
showPreview = false,
isMultipleChoice = true,
}: CrawledResultProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const isCheckAll = checkedList.length === list.length
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawling.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawling.tsx
index 3ac4855d967..71d2d0973ab 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawling.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawling.tsx
@@ -41,7 +41,7 @@ const Item = React.memo(({ firstLineWidth, secondLineWidth }: ItemProps) => {
})
const Crawling = ({ className = '', crawledNum, totalNum }: CrawlingProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const itemsConfig = [
{
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx
index dcb777d6330..38b7cbb4d47 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx
@@ -25,7 +25,7 @@ type OptionsProps = {
}
const Options = ({ variables, step, runDisabled, onSubmit }: OptionsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const runButtonLabelId = useId()
const initialData = useInitialData(variables)
const configurations = useConfigurations(variables)
diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/index.tsx
index 11db08d1b13..7cf4a033154 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/index.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/index.tsx
@@ -49,7 +49,7 @@ const WebsiteCrawl = ({
supportBatchUpload = true,
onCredentialChange,
}: WebsiteCrawlProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const docLink = useDocLink()
const [totalNum, setTotalNum] = useState(0)
const [crawledNum, setCrawledNum] = useState(0)
diff --git a/web/app/components/datasets/documents/create-from-pipeline/hooks/use-add-documents-steps.ts b/web/app/components/datasets/documents/create-from-pipeline/hooks/use-add-documents-steps.ts
index ec745aa66b7..b0f1d885ec0 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/hooks/use-add-documents-steps.ts
+++ b/web/app/components/datasets/documents/create-from-pipeline/hooks/use-add-documents-steps.ts
@@ -6,7 +6,7 @@ import { AddDocumentsStep } from '../types'
* Hook for managing add documents wizard steps
*/
export const useAddDocumentsSteps = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const [currentStep, setCurrentStep] = useState(1)
const handleNextStep = useCallback(() => {
diff --git a/web/app/components/datasets/documents/create-from-pipeline/hooks/use-datasource-ui-state.ts b/web/app/components/datasets/documents/create-from-pipeline/hooks/use-datasource-ui-state.ts
index 52a8ad86182..c23b1f951c1 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/hooks/use-datasource-ui-state.ts
+++ b/web/app/components/datasets/documents/create-from-pipeline/hooks/use-datasource-ui-state.ts
@@ -34,7 +34,7 @@ export const useDatasourceUIState = ({
currentWorkspacePagesLength,
fileUploadConfig,
}: DatasourceUIStateParams) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const datasourceType = datasource?.nodeData.provider_type
const isShowVectorSpaceFull = useMemo(() => {
diff --git a/web/app/components/datasets/documents/create-from-pipeline/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/index.tsx
index 3684635756d..60f4b51ccb4 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/index.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/index.tsx
@@ -40,7 +40,7 @@ import { StepOneContent, StepThreeContent, StepTwoContent } from './steps'
import { StepOnePreview, StepTwoPreview } from './steps/preview-panel'
const CreateFormPipeline = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'datasetPipeline'])
const router = useRouter()
const deploymentEdition = useAtomValue(deploymentEditionAtom)
const { data: plan } = useQuery(
diff --git a/web/app/components/datasets/documents/create-from-pipeline/left-header.tsx b/web/app/components/datasets/documents/create-from-pipeline/left-header.tsx
index cb0d235a586..d7a78d26b55 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/left-header.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/left-header.tsx
@@ -17,7 +17,7 @@ type LeftHeaderProps = {
const LeftHeader = ({ steps, title, currentStep }: LeftHeaderProps) => {
const { datasetId } = useParams()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className="relative flex flex-col gap-y-0.5 pt-4 pb-2">
diff --git a/web/app/components/datasets/documents/create-from-pipeline/preview/chunk-preview.tsx b/web/app/components/datasets/documents/create-from-pipeline/preview/chunk-preview.tsx
index 44d9002f21a..c4a98940075 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/preview/chunk-preview.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/preview/chunk-preview.tsx
@@ -61,7 +61,7 @@ const ChunkPreview = ({
handlePreviewWebsitePageChange,
handlePreviewOnlineDriveFileChange,
}: ChunkPreviewProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation', 'datasetPipeline'])
const currentDocForm = useDatasetDetailContextWithSelector((s) => s.dataset?.doc_form)
const [previewFile, setPreviewFile] = useState<DocumentItem>(localFiles[0] as DocumentItem)
diff --git a/web/app/components/datasets/documents/create-from-pipeline/preview/file-preview.tsx b/web/app/components/datasets/documents/create-from-pipeline/preview/file-preview.tsx
index 21100e0d30c..89d09301305 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/preview/file-preview.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/preview/file-preview.tsx
@@ -15,7 +15,7 @@ type FilePreviewProps = {
}
const FilePreview = ({ file, hidePreview }: FilePreviewProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const { data: fileData, isFetching } = useFilePreview(file.id || '')
const fileName = useMemo(() => {
diff --git a/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx b/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx
index a408c754329..333783c0181 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx
@@ -23,7 +23,7 @@ const OnlineDocumentPreview = ({
datasourceNodeId,
hidePreview,
}: OnlineDocumentPreviewProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const [content, setContent] = useState('')
const pipelineId = useDatasetDetailContextWithSelector((state) => state.dataset?.pipeline_id)
const { mutateAsync: getOnlineDocumentContent, isPending } = usePreviewOnlineDocument()
diff --git a/web/app/components/datasets/documents/create-from-pipeline/preview/web-preview.tsx b/web/app/components/datasets/documents/create-from-pipeline/preview/web-preview.tsx
index 623cd257405..d9e00b52148 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/preview/web-preview.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/preview/web-preview.tsx
@@ -11,7 +11,7 @@ type WebsitePreviewProps = {
}
const WebsitePreview = ({ currentWebsite, hidePreview }: WebsitePreviewProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
return (
<div className="flex size-full flex-col rounded-t-xl border-t border-l border-components-panel-border bg-background-default-lighter shadow-md shadow-shadow-shadow-5">
diff --git a/web/app/components/datasets/documents/create-from-pipeline/process-documents/actions.tsx b/web/app/components/datasets/documents/create-from-pipeline/process-documents/actions.tsx
index 5a899dbe730..422efb10a71 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/process-documents/actions.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/process-documents/actions.tsx
@@ -10,7 +10,7 @@ type ActionsProps = {
}
const Actions = ({ onBack, runDisabled, onProcess }: ActionsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
return (
<div className="flex items-center justify-between">
diff --git a/web/app/components/datasets/documents/create-from-pipeline/process-documents/header.tsx b/web/app/components/datasets/documents/create-from-pipeline/process-documents/header.tsx
index cfb37955fee..fed72938576 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/process-documents/header.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/process-documents/header.tsx
@@ -11,7 +11,7 @@ type HeaderProps = {
}
const Header = ({ onReset, resetDisabled, previewDisabled, onPreview }: HeaderProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetPipeline'])
return (
<div className="flex items-center gap-x-1 px-4 py-2">
diff --git a/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/index.tsx
index 459347d84b5..6dcf5747a87 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/index.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/index.tsx
@@ -48,7 +48,7 @@ const EmbeddingProcess = ({
indexingType,
retrievalMethod,
}: EmbeddingProcessProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'datasetCreation', 'datasetDocuments'])
const deploymentEdition = useAtomValue(deploymentEditionAtom)
const { data: plan } = useQuery(
consoleQuery.features.get.queryOptions({
diff --git a/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/rule-detail.tsx b/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/rule-detail.tsx
index 2dafdc5573b..62c33382549 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/rule-detail.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/rule-detail.tsx
@@ -15,7 +15,12 @@ type RuleDetailProps = {
}
const RuleDetail = ({ sourceData, indexingType, retrievalMethod }: RuleDetailProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation([
+ 'dataset',
+ 'datasetCreation',
+ 'datasetDocuments',
+ 'datasetSettings',
+ ])
const getValue = useCallback(
(field: string) => {
diff --git a/web/app/components/datasets/documents/create-from-pipeline/processing/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/processing/index.tsx
index bdf55bfd869..8034b74fe3c 100644
--- a/web/app/components/datasets/documents/create-from-pipeline/processing/index.tsx
+++ b/web/app/components/datasets/documents/create-from-pipeline/processing/index.tsx
@@ -13,7 +13,7 @@ type ProcessingProps = {
}
const Processing = ({ batchId, documents }: ProcessingProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation', 'datasetPipeline'])
const docLink = useDocLink()
const datasetId = useDatasetDetailContextWithSelector((s) => s.dataset?.id)
const indexingType = useDatasetDetailContextWithSelector((s) => s.dataset?.indexing_technique)
diff --git a/web/app/components/datasets/documents/detail/batch-modal/csv-downloader.tsx b/web/app/components/datasets/documents/detail/batch-modal/csv-downloader.tsx
index e2560a9f9c3..c2c6dc5f24c 100644
--- a/web/app/components/datasets/documents/detail/batch-modal/csv-downloader.tsx
+++ b/web/app/components/datasets/documents/detail/batch-modal/csv-downloader.tsx
@@ -21,7 +21,7 @@ const CSV_TEMPLATE_EN = [['segment content'], ['content1'], ['content2']]
const CSV_TEMPLATE_CN = [['分段内容'], ['内容 1'], ['内容 2']]
const CSVDownload: FC<{ docForm: ChunkingMode }> = ({ docForm }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments', 'share'])
const locale = useLocale()
const { CSVDownloader, Type } = useCSVDownloader()
diff --git a/web/app/components/datasets/documents/detail/batch-modal/csv-uploader.tsx b/web/app/components/datasets/documents/detail/batch-modal/csv-uploader.tsx
index 62c2e44c4a1..ea879a192e7 100644
--- a/web/app/components/datasets/documents/detail/batch-modal/csv-uploader.tsx
+++ b/web/app/components/datasets/documents/detail/batch-modal/csv-uploader.tsx
@@ -20,7 +20,7 @@ type Props = Readonly<{
updateFile: (file?: FileItem) => void
}>
const CSVUploader: FC<Props> = ({ file, updateFile }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetCreation', 'datasetDocuments'])
const [dragging, setDragging] = useState(false)
const dropRef = useRef<HTMLDivElement>(null)
const dragRef = useRef<HTMLDivElement>(null)
diff --git a/web/app/components/datasets/documents/detail/batch-modal/index.tsx b/web/app/components/datasets/documents/detail/batch-modal/index.tsx
index 5381493f9d6..db385ab63f5 100644
--- a/web/app/components/datasets/documents/detail/batch-modal/index.tsx
+++ b/web/app/components/datasets/documents/detail/batch-modal/index.tsx
@@ -20,7 +20,7 @@ type IBatchModalProps = {
type BatchModalContentProps = Omit<IBatchModalProps, 'isShow'>
const BatchModalContent: FC<BatchModalContentProps> = ({ docForm, onCancel, onConfirm }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
const [currentCSV, setCurrentCSV] = useState<FileItem>()
const handleFile = (file?: FileItem) => setCurrentCSV(file)
diff --git a/web/app/components/datasets/documents/detail/completed/child-segment-detail.tsx b/web/app/components/datasets/documents/detail/completed/child-segment-detail.tsx
index 5a2b8477073..ee9a1b430a6 100644
--- a/web/app/components/datasets/documents/detail/completed/child-segment-detail.tsx
+++ b/web/app/components/datasets/documents/detail/completed/child-segment-detail.tsx
@@ -34,7 +34,7 @@ const ChildSegmentDetail: FC<IChildSegmentDetailProps> = ({
onCancel,
docForm,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const canEdit = useDocumentContext((s) => s.canEdit)
const [content, setContent] = useState(childChunkInfo?.content || '')
const { eventEmitter } = useEventEmitterContextContext()
diff --git a/web/app/components/datasets/documents/detail/completed/child-segment-list.tsx b/web/app/components/datasets/documents/detail/completed/child-segment-list.tsx
index 970ebf1ddc4..b4286c16d2e 100644
--- a/web/app/components/datasets/documents/detail/completed/child-segment-list.tsx
+++ b/web/app/components/datasets/documents/detail/completed/child-segment-list.tsx
@@ -78,7 +78,7 @@ const ChildSegmentList: FC<IChildSegmentCardProps> = ({
isLoading,
focused = false,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const parentMode = useDocumentContext((s) => s.parentMode)
const canEdit = useDocumentContext((s) => s.canEdit)
const currChildChunk = useSegmentListContext((s) => s.currChildChunk)
diff --git a/web/app/components/datasets/documents/detail/completed/common/action-buttons.tsx b/web/app/components/datasets/documents/detail/completed/common/action-buttons.tsx
index 77444f35283..24f719b41cd 100644
--- a/web/app/components/datasets/documents/detail/completed/common/action-buttons.tsx
+++ b/web/app/components/datasets/documents/detail/completed/common/action-buttons.tsx
@@ -28,7 +28,7 @@ export function ActionButtons({
isChildChunk = false,
showRegenerationButton = true,
}: ActionButtonsProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const docForm = useDocumentContext((s) => s.docForm)
const parentMode = useDocumentContext((s) => s.parentMode)
diff --git a/web/app/components/datasets/documents/detail/completed/common/add-another.tsx b/web/app/components/datasets/documents/detail/completed/common/add-another.tsx
index 6e80aea16a4..9b03e660d01 100644
--- a/web/app/components/datasets/documents/detail/completed/common/add-another.tsx
+++ b/web/app/components/datasets/documents/detail/completed/common/add-another.tsx
@@ -11,7 +11,7 @@ type AddAnotherProps = {
}
const AddAnother: FC<AddAnotherProps> = ({ className, checked, onCheckedChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
return (
<label className={cn('flex cursor-pointer items-center gap-x-1 pl-1', className)}>
diff --git a/web/app/components/datasets/documents/detail/completed/common/batch-action.tsx b/web/app/components/datasets/documents/detail/completed/common/batch-action.tsx
index 6758dbc06f7..2f513025acf 100644
--- a/web/app/components/datasets/documents/detail/completed/common/batch-action.tsx
+++ b/web/app/components/datasets/documents/detail/completed/common/batch-action.tsx
@@ -56,7 +56,7 @@ const BatchAction: FC<IBatchActionProps> = ({
onBatchReIndex,
onCancel,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset', 'datasetDocuments'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/datasets/documents/detail/completed/common/chunk-content.tsx b/web/app/components/datasets/documents/detail/completed/common/chunk-content.tsx
index 40345d9fd0c..92860eb74f3 100644
--- a/web/app/components/datasets/documents/detail/completed/common/chunk-content.tsx
+++ b/web/app/components/datasets/documents/detail/completed/common/chunk-content.tsx
@@ -98,7 +98,7 @@ type IQATextAreaProps = {
const QATextArea: FC<IQATextAreaProps> = React.memo(
({ question, answer, onQuestionChange, onAnswerChange, isEditMode = true }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
const containerRef = useRef<HTMLDivElement>(null)
const labelRef = useRef<HTMLDivElement>(null)
@@ -151,7 +151,7 @@ const ChunkContent: FC<IChunkContentProps> = ({
isEditMode,
docForm,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
if (docForm === ChunkingMode.qa) {
return (
diff --git a/web/app/components/datasets/documents/detail/completed/common/empty.tsx b/web/app/components/datasets/documents/detail/completed/common/empty.tsx
index b7c0c512918..9db9579c63f 100644
--- a/web/app/components/datasets/documents/detail/completed/common/empty.tsx
+++ b/web/app/components/datasets/documents/detail/completed/common/empty.tsx
@@ -49,7 +49,7 @@ const Line = React.memo(({ className }: LineProps) => {
Line.displayName = 'Line'
const Empty: FC<IEmptyProps> = ({ onClearFilter }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
return (
<div className="relative z-0 flex h-full items-center justify-center">
diff --git a/web/app/components/datasets/documents/detail/completed/common/keywords.tsx b/web/app/components/datasets/documents/detail/completed/common/keywords.tsx
index 6fca828e608..32405fc6362 100644
--- a/web/app/components/datasets/documents/detail/completed/common/keywords.tsx
+++ b/web/app/components/datasets/documents/detail/completed/common/keywords.tsx
@@ -22,7 +22,7 @@ const Keywords: FC<IKeywordsProps> = ({
isEditMode,
actionType = 'view',
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
return (
<div className={cn('flex flex-col', className)}>
<div className="system-xs-medium-uppercase text-text-tertiary">
diff --git a/web/app/components/datasets/documents/detail/completed/common/regeneration-modal.tsx b/web/app/components/datasets/documents/detail/completed/common/regeneration-modal.tsx
index 704a917245f..aa8fdc98fa3 100644
--- a/web/app/components/datasets/documents/detail/completed/common/regeneration-modal.tsx
+++ b/web/app/components/datasets/documents/detail/completed/common/regeneration-modal.tsx
@@ -19,7 +19,7 @@ type IDefaultContentProps = {
}
const DefaultContent: FC<IDefaultContentProps> = React.memo(({ onCancel, onConfirm }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
return (
<>
@@ -44,7 +44,7 @@ const DefaultContent: FC<IDefaultContentProps> = React.memo(({ onCancel, onConfi
DefaultContent.displayName = 'DefaultContent'
const RegeneratingContent: FC = React.memo(() => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
return (
<>
@@ -74,7 +74,7 @@ type IRegenerationCompletedContentProps = {
const RegenerationCompletedContent: FC<IRegenerationCompletedContentProps> = React.memo(
({ onClose }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const targetTime = useRef(Date.now() + 5000)
const [countdown] = useCountDown({
targetDate: targetTime.current,
diff --git a/web/app/components/datasets/documents/detail/completed/common/summary-label.tsx b/web/app/components/datasets/documents/detail/completed/common/summary-label.tsx
index 89c80f339cf..88b7634ef9b 100644
--- a/web/app/components/datasets/documents/detail/completed/common/summary-label.tsx
+++ b/web/app/components/datasets/documents/detail/completed/common/summary-label.tsx
@@ -7,7 +7,7 @@ type SummaryLabelProps = {
className?: string
}
const SummaryLabel = ({ summary, className }: SummaryLabelProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
return (
<div className={cn('space-y-1', className)}>
diff --git a/web/app/components/datasets/documents/detail/completed/common/summary-status.tsx b/web/app/components/datasets/documents/detail/completed/common/summary-status.tsx
index c85ab1b2936..3a443784616 100644
--- a/web/app/components/datasets/documents/detail/completed/common/summary-status.tsx
+++ b/web/app/components/datasets/documents/detail/completed/common/summary-status.tsx
@@ -8,7 +8,7 @@ type SummaryStatusProps = {
}
const SummaryStatus = ({ status }: SummaryStatusProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
const tip = useMemo(() => {
if (status === 'SUMMARIZING') {
diff --git a/web/app/components/datasets/documents/detail/completed/common/summary-text.tsx b/web/app/components/datasets/documents/detail/completed/common/summary-text.tsx
index 374f45d773e..5d602ac747b 100644
--- a/web/app/components/datasets/documents/detail/completed/common/summary-text.tsx
+++ b/web/app/components/datasets/documents/detail/completed/common/summary-text.tsx
@@ -9,7 +9,7 @@ type SummaryTextProps = {
disabled?: boolean
}
const SummaryText = ({ value, onChange, disabled }: SummaryTextProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
return (
<div className="space-y-1">
diff --git a/web/app/components/datasets/documents/detail/completed/components/menu-bar.tsx b/web/app/components/datasets/documents/detail/completed/components/menu-bar.tsx
index 0a6624a7742..070f03c9356 100644
--- a/web/app/components/datasets/documents/detail/completed/components/menu-bar.tsx
+++ b/web/app/components/datasets/documents/detail/completed/components/menu-bar.tsx
@@ -43,7 +43,7 @@ function MenuBar({
isCollapsed,
toggleCollapsed,
}: MenuBarProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const selectedStatus = statusList.find((item) => item.value === selectDefaultValue) ?? null
return (
diff --git a/web/app/components/datasets/documents/detail/completed/display-toggle.tsx b/web/app/components/datasets/documents/detail/completed/display-toggle.tsx
index 68d474754da..b43e90c5637 100644
--- a/web/app/components/datasets/documents/detail/completed/display-toggle.tsx
+++ b/web/app/components/datasets/documents/detail/completed/display-toggle.tsx
@@ -10,7 +10,7 @@ type DisplayToggleProps = {
}
const DisplayToggle: FC<DisplayToggleProps> = ({ isCollapsed, toggleCollapsed }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
const label = isCollapsed
? t(($) => $['segment.expandChunks'], { ns: 'datasetDocuments' })
: t(($) => $['segment.collapseChunks'], { ns: 'datasetDocuments' })
diff --git a/web/app/components/datasets/documents/detail/completed/hooks/use-child-segment-data.ts b/web/app/components/datasets/documents/detail/completed/hooks/use-child-segment-data.ts
index b8f5759fec1..e77a00abb68 100644
--- a/web/app/components/datasets/documents/detail/completed/hooks/use-child-segment-data.ts
+++ b/web/app/components/datasets/documents/detail/completed/hooks/use-child-segment-data.ts
@@ -63,7 +63,7 @@ export const useChildSegmentData = (
refreshChunkListDataWithDetailChanged,
updateSegmentInCache,
} = options
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const { eventEmitter } = useEventEmitterContextContext()
const queryClient = useQueryClient()
const datasetId = useDocumentContext((s) => s.datasetId) || ''
diff --git a/web/app/components/datasets/documents/detail/completed/hooks/use-search-filter.ts b/web/app/components/datasets/documents/detail/completed/hooks/use-search-filter.ts
index ef350960b78..0cc31327b83 100644
--- a/web/app/components/datasets/documents/detail/completed/hooks/use-search-filter.ts
+++ b/web/app/components/datasets/documents/detail/completed/hooks/use-search-filter.ts
@@ -26,7 +26,7 @@ type UseSearchFilterOptions = {
}
export const useSearchFilter = (options: UseSearchFilterOptions): UseSearchFilterReturn => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
const { onPageChange } = options
const [inputValue, setInputValue] = useState<string>('')
diff --git a/web/app/components/datasets/documents/detail/completed/hooks/use-segment-list-data.ts b/web/app/components/datasets/documents/detail/completed/hooks/use-segment-list-data.ts
index 9f11a0df03c..5005018c1ba 100644
--- a/web/app/components/datasets/documents/detail/completed/hooks/use-segment-list-data.ts
+++ b/web/app/components/datasets/documents/detail/completed/hooks/use-segment-list-data.ts
@@ -76,7 +76,7 @@ export const useSegmentListData = (
onCloseSegmentDetail,
clearSelection,
} = options
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const pathname = usePathname()
const { eventEmitter } = useEventEmitterContextContext()
const queryClient = useQueryClient()
diff --git a/web/app/components/datasets/documents/detail/completed/index.tsx b/web/app/components/datasets/documents/detail/completed/index.tsx
index 30ee74f0729..7d88f4dec09 100644
--- a/web/app/components/datasets/documents/detail/completed/index.tsx
+++ b/web/app/components/datasets/documents/detail/completed/index.tsx
@@ -49,7 +49,7 @@ const Completed: FC<ICompletedProps> = ({
importStatus,
archived,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const docForm = useDocumentContext((s) => s.docForm)
const canEdit = useDocumentContext((s) => s.canEdit)
diff --git a/web/app/components/datasets/documents/detail/completed/new-child-segment.tsx b/web/app/components/datasets/documents/detail/completed/new-child-segment.tsx
index 841edbd25a6..b75eecb7e0a 100644
--- a/web/app/components/datasets/documents/detail/completed/new-child-segment.tsx
+++ b/web/app/components/datasets/documents/detail/completed/new-child-segment.tsx
@@ -31,7 +31,7 @@ const NewChildSegmentModal: FC<NewChildSegmentModalProps> = ({
onSave,
viewNewlyAddedChildChunk,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const [content, setContent] = useState('')
const { datasetId, documentId } = useParams<{ datasetId: string; documentId: string }>()
const [loading, setLoading] = useState(false)
diff --git a/web/app/components/datasets/documents/detail/completed/segment-card/index.tsx b/web/app/components/datasets/documents/detail/completed/segment-card/index.tsx
index 34de7349cc5..dbea2fe7809 100644
--- a/web/app/components/datasets/documents/detail/completed/segment-card/index.tsx
+++ b/web/app/components/datasets/documents/detail/completed/segment-card/index.tsx
@@ -66,7 +66,7 @@ const SegmentCard: FC<ISegmentCardProps> = ({
embeddingAvailable,
focused,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset', 'datasetDocuments'])
const {
id,
position,
diff --git a/web/app/components/datasets/documents/detail/completed/segment-detail.tsx b/web/app/components/datasets/documents/detail/completed/segment-detail.tsx
index f1a4eabe448..2ed000a005d 100644
--- a/web/app/components/datasets/documents/detail/completed/segment-detail.tsx
+++ b/web/app/components/datasets/documents/detail/completed/segment-detail.tsx
@@ -45,7 +45,7 @@ export function SegmentDetail({
isEditMode: requestedEditMode,
docForm,
}: ISegmentDetailProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const canEdit = useDocumentContext((s) => s.canEdit)
const isEditMode = requestedEditMode && canEdit
const [question, setQuestion] = useState(segInfo?.content || '')
diff --git a/web/app/components/datasets/documents/detail/completed/segment-list.tsx b/web/app/components/datasets/documents/detail/completed/segment-list.tsx
index d0b8933a71a..46e81ceee7c 100644
--- a/web/app/components/datasets/documents/detail/completed/segment-list.tsx
+++ b/web/app/components/datasets/documents/detail/completed/segment-list.tsx
@@ -42,7 +42,7 @@ const SegmentList = ({
}: ISegmentListProps & {
ref: React.LegacyRef<HTMLDivElement>
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
const docForm = useDocumentContext((s) => s.docForm)
const parentMode = useDocumentContext((s) => s.parentMode)
const currSegment = useSegmentListContext((s) => s.currSegment)
diff --git a/web/app/components/datasets/documents/detail/completed/skeleton/parent-chunk-card-skeleton.tsx b/web/app/components/datasets/documents/detail/completed/skeleton/parent-chunk-card-skeleton.tsx
index 494c9202a29..ad890963cf8 100644
--- a/web/app/components/datasets/documents/detail/completed/skeleton/parent-chunk-card-skeleton.tsx
+++ b/web/app/components/datasets/documents/detail/completed/skeleton/parent-chunk-card-skeleton.tsx
@@ -8,7 +8,7 @@ import {
} from '@/app/components/base/skeleton'
const ParentChunkCardSkelton = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div data-testid="parent-chunk-card-skeleton" className="flex flex-col pb-2">
<SkeletonContainer className="gap-y-0 p-1 pb-0">
diff --git a/web/app/components/datasets/documents/detail/embedding/components/rule-detail.tsx b/web/app/components/datasets/documents/detail/embedding/components/rule-detail.tsx
index a69e3350982..b7a04954c80 100644
--- a/web/app/components/datasets/documents/detail/embedding/components/rule-detail.tsx
+++ b/web/app/components/datasets/documents/detail/embedding/components/rule-detail.tsx
@@ -24,7 +24,12 @@ const getRetrievalIcon = (method?: RETRIEVE_METHOD) => {
const RuleDetail: FC<RuleDetailProps> = React.memo(
({ sourceData, indexingType, retrievalMethod }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation([
+ 'dataset',
+ 'datasetCreation',
+ 'datasetDocuments',
+ 'datasetSettings',
+ ])
const segmentationRuleMap = {
mode: t(($) => $['embedding.mode'], { ns: 'datasetDocuments' }),
diff --git a/web/app/components/datasets/documents/detail/embedding/components/segment-progress.tsx b/web/app/components/datasets/documents/detail/embedding/components/segment-progress.tsx
index 23f1a8ecc25..2af41b9d72a 100644
--- a/web/app/components/datasets/documents/detail/embedding/components/segment-progress.tsx
+++ b/web/app/components/datasets/documents/detail/embedding/components/segment-progress.tsx
@@ -10,7 +10,7 @@ type SegmentProgressProps = {
const SegmentProgress: FC<SegmentProgressProps> = React.memo(
({ completedSegments, totalSegments, percent }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
const completed = completedSegments ?? '--'
const total = totalSegments ?? '--'
diff --git a/web/app/components/datasets/documents/detail/embedding/components/status-header.tsx b/web/app/components/datasets/documents/detail/embedding/components/status-header.tsx
index 7bb3f9cce34..71b7efc4829 100644
--- a/web/app/components/datasets/documents/detail/embedding/components/status-header.tsx
+++ b/web/app/components/datasets/documents/detail/embedding/components/status-header.tsx
@@ -25,7 +25,7 @@ const StatusHeader: FC<StatusHeaderProps> = React.memo(
isPauseLoading,
isResumeLoading,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
const getStatusText = () => {
if (isEmbedding) return t(($) => $['embedding.processing'], { ns: 'datasetDocuments' })
diff --git a/web/app/components/datasets/documents/detail/embedding/index.tsx b/web/app/components/datasets/documents/detail/embedding/index.tsx
index aba1995795f..bf32cf5c5b8 100644
--- a/web/app/components/datasets/documents/detail/embedding/index.tsx
+++ b/web/app/components/datasets/documents/detail/embedding/index.tsx
@@ -25,7 +25,7 @@ const EmbeddingDetail: FC<EmbeddingDetailProps> = ({
indexingType,
retrievalMethod,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const contextDatasetId = useDocumentContext((s) => s.datasetId)
const contextDocumentId = useDocumentContext((s) => s.documentId)
const datasetId = dstId ?? contextDatasetId
diff --git a/web/app/components/datasets/documents/detail/index.tsx b/web/app/components/datasets/documents/detail/index.tsx
index 2f8531b1e05..c8aa953a874 100644
--- a/web/app/components/datasets/documents/detail/index.tsx
+++ b/web/app/components/datasets/documents/detail/index.tsx
@@ -57,7 +57,7 @@ const NON_TERMINAL_DISPLAY_STATUSES = new Set<(typeof DisplayStatusList)[number]
const DocumentDetail: FC<DocumentDetailProps> = ({ datasetId, documentId }) => {
const router = useRouter()
const searchParams = useSearchParams()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const media = useBreakpoints()
const isMobile = media === MediaType.mobile
diff --git a/web/app/components/datasets/documents/detail/metadata/components/field-info.tsx b/web/app/components/datasets/documents/detail/metadata/components/field-info.tsx
index 0d4afacb688..da420d5ffbe 100644
--- a/web/app/components/datasets/documents/detail/metadata/components/field-info.tsx
+++ b/web/app/components/datasets/documents/detail/metadata/components/field-info.tsx
@@ -39,7 +39,7 @@ const FieldInfo: FC<FieldInfoProps> = ({
selectOptions = [],
onUpdate,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
const textNeedWrap = getTextWidthWithCanvas(displayedValue) > 190
const editAlignTop = showEdit && inputType === 'textarea'
const readAlignTop = !showEdit && textNeedWrap
diff --git a/web/app/components/datasets/documents/detail/new-segment.tsx b/web/app/components/datasets/documents/detail/new-segment.tsx
index 25cf76302d4..4648fbd83a4 100644
--- a/web/app/components/datasets/documents/detail/new-segment.tsx
+++ b/web/app/components/datasets/documents/detail/new-segment.tsx
@@ -35,7 +35,7 @@ const NewSegmentModal: FC<NewSegmentModalProps> = ({
onSave,
viewNewlyAddedChunk,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const [question, setQuestion] = useState('')
const [answer, setAnswer] = useState('')
const [attachments, setAttachments] = useState<FileEntity[]>([])
diff --git a/web/app/components/datasets/documents/detail/segment-add/index.tsx b/web/app/components/datasets/documents/detail/segment-add/index.tsx
index b69a13adc91..21679ca38f7 100644
--- a/web/app/components/datasets/documents/detail/segment-add/index.tsx
+++ b/web/app/components/datasets/documents/detail/segment-add/index.tsx
@@ -31,7 +31,7 @@ export function SegmentAdd({
showBatchModal,
embedding,
}: SegmentAddProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'datasetDocuments'])
const [isPlanUpgradeModalOpen, setIsPlanUpgradeModalOpen] = useState(false)
const deploymentEdition = useAtomValue(deploymentEditionAtom)
const { data: plan } = useQuery(
diff --git a/web/app/components/datasets/documents/detail/settings/document-settings.tsx b/web/app/components/datasets/documents/detail/settings/document-settings.tsx
index 4725e69e0f0..559fc8e04df 100644
--- a/web/app/components/datasets/documents/detail/settings/document-settings.tsx
+++ b/web/app/components/datasets/documents/detail/settings/document-settings.tsx
@@ -38,7 +38,7 @@ type DocumentSettingsProps = {
}
const DocumentSettings = ({ datasetId, documentId }: DocumentSettingsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetCreation', 'datasetPipeline'])
const router = useRouter()
const [, setSettingsDestination] = useQueryState(settingsQueryParamName, settingsQueryParser)
const { indexingTechnique, dataset } = useContext(DatasetDetailContext)
diff --git a/web/app/components/datasets/documents/detail/settings/pipeline-settings/index.tsx b/web/app/components/datasets/documents/detail/settings/pipeline-settings/index.tsx
index dd003a157d8..35fc30795e9 100644
--- a/web/app/components/datasets/documents/detail/settings/pipeline-settings/index.tsx
+++ b/web/app/components/datasets/documents/detail/settings/pipeline-settings/index.tsx
@@ -21,7 +21,7 @@ type PipelineSettingsProps = {
}
const PipelineSettings = ({ datasetId, documentId }: PipelineSettingsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation', 'datasetPipeline'])
const { push } = useRouter()
const [estimateData, setEstimateData] = useState<FileIndexingEstimateResponse | undefined>(
undefined,
diff --git a/web/app/components/datasets/documents/detail/settings/pipeline-settings/left-header.tsx b/web/app/components/datasets/documents/detail/settings/pipeline-settings/left-header.tsx
index fad8c7d93b8..b9a5f03e806 100644
--- a/web/app/components/datasets/documents/detail/settings/pipeline-settings/left-header.tsx
+++ b/web/app/components/datasets/documents/detail/settings/pipeline-settings/left-header.tsx
@@ -10,7 +10,7 @@ type LeftHeaderProps = {
}
const LeftHeader = ({ title }: LeftHeaderProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetPipeline'])
const { back } = useRouter()
const navigateBack = useCallback(() => {
diff --git a/web/app/components/datasets/documents/detail/settings/pipeline-settings/process-documents/actions.tsx b/web/app/components/datasets/documents/detail/settings/pipeline-settings/process-documents/actions.tsx
index 6984e5f299c..8ed8d79adea 100644
--- a/web/app/components/datasets/documents/detail/settings/pipeline-settings/process-documents/actions.tsx
+++ b/web/app/components/datasets/documents/detail/settings/pipeline-settings/process-documents/actions.tsx
@@ -8,7 +8,7 @@ type ActionsProps = {
}
const Actions = ({ onProcess, runDisabled }: ActionsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
return (
<div className="flex items-center justify-end">
diff --git a/web/app/components/datasets/documents/status-item/hooks.ts b/web/app/components/datasets/documents/status-item/hooks.ts
index 2158d219843..ed6c89df46f 100644
--- a/web/app/components/datasets/documents/status-item/hooks.ts
+++ b/web/app/components/datasets/documents/status-item/hooks.ts
@@ -2,7 +2,7 @@ import type { StatusDotStatus } from '@langgenius/dify-ui/status-dot'
import { useTranslation } from 'react-i18next'
export const useIndexStatus = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
return {
queuing: {
status: 'warning',
diff --git a/web/app/components/datasets/documents/status-item/index.tsx b/web/app/components/datasets/documents/status-item/index.tsx
index 29ed48a0a27..773e4ab4974 100644
--- a/web/app/components/datasets/documents/status-item/index.tsx
+++ b/web/app/components/datasets/documents/status-item/index.tsx
@@ -56,7 +56,7 @@ const StatusItem = ({
}: StatusItemProps) => {
const statusLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const DOC_INDEX_STATUS_MAP = useIndexStatus()
const localStatus = status.toLowerCase() as keyof typeof DOC_INDEX_STATUS_MAP
const statusItem = DOC_INDEX_STATUS_MAP[localStatus]
diff --git a/web/app/components/datasets/external-api/external-api-modal/Form.tsx b/web/app/components/datasets/external-api/external-api-modal/Form.tsx
index 088e6e7e106..2974662c126 100644
--- a/web/app/components/datasets/external-api/external-api-modal/Form.tsx
+++ b/web/app/components/datasets/external-api/external-api-modal/Form.tsx
@@ -31,7 +31,7 @@ const Form: FC<FormProps> = React.memo(
formSchemas,
inputClassName,
}) => {
- const { t, i18n } = useTranslation()
+ const { t, i18n } = useTranslation(['common', 'dataset'])
const docLink = useDocLink()
const handleFormChange = (key: string, val: string) => {
diff --git a/web/app/components/datasets/external-api/external-api-modal/index.tsx b/web/app/components/datasets/external-api/external-api-modal/index.tsx
index 7739406f24f..7fbe01f902d 100644
--- a/web/app/components/datasets/external-api/external-api-modal/index.tsx
+++ b/web/app/components/datasets/external-api/external-api-modal/index.tsx
@@ -74,7 +74,7 @@ const AddExternalAPIModal: FC<AddExternalAPIModalProps> = ({
isEditMode,
onEdit,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const formId = useId()
const [loading, setLoading] = useState(false)
const [showConfirm, setShowConfirm] = useState(false)
diff --git a/web/app/components/datasets/external-api/external-api-panel/index.tsx b/web/app/components/datasets/external-api/external-api-panel/index.tsx
index 554458f77e7..4109c70c0c4 100644
--- a/web/app/components/datasets/external-api/external-api-panel/index.tsx
+++ b/web/app/components/datasets/external-api/external-api-panel/index.tsx
@@ -20,7 +20,7 @@ const ExternalAPIPanel: React.FC<ExternalAPIPanelProps> = ({
canManageExternalKnowledgeApi,
onClose,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const docLink = useDocLink()
const { setShowExternalKnowledgeAPIModal } = useModalContext()
const queryClient = useQueryClient()
diff --git a/web/app/components/datasets/external-api/external-knowledge-api-card/index.tsx b/web/app/components/datasets/external-api/external-knowledge-api-card/index.tsx
index 56aaa357eb0..a1cac7202b8 100644
--- a/web/app/components/datasets/external-api/external-knowledge-api-card/index.tsx
+++ b/web/app/components/datasets/external-api/external-knowledge-api-card/index.tsx
@@ -45,7 +45,7 @@ const ExternalKnowledgeAPICard: React.FC<ExternalKnowledgeAPICardProps> = ({
const endpoint =
api.settings && typeof api.settings.endpoint === 'string' ? api.settings.endpoint : ''
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const handleEditClick = async () => {
if (!canManageExternalKnowledgeApi) return
diff --git a/web/app/components/datasets/external-knowledge-base/connector/index.tsx b/web/app/components/datasets/external-knowledge-base/connector/index.tsx
index fedce465e3f..f4fbf970779 100644
--- a/web/app/components/datasets/external-knowledge-base/connector/index.tsx
+++ b/web/app/components/datasets/external-knowledge-base/connector/index.tsx
@@ -14,7 +14,7 @@ import { createExternalKnowledgeBase } from '@/service/datasets'
const ExternalKnowledgeBaseConnector = () => {
const [loading, setLoading] = useState(false)
const router = useRouter()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
useDocumentTitle(
t(($) => $['stepByStepTour.guides.knowledge.empty.connect.title'], { ns: 'common' }),
)
diff --git a/web/app/components/datasets/external-knowledge-base/create/ExternalApiSelect.tsx b/web/app/components/datasets/external-knowledge-base/create/ExternalApiSelect.tsx
index b286bebe49a..efb23d2b794 100644
--- a/web/app/components/datasets/external-knowledge-base/create/ExternalApiSelect.tsx
+++ b/web/app/components/datasets/external-knowledge-base/create/ExternalApiSelect.tsx
@@ -26,7 +26,7 @@ const ExternalApiSelect: React.FC<ExternalApiSelectProps> = ({
value,
onSelect,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const [isOpen, setIsOpen] = useState(false)
const [selectedItem, setSelectedItem] = useState<ApiItem | null>(
items.find((item) => item.value === value) || null,
diff --git a/web/app/components/datasets/external-knowledge-base/create/ExternalApiSelection.tsx b/web/app/components/datasets/external-knowledge-base/create/ExternalApiSelection.tsx
index 438550799b2..f18dc3ab691 100644
--- a/web/app/components/datasets/external-knowledge-base/create/ExternalApiSelection.tsx
+++ b/web/app/components/datasets/external-knowledge-base/create/ExternalApiSelection.tsx
@@ -23,7 +23,7 @@ const ExternalApiSelection: React.FC<ExternalApiSelectionProps> = ({
external_knowledge_id,
onChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const router = useRouter()
const queryClient = useQueryClient()
const externalKnowledgeApiQueryOptions =
diff --git a/web/app/components/datasets/external-knowledge-base/create/InfoPanel.tsx b/web/app/components/datasets/external-knowledge-base/create/InfoPanel.tsx
index 17d3fc85c5e..f8d01993cdc 100644
--- a/web/app/components/datasets/external-knowledge-base/create/InfoPanel.tsx
+++ b/web/app/components/datasets/external-knowledge-base/create/InfoPanel.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
import { useDocLink } from '@/context/i18n'
const InfoPanel = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const docLink = useDocLink()
return (
diff --git a/web/app/components/datasets/external-knowledge-base/create/KnowledgeBaseInfo.tsx b/web/app/components/datasets/external-knowledge-base/create/KnowledgeBaseInfo.tsx
index 319b0c82cc0..19bb8dbead9 100644
--- a/web/app/components/datasets/external-knowledge-base/create/KnowledgeBaseInfo.tsx
+++ b/web/app/components/datasets/external-knowledge-base/create/KnowledgeBaseInfo.tsx
@@ -9,7 +9,7 @@ type KnowledgeBaseInfoProps = {
}
const KnowledgeBaseInfo: React.FC<KnowledgeBaseInfoProps> = ({ name, description, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const nameInputId = React.useId()
const descriptionInputId = React.useId()
diff --git a/web/app/components/datasets/external-knowledge-base/create/RetrievalSettings.tsx b/web/app/components/datasets/external-knowledge-base/create/RetrievalSettings.tsx
index 32d03e83500..5d1a4aa1f9e 100644
--- a/web/app/components/datasets/external-knowledge-base/create/RetrievalSettings.tsx
+++ b/web/app/components/datasets/external-knowledge-base/create/RetrievalSettings.tsx
@@ -28,7 +28,7 @@ const RetrievalSettings: FC<RetrievalSettingsProps> = ({
isInRetrievalSetting = false,
readonly = false,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const handleScoreThresholdChange = (enabled: boolean) => {
onChange({ score_threshold_enabled: enabled })
diff --git a/web/app/components/datasets/external-knowledge-base/create/index.tsx b/web/app/components/datasets/external-knowledge-base/create/index.tsx
index 3ab8134c5ee..f24caf90ce8 100644
--- a/web/app/components/datasets/external-knowledge-base/create/index.tsx
+++ b/web/app/components/datasets/external-knowledge-base/create/index.tsx
@@ -23,7 +23,7 @@ const ExternalKnowledgeBaseCreate: React.FC<ExternalKnowledgeBaseCreateProps> =
onConnect,
loading,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const docLink = useDocLink()
const router = useRouter()
const [formData, setFormData] = useState<CreateKnowledgeBaseReq>({
diff --git a/web/app/components/datasets/extra-info/api-access/card.tsx b/web/app/components/datasets/extra-info/api-access/card.tsx
index d6aa8ab59d1..f88f7f7cb9c 100644
--- a/web/app/components/datasets/extra-info/api-access/card.tsx
+++ b/web/app/components/datasets/extra-info/api-access/card.tsx
@@ -22,7 +22,7 @@ type CardProps = {
}
const Card = ({ apiEnabled }: CardProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview', 'common', 'dataset'])
const datasetId = useDatasetDetailContextWithSelector((state) => state.dataset?.id)
const dataset = useDatasetDetailContextWithSelector((state) => state.dataset)
const mutateDatasetRes = useDatasetDetailContextWithSelector((state) => state.mutateDatasetRes)
diff --git a/web/app/components/datasets/extra-info/api-access/index.tsx b/web/app/components/datasets/extra-info/api-access/index.tsx
index fd208633550..720815db2d9 100644
--- a/web/app/components/datasets/extra-info/api-access/index.tsx
+++ b/web/app/components/datasets/extra-info/api-access/index.tsx
@@ -12,7 +12,7 @@ type ApiAccessProps = {
}
const ApiAccess = ({ expand, apiEnabled }: ApiAccessProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [open, setOpen] = useState(false)
return (
diff --git a/web/app/components/datasets/extra-info/service-api/card.tsx b/web/app/components/datasets/extra-info/service-api/card.tsx
index 8fa81b66780..99cdf2890cd 100644
--- a/web/app/components/datasets/extra-info/service-api/card.tsx
+++ b/web/app/components/datasets/extra-info/service-api/card.tsx
@@ -14,7 +14,7 @@ type CardProps = {
}
export function ServiceApiCard({ apiBaseUrl, canManageApiKey, onOpenApiKeyModal }: CardProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const apiReferenceUrl = useDatasetApiAccessUrl()
diff --git a/web/app/components/datasets/extra-info/service-api/index.tsx b/web/app/components/datasets/extra-info/service-api/index.tsx
index feffaf418cf..cd0b3f94268 100644
--- a/web/app/components/datasets/extra-info/service-api/index.tsx
+++ b/web/app/components/datasets/extra-info/service-api/index.tsx
@@ -14,7 +14,7 @@ type ServiceApiProps = {
}
export function ServiceApi({ apiBaseUrl }: ServiceApiProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const [apiKeyModalOpen, setApiKeyModalOpen] = useState(false)
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
const canManageApiKey = hasPermission(workspacePermissionKeys, 'dataset.api_key.manage')
diff --git a/web/app/components/datasets/extra-info/statistics.tsx b/web/app/components/datasets/extra-info/statistics.tsx
index 494fc33c8b6..deaafe7598c 100644
--- a/web/app/components/datasets/extra-info/statistics.tsx
+++ b/web/app/components/datasets/extra-info/statistics.tsx
@@ -13,7 +13,7 @@ type StatisticsProps = {
}
const Statistics = ({ expand, documentCount, relatedApps }: StatisticsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const relatedAppsTotal = relatedApps?.total
const hasRelatedApps = relatedApps?.data && relatedApps.data.length > 0
diff --git a/web/app/components/datasets/formatted-text/flavours/edit-slice.tsx b/web/app/components/datasets/formatted-text/flavours/edit-slice.tsx
index 67ca50c7026..372cff44f99 100644
--- a/web/app/components/datasets/formatted-text/flavours/edit-slice.tsx
+++ b/web/app/components/datasets/formatted-text/flavours/edit-slice.tsx
@@ -31,7 +31,7 @@ type EditSliceProps = SliceProps<{
}>
export const EditSlice: FC<EditSliceProps> = (props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const {
label,
className,
diff --git a/web/app/components/datasets/hit-testing/components/chunk-detail-modal.tsx b/web/app/components/datasets/hit-testing/components/chunk-detail-modal.tsx
index 2b5abb30716..9ecd73067d2 100644
--- a/web/app/components/datasets/hit-testing/components/chunk-detail-modal.tsx
+++ b/web/app/components/datasets/hit-testing/components/chunk-detail-modal.tsx
@@ -26,7 +26,7 @@ type ChunkDetailModalProps = {
}
const ChunkDetailModal = ({ payload, onHide }: ChunkDetailModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments', 'datasetHitTesting'])
const { segment, score, child_chunks, files, summary } = payload
const { position, content, sign_content, keywords, document, answer } = segment
const isParentChildRetrieval = !!(child_chunks && child_chunks.length > 0)
diff --git a/web/app/components/datasets/hit-testing/components/empty-records.tsx b/web/app/components/datasets/hit-testing/components/empty-records.tsx
index cc75daac213..1b3c474a733 100644
--- a/web/app/components/datasets/hit-testing/components/empty-records.tsx
+++ b/web/app/components/datasets/hit-testing/components/empty-records.tsx
@@ -3,7 +3,7 @@ import * as React from 'react'
import { useTranslation } from 'react-i18next'
const EmptyRecords = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetHitTesting'])
return (
<div className="rounded-2xl bg-workflow-process-bg p-5">
<div className="flex h-10 w-10 items-center justify-center rounded-[10px] border-[0.5px] border-components-card-border bg-components-card-bg p-1 shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px]">
diff --git a/web/app/components/datasets/hit-testing/components/query-input/index.tsx b/web/app/components/datasets/hit-testing/components/query-input/index.tsx
index 5fd02b0a621..51519fc82ba 100644
--- a/web/app/components/datasets/hit-testing/components/query-input/index.tsx
+++ b/web/app/components/datasets/hit-testing/components/query-input/index.tsx
@@ -62,7 +62,7 @@ const QueryInput = ({
hitTestingMutation,
externalKnowledgeBaseHitTestingMutation,
}: QueryInputProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset', 'datasetHitTesting'])
const isMultimodal = useDatasetDetailContextWithSelector((s) => !!s.dataset?.is_multimodal)
const [isSettingsOpen, setIsSettingsOpen] = useState(false)
const [externalRetrievalSettings, setExternalRetrievalSettings] = useState({
diff --git a/web/app/components/datasets/hit-testing/components/query-input/textarea.tsx b/web/app/components/datasets/hit-testing/components/query-input/textarea.tsx
index 2f1946f2bd5..c112c072bd2 100644
--- a/web/app/components/datasets/hit-testing/components/query-input/textarea.tsx
+++ b/web/app/components/datasets/hit-testing/components/query-input/textarea.tsx
@@ -10,7 +10,7 @@ type TextareaProps = {
}
const Textarea = ({ text, handleTextChange }: TextareaProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetHitTesting'])
return (
<div
diff --git a/web/app/components/datasets/hit-testing/components/records.tsx b/web/app/components/datasets/hit-testing/components/records.tsx
index 569a75ca148..37ea38e6530 100644
--- a/web/app/components/datasets/hit-testing/components/records.tsx
+++ b/web/app/components/datasets/hit-testing/components/records.tsx
@@ -13,7 +13,7 @@ type RecordsProps = {
}
const Records = ({ records, onClickRecord }: RecordsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetHitTesting'])
const { formatTime } = useTimestamp()
const [sortTimeOrder, setTimeOrder] = useState<'asc' | 'desc'>('desc')
diff --git a/web/app/components/datasets/hit-testing/components/result-item-external.tsx b/web/app/components/datasets/hit-testing/components/result-item-external.tsx
index a2f28bb6b92..88c5fb413b4 100644
--- a/web/app/components/datasets/hit-testing/components/result-item-external.tsx
+++ b/web/app/components/datasets/hit-testing/components/result-item-external.tsx
@@ -18,7 +18,7 @@ type Props = {
}
const ResultItemExternal: FC<Props> = ({ payload, positionId }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetHitTesting'])
const { content, title, score } = payload
const [isShowDetailModal, { setTrue: showDetailModal, setFalse: hideDetailModal }] =
useBoolean(false)
diff --git a/web/app/components/datasets/hit-testing/components/result-item-footer.tsx b/web/app/components/datasets/hit-testing/components/result-item-footer.tsx
index 35cc30ea1db..d822636770c 100644
--- a/web/app/components/datasets/hit-testing/components/result-item-footer.tsx
+++ b/web/app/components/datasets/hit-testing/components/result-item-footer.tsx
@@ -14,7 +14,7 @@ type Props = {
const i18nPrefix = ''
const ResultItemFooter: FC<Props> = ({ docType, docTitle, showDetailModal }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetHitTesting'])
return (
<div className="mt-3 flex h-10 items-center justify-between border-t border-divider-subtle pr-2 pl-3">
diff --git a/web/app/components/datasets/hit-testing/components/result-item-meta.tsx b/web/app/components/datasets/hit-testing/components/result-item-meta.tsx
index a0d51d2a44b..f9648f47389 100644
--- a/web/app/components/datasets/hit-testing/components/result-item-meta.tsx
+++ b/web/app/components/datasets/hit-testing/components/result-item-meta.tsx
@@ -16,7 +16,7 @@ type Props = {
}
const ResultItemMeta: FC<Props> = ({ labelPrefix, positionId, wordCount, score, className }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
return (
<div className={cn('flex items-center justify-between', className)}>
diff --git a/web/app/components/datasets/hit-testing/components/result-item.tsx b/web/app/components/datasets/hit-testing/components/result-item.tsx
index c917a9454bd..e9d04707b65 100644
--- a/web/app/components/datasets/hit-testing/components/result-item.tsx
+++ b/web/app/components/datasets/hit-testing/components/result-item.tsx
@@ -23,7 +23,7 @@ type ResultItemProps = {
}
const ResultItem = ({ payload }: ResultItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetHitTesting'])
const { segment, score, child_chunks, files, summary } = payload
const data = segment
const { position, word_count, content, sign_content, keywords, document } = data
diff --git a/web/app/components/datasets/hit-testing/index.tsx b/web/app/components/datasets/hit-testing/index.tsx
index 1d44c332101..c72c29ec9c5 100644
--- a/web/app/components/datasets/hit-testing/index.tsx
+++ b/web/app/components/datasets/hit-testing/index.tsx
@@ -55,7 +55,7 @@ type Props = Readonly<{
}>
const HitTestingPage: FC<Props> = ({ datasetId }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetHitTesting'])
const media = useBreakpoints()
const isMobile = media === MediaType.mobile
diff --git a/web/app/components/datasets/hit-testing/modify-external-retrieval-modal.tsx b/web/app/components/datasets/hit-testing/modify-external-retrieval-modal.tsx
index bf5793699ce..d85eec5d661 100644
--- a/web/app/components/datasets/hit-testing/modify-external-retrieval-modal.tsx
+++ b/web/app/components/datasets/hit-testing/modify-external-retrieval-modal.tsx
@@ -24,7 +24,7 @@ const ModifyExternalRetrievalModal: React.FC<ModifyExternalRetrievalModalProps>
initialScoreThreshold,
initialScoreThresholdEnabled,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetHitTesting'])
const [topK, setTopK] = useState(initialTopK)
const [scoreThreshold, setScoreThreshold] = useState(initialScoreThreshold)
const [scoreThresholdEnabled, setScoreThresholdEnabled] = useState(initialScoreThresholdEnabled)
diff --git a/web/app/components/datasets/hit-testing/modify-retrieval-modal.tsx b/web/app/components/datasets/hit-testing/modify-retrieval-modal.tsx
index 0a1a63ca871..34f4e2615fc 100644
--- a/web/app/components/datasets/hit-testing/modify-retrieval-modal.tsx
+++ b/web/app/components/datasets/hit-testing/modify-retrieval-modal.tsx
@@ -27,7 +27,7 @@ type Props = Readonly<{
}>
const ModifyRetrievalModal: FC<Props> = ({ indexMethod, value, isShow, onHide, onSave }) => {
const ref = useRef(null)
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'datasetSettings'])
const docLink = useDocLink()
const [retrievalConfig, setRetrievalConfig] = useState(value)
const embeddingModel = useDatasetDetailContextWithSelector(
diff --git a/web/app/components/datasets/list/dataset-card/components/corner-labels.tsx b/web/app/components/datasets/list/dataset-card/components/corner-labels.tsx
index cf2e1d28dd4..c64dda9968b 100644
--- a/web/app/components/datasets/list/dataset-card/components/corner-labels.tsx
+++ b/web/app/components/datasets/list/dataset-card/components/corner-labels.tsx
@@ -8,7 +8,7 @@ type CornerLabelsProps = {
}
const CornerLabels = ({ dataset }: CornerLabelsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
if (!dataset.embedding_available) {
return (
diff --git a/web/app/components/datasets/list/dataset-card/components/dataset-card-footer.tsx b/web/app/components/datasets/list/dataset-card/components/dataset-card-footer.tsx
index e1fb6ebed74..9fb84e13fa6 100644
--- a/web/app/components/datasets/list/dataset-card/components/dataset-card-footer.tsx
+++ b/web/app/components/datasets/list/dataset-card/components/dataset-card-footer.tsx
@@ -20,7 +20,7 @@ type DatasetCardFooterProps = {
}
const DatasetCardFooter = ({ dataset }: DatasetCardFooterProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const { formatTimeFromNow } = useFormatTimeFromNow()
const isExternalProvider = dataset.provider === EXTERNAL_PROVIDER
diff --git a/web/app/components/datasets/list/dataset-card/components/dataset-card-header.tsx b/web/app/components/datasets/list/dataset-card/components/dataset-card-header.tsx
index b143061b3ac..9f712094b70 100644
--- a/web/app/components/datasets/list/dataset-card/components/dataset-card-header.tsx
+++ b/web/app/components/datasets/list/dataset-card/components/dataset-card-header.tsx
@@ -24,7 +24,7 @@ type DocModeInfoProps = {
}
const DocModeInfo = ({ dataset, isExternalProvider, isShowDocModeInfo }: DocModeInfoProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const { formatIndexingTechniqueAndMethod } = useKnowledge()
const isPipeline = dataset.embedding_available && dataset.runtime_mode === 'rag_pipeline'
diff --git a/web/app/components/datasets/list/dataset-card/components/dataset-card-modals.tsx b/web/app/components/datasets/list/dataset-card/components/dataset-card-modals.tsx
index 3b4e8232c22..0a2430eb50d 100644
--- a/web/app/components/datasets/list/dataset-card/components/dataset-card-modals.tsx
+++ b/web/app/components/datasets/list/dataset-card/components/dataset-card-modals.tsx
@@ -37,7 +37,7 @@ const DatasetCardModals = ({
onConfirmDelete,
onSuccess,
}: DatasetCardModalsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
return (
<>
diff --git a/web/app/components/datasets/list/dataset-card/hooks/use-dataset-card-state.ts b/web/app/components/datasets/list/dataset-card/hooks/use-dataset-card-state.ts
index d807c486711..beb635877f5 100644
--- a/web/app/components/datasets/list/dataset-card/hooks/use-dataset-card-state.ts
+++ b/web/app/components/datasets/list/dataset-card/hooks/use-dataset-card-state.ts
@@ -21,7 +21,7 @@ type UseDatasetCardStateOptions = {
}
export const useDatasetCardState = ({ dataset, onSuccess }: UseDatasetCardStateOptions) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'dataset'])
const { push } = useRouter()
const queryClient = useQueryClient()
diff --git a/web/app/components/datasets/list/dataset-card/index.tsx b/web/app/components/datasets/list/dataset-card/index.tsx
index 08b4ddc2b57..4cb8787499b 100644
--- a/web/app/components/datasets/list/dataset-card/index.tsx
+++ b/web/app/components/datasets/list/dataset-card/index.tsx
@@ -43,7 +43,7 @@ const DatasetCard = ({
stepByStepTourActionMenuOpen,
stepByStepTourCardTarget,
}: DatasetCardProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const nameId = useId()
const { data: currentUserId } = useSuspenseQuery({
...userProfileQueryOptions(),
diff --git a/web/app/components/datasets/list/dataset-card/operations.tsx b/web/app/components/datasets/list/dataset-card/operations.tsx
index b3ed3fd8c6f..a55e048153d 100644
--- a/web/app/components/datasets/list/dataset-card/operations.tsx
+++ b/web/app/components/datasets/list/dataset-card/operations.tsx
@@ -25,7 +25,7 @@ const Operations = ({
openAccessConfig,
onClose,
}: OperationsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetPipeline'])
const handleRename = () => {
onClose?.()
diff --git a/web/app/components/datasets/list/datasets.tsx b/web/app/components/datasets/list/datasets.tsx
index f09b0f81010..9288148688b 100644
--- a/web/app/components/datasets/list/datasets.tsx
+++ b/web/app/components/datasets/list/datasets.tsx
@@ -38,7 +38,7 @@ const Datasets = ({
stepByStepTourActionMenuOpen,
stepByStepTourCardTarget,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const invalidDatasetList = useInvalidDatasetList()
const anchorRef = useRef<HTMLDivElement>(null)
const observerRef = useRef<IntersectionObserver>(null)
diff --git a/web/app/components/datasets/list/first-empty-state/index.tsx b/web/app/components/datasets/list/first-empty-state/index.tsx
index 4e9add253ad..cd840e87889 100644
--- a/web/app/components/datasets/list/first-empty-state/index.tsx
+++ b/web/app/components/datasets/list/first-empty-state/index.tsx
@@ -27,7 +27,7 @@ function DatasetFirstEmptyState({
canConnectExternalDataset,
canCreateDataset,
}: DatasetFirstEmptyStateProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const createActions: EmptyCreateAction[] = canCreateDataset
? [
diff --git a/web/app/components/datasets/list/header.tsx b/web/app/components/datasets/list/header.tsx
index 2c7899d21c1..94e4ef24e26 100644
--- a/web/app/components/datasets/list/header.tsx
+++ b/web/app/components/datasets/list/header.tsx
@@ -63,7 +63,7 @@ const DatasetListHeader = ({
stepByStepTourCreateMenuTarget,
knowledgeViewSwitcherProps,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const showCreateMenu = canCreateDataset || canConnectExternalDataset
const createMenu = useStepByStepTourControlledDropdown({
controlledOpen: stepByStepTourCreateMenuOpen,
diff --git a/web/app/components/datasets/list/index.tsx b/web/app/components/datasets/list/index.tsx
index c2836fc9025..a1d6dba9850 100644
--- a/web/app/components/datasets/list/index.tsx
+++ b/web/app/components/datasets/list/index.tsx
@@ -46,7 +46,7 @@ function LegacyList({
}: {
knowledgeViewSwitcherProps?: KnowledgeViewSwitcherProps
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const { push } = useRouter()
const isCurrentWorkspaceOwner = useAtomValue(isCurrentWorkspaceOwnerAtom)
const [showTagManagementModal, setShowTagManagementModal] = useState(false)
diff --git a/web/app/components/datasets/metadata/base/date-picker.tsx b/web/app/components/datasets/metadata/base/date-picker.tsx
index 55e56ea4d2a..5cd3af075eb 100644
--- a/web/app/components/datasets/metadata/base/date-picker.tsx
+++ b/web/app/components/datasets/metadata/base/date-picker.tsx
@@ -16,7 +16,7 @@ type Props = Readonly<{
onChange: (date: number | null) => void
}>
const WrappedDatePicker = ({ className, label, value, onChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset', 'datasetDocuments'])
const { data: timezone } = useQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.timezone ?? undefined,
diff --git a/web/app/components/datasets/metadata/edit-metadata-batch/edited-beacon.tsx b/web/app/components/datasets/metadata/edit-metadata-batch/edited-beacon.tsx
index 2ee083b22a0..b1110397bb8 100644
--- a/web/app/components/datasets/metadata/edit-metadata-batch/edited-beacon.tsx
+++ b/web/app/components/datasets/metadata/edit-metadata-batch/edited-beacon.tsx
@@ -12,7 +12,7 @@ type Props = Readonly<{
}>
const EditedBeacon: FC<Props> = ({ onReset }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const ref = useRef(null)
const isHovering = useHover(ref)
diff --git a/web/app/components/datasets/metadata/edit-metadata-batch/input-has-set-multiple-value.tsx b/web/app/components/datasets/metadata/edit-metadata-batch/input-has-set-multiple-value.tsx
index 8b59ab0d3b7..8131454373b 100644
--- a/web/app/components/datasets/metadata/edit-metadata-batch/input-has-set-multiple-value.tsx
+++ b/web/app/components/datasets/metadata/edit-metadata-batch/input-has-set-multiple-value.tsx
@@ -11,7 +11,7 @@ type Props = Readonly<{
}>
const InputHasSetMultipleValue: FC<Props> = ({ onClear, readOnly }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
return (
<div className="h-6 grow rounded-md bg-components-input-bg-normal p-0.5 text-[0]">
<div
diff --git a/web/app/components/datasets/metadata/edit-metadata-batch/modal.tsx b/web/app/components/datasets/metadata/edit-metadata-batch/modal.tsx
index 606da878323..b1151d4b045 100644
--- a/web/app/components/datasets/metadata/edit-metadata-batch/modal.tsx
+++ b/web/app/components/datasets/metadata/edit-metadata-batch/modal.tsx
@@ -42,7 +42,7 @@ const EditMetadataBatchModal: FC<Props> = ({
}) => {
const applyToAllLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const [templeList, setTempleList] = useState<MetadataItemWithEdit[]>(list)
const handleTemplesChange = useCallback(
(payload: MetadataItemWithEdit) => {
diff --git a/web/app/components/datasets/metadata/hooks/use-check-metadata-name.ts b/web/app/components/datasets/metadata/hooks/use-check-metadata-name.ts
index e593411affa..92e9aeb5404 100644
--- a/web/app/components/datasets/metadata/hooks/use-check-metadata-name.ts
+++ b/web/app/components/datasets/metadata/hooks/use-check-metadata-name.ts
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
const i18nPrefix = 'metadata.checkName'
const useCheckMetadataName = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
return {
checkName: (name: string) => {
if (!name) {
diff --git a/web/app/components/datasets/metadata/hooks/use-edit-dataset-metadata.ts b/web/app/components/datasets/metadata/hooks/use-edit-dataset-metadata.ts
index def012190d4..15454e3bafd 100644
--- a/web/app/components/datasets/metadata/hooks/use-edit-dataset-metadata.ts
+++ b/web/app/components/datasets/metadata/hooks/use-edit-dataset-metadata.ts
@@ -24,7 +24,7 @@ const useEditDatasetMetadata = ({
dataset?: DataSet
onUpdateDocList: () => void
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [isShowEditModal, { setTrue: showEditModal, setFalse: hideEditModal }] = useBoolean(false)
useEffect(() => {
const isShowManageMetadata = localStorage.getItem(isShowManageMetadataLocalStorageKey)
diff --git a/web/app/components/datasets/metadata/hooks/use-metadata-document.ts b/web/app/components/datasets/metadata/hooks/use-metadata-document.ts
index f8f2463bb2e..f80bfeecb30 100644
--- a/web/app/components/datasets/metadata/hooks/use-metadata-document.ts
+++ b/web/app/components/datasets/metadata/hooks/use-metadata-document.ts
@@ -21,7 +21,7 @@ type Props = Readonly<{
docDetail: FullDocumentDetail
}>
const useMetadataDocument = ({ datasetId, documentId, docDetail }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { dataset } = useDatasetDetailContext()
const embeddingAvailable = !!dataset?.embedding_available
const { mutateAsync } = useBatchUpdateDocMetadata()
diff --git a/web/app/components/datasets/metadata/metadata-dataset/create-content.tsx b/web/app/components/datasets/metadata/metadata-dataset/create-content.tsx
index ed89726e69d..a798cd8e969 100644
--- a/web/app/components/datasets/metadata/metadata-dataset/create-content.tsx
+++ b/web/app/components/datasets/metadata/metadata-dataset/create-content.tsx
@@ -19,7 +19,7 @@ export type Props = Readonly<{
}>
export function CreateContent({ onClose = noop, hasBack, onBack, onSave }: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const [type, setType] = useState<DataType>(DataType.string)
const handleTypeChange = useCallback(
diff --git a/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-drawer.tsx b/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-drawer.tsx
index 920aad9650b..b3d33239c33 100644
--- a/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-drawer.tsx
+++ b/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-drawer.tsx
@@ -57,7 +57,7 @@ type ItemProps = {
onDelete?: () => void
}
const Item: FC<ItemProps> = ({ readonly, disabled, payload, onRename, onDelete }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const iconClassName = getIconClassName(payload.type)
const handleRename = useCallback(() => {
@@ -164,7 +164,7 @@ const DatasetMetadataDrawer: FC<Props> = ({
}) => {
const builtInLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const [isShowRenameModal, setIsShowRenameModal] = useState(false)
const [currPayload, setCurrPayload] = useState<MetadataItemWithValueLength | null>(null)
const [templeName, setTempleName] = useState('')
diff --git a/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-picker.tsx b/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-picker.tsx
index f3b5c6b121c..2d86515a479 100644
--- a/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-picker.tsx
+++ b/web/app/components/datasets/metadata/metadata-dataset/dataset-metadata-picker.tsx
@@ -58,7 +58,7 @@ export function DatasetMetadataPicker({
onCreateMetadata,
onOpenMetadataManagement,
}: DatasetMetadataPickerProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const { data: datasetMetaData } = useDatasetMetaData(datasetId)
const metadataItems = datasetMetaData?.doc_metadata ?? []
const [open, setOpen] = useState(false)
@@ -173,7 +173,7 @@ function MetadataPickerSelectPanel({
onStartMetadataCreation: () => void
onOpenMetadataManagement: () => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const inputRef = useRef<HTMLInputElement>(null)
const handleClearQuery = () => {
@@ -242,7 +242,7 @@ function MetadataPickerActions({
onStartMetadataCreation: () => void
onOpenMetadataManagement: () => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
return (
<div className="flex items-center justify-between p-1">
diff --git a/web/app/components/datasets/metadata/metadata-document/index.tsx b/web/app/components/datasets/metadata/metadata-document/index.tsx
index 7154482f05c..6422025c14e 100644
--- a/web/app/components/datasets/metadata/metadata-document/index.tsx
+++ b/web/app/components/datasets/metadata/metadata-document/index.tsx
@@ -26,7 +26,7 @@ const MetadataDocument: FC<Props> = ({
docDetail,
canEdit = false,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const {
embeddingAvailable,
diff --git a/web/app/components/datasets/metadata/metadata-document/info-group.tsx b/web/app/components/datasets/metadata/metadata-document/info-group.tsx
index 52c95980af8..86eb5b12ef7 100644
--- a/web/app/components/datasets/metadata/metadata-document/info-group.tsx
+++ b/web/app/components/datasets/metadata/metadata-document/info-group.tsx
@@ -50,7 +50,7 @@ const InfoGroup: FC<Props> = ({
const titleId = React.useId()
const router = useRouter()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments'])
const { formatTime: formatTimestamp } = useTimestamp()
const handleMangeMetadata = () => {
diff --git a/web/app/components/datasets/metadata/metadata-document/no-data.tsx b/web/app/components/datasets/metadata/metadata-document/no-data.tsx
index 9c64d9da2a2..6637c321d2b 100644
--- a/web/app/components/datasets/metadata/metadata-document/no-data.tsx
+++ b/web/app/components/datasets/metadata/metadata-document/no-data.tsx
@@ -10,7 +10,7 @@ type Props = Readonly<{
}>
const NoData: FC<Props> = ({ onStart }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
return (
<div className="rounded-xl bg-linear-to-r from-workflow-workflow-progress-bg-1 to-workflow-workflow-progress-bg-2 p-4 pt-3">
<div className="text-xs/5 font-semibold text-text-secondary">
diff --git a/web/app/components/datasets/no-linked-apps-panel.tsx b/web/app/components/datasets/no-linked-apps-panel.tsx
index 12cebaad2c8..727df983d20 100644
--- a/web/app/components/datasets/no-linked-apps-panel.tsx
+++ b/web/app/components/datasets/no-linked-apps-panel.tsx
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'
import { useDocLink } from '@/context/i18n'
const NoLinkedAppsPanel = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const docLink = useDocLink()
return (
diff --git a/web/app/components/datasets/rename-modal/index.tsx b/web/app/components/datasets/rename-modal/index.tsx
index 47d9190f31b..e609b0a3665 100644
--- a/web/app/components/datasets/rename-modal/index.tsx
+++ b/web/app/components/datasets/rename-modal/index.tsx
@@ -21,7 +21,7 @@ type RenameDatasetModalProps = {
onClose: () => void
}
const RenameDatasetModal = ({ show, dataset, onSuccess, onClose }: RenameDatasetModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetSettings'])
const [loading, setLoading] = useState(false)
const [name, setName] = useState<string>(dataset.name)
const [description, setDescription] = useState<string>(dataset.description)
diff --git a/web/app/components/datasets/settings/chunk-structure/hooks.tsx b/web/app/components/datasets/settings/chunk-structure/hooks.tsx
index 159f4a45296..f6b0bb06aab 100644
--- a/web/app/components/datasets/settings/chunk-structure/hooks.tsx
+++ b/web/app/components/datasets/settings/chunk-structure/hooks.tsx
@@ -4,7 +4,7 @@ import { ChunkingMode } from '@/models/datasets'
import { EffectColor } from './types'
export const useChunkStructure = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const GeneralOption: Option = {
id: ChunkingMode.text,
diff --git a/web/app/components/datasets/settings/chunk-structure/index.tsx b/web/app/components/datasets/settings/chunk-structure/index.tsx
index c4f9e2de900..3e025140c04 100644
--- a/web/app/components/datasets/settings/chunk-structure/index.tsx
+++ b/web/app/components/datasets/settings/chunk-structure/index.tsx
@@ -10,7 +10,7 @@ type ChunkStructureProps = {
}
const ChunkStructure = ({ chunkStructure }: ChunkStructureProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetSettings'])
const { options } = useChunkStructure()
return (
diff --git a/web/app/components/datasets/settings/form/components/basic-info-section.tsx b/web/app/components/datasets/settings/form/components/basic-info-section.tsx
index b85e9e22631..2d144f95883 100644
--- a/web/app/components/datasets/settings/form/components/basic-info-section.tsx
+++ b/web/app/components/datasets/settings/form/components/basic-info-section.tsx
@@ -50,7 +50,7 @@ const BasicInfoSection = ({
memberList,
readonly = false,
}: BasicInfoSectionProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetSettings'])
return (
<>
diff --git a/web/app/components/datasets/settings/form/components/external-knowledge-section.tsx b/web/app/components/datasets/settings/form/components/external-knowledge-section.tsx
index 8c6adfa820e..def1851792a 100644
--- a/web/app/components/datasets/settings/form/components/external-knowledge-section.tsx
+++ b/web/app/components/datasets/settings/form/components/external-knowledge-section.tsx
@@ -28,7 +28,7 @@ const ExternalKnowledgeSection = ({
handleSettingsChange,
readonly = false,
}: ExternalKnowledgeSectionProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetSettings'])
return (
<>
diff --git a/web/app/components/datasets/settings/form/components/indexing-section.tsx b/web/app/components/datasets/settings/form/components/indexing-section.tsx
index 392f27f87e6..ce7e3ed816d 100644
--- a/web/app/components/datasets/settings/form/components/indexing-section.tsx
+++ b/web/app/components/datasets/settings/form/components/indexing-section.tsx
@@ -62,7 +62,7 @@ const IndexingSection = ({
ChunkingMode.parentChild,
]
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetSettings'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/datasets/settings/form/hooks/use-form-state.ts b/web/app/components/datasets/settings/form/hooks/use-form-state.ts
index 6198fe41ad9..9ba535d7a01 100644
--- a/web/app/components/datasets/settings/form/hooks/use-form-state.ts
+++ b/web/app/components/datasets/settings/form/hooks/use-form-state.ts
@@ -33,7 +33,7 @@ const DEFAULT_APP_ICON: IconInfo = {
}
export const useFormState = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'datasetSettings'])
const currentDataset = useDatasetDetailContextWithSelector((state) => state.dataset)
const mutateDatasets = useDatasetDetailContextWithSelector((state) => state.mutateDatasetRes)
const { data: currentUserId } = useSuspenseQuery({
diff --git a/web/app/components/datasets/settings/form/index.tsx b/web/app/components/datasets/settings/form/index.tsx
index 7655542375f..f5a969dba90 100644
--- a/web/app/components/datasets/settings/form/index.tsx
+++ b/web/app/components/datasets/settings/form/index.tsx
@@ -8,7 +8,7 @@ import IndexingSection from './components/indexing-section'
import { useFormState } from './hooks/use-form-state'
const Form = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetSettings'])
const {
// Context values
currentDataset,
diff --git a/web/app/components/datasets/settings/index-method/index.tsx b/web/app/components/datasets/settings/index-method/index.tsx
index 3873e11d0b3..3bfb58f86cd 100644
--- a/web/app/components/datasets/settings/index-method/index.tsx
+++ b/web/app/components/datasets/settings/index-method/index.tsx
@@ -24,7 +24,7 @@ const IndexMethod = ({
keywordNumber,
onKeywordNumberChange,
}: IndexMethodProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation', 'datasetSettings'])
const isEconomyDisabled = currentValue === IndexingType.QUALIFIED
return (
diff --git a/web/app/components/datasets/settings/index-method/keyword-number.tsx b/web/app/components/datasets/settings/index-method/keyword-number.tsx
index 4622ad713f1..fd2f705889b 100644
--- a/web/app/components/datasets/settings/index-method/keyword-number.tsx
+++ b/web/app/components/datasets/settings/index-method/keyword-number.tsx
@@ -29,7 +29,7 @@ type KeyWordNumberProps = {
}
const KeyWordNumber = ({ disabled, keywordNumber, onKeywordNumberChange }: KeyWordNumberProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetSettings'])
const label = t(($) => $['form.numberOfKeywords'], { ns: 'datasetSettings' })
const handleInputChange = useCallback(
diff --git a/web/app/components/datasets/settings/option-card.tsx b/web/app/components/datasets/settings/option-card.tsx
index 2d5907794ec..4561503aaed 100644
--- a/web/app/components/datasets/settings/option-card.tsx
+++ b/web/app/components/datasets/settings/option-card.tsx
@@ -44,7 +44,7 @@ const OptionCard = <T,>({
showChildren,
ref,
}: OptionCardProps<T>) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const titleId = React.useId()
const descriptionId = React.useId()
diff --git a/web/app/components/datasets/settings/permission-selector/index.tsx b/web/app/components/datasets/settings/permission-selector/index.tsx
index 791982df581..04850feb9c1 100644
--- a/web/app/components/datasets/settings/permission-selector/index.tsx
+++ b/web/app/components/datasets/settings/permission-selector/index.tsx
@@ -31,7 +31,7 @@ const PermissionSelector = ({
onChange,
onMemberSelect,
}: PermissionSelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetSettings'])
const { data: userProfile } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile,
diff --git a/web/app/components/datasets/settings/permission-selector/member-item.tsx b/web/app/components/datasets/settings/permission-selector/member-item.tsx
index 783f1139736..33f2d464d70 100644
--- a/web/app/components/datasets/settings/permission-selector/member-item.tsx
+++ b/web/app/components/datasets/settings/permission-selector/member-item.tsx
@@ -19,7 +19,7 @@ const MemberItem = ({
isMe = false,
onClick,
}: MemberItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetSettings'])
const content = (
<>
diff --git a/web/app/components/datasets/settings/summary-index-setting.tsx b/web/app/components/datasets/settings/summary-index-setting.tsx
index e06137968bf..7a6ea64ec27 100644
--- a/web/app/components/datasets/settings/summary-index-setting.tsx
+++ b/web/app/components/datasets/settings/summary-index-setting.tsx
@@ -22,7 +22,7 @@ const SummaryIndexSetting = ({
onSummaryIndexSettingChange,
readonly = false,
}: SummaryIndexSettingProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments', 'datasetSettings'])
const summaryLabelId = useId()
const { data: textGenerationModelList = [] } = useQuery(
consoleQuery.workspaces.current.models.modelTypes.byModelType.get.queryOptions({
diff --git a/web/app/components/detail-sidebar/toggle-button.tsx b/web/app/components/detail-sidebar/toggle-button.tsx
index f08dbb89f58..7e35ff0e23b 100644
--- a/web/app/components/detail-sidebar/toggle-button.tsx
+++ b/web/app/components/detail-sidebar/toggle-button.tsx
@@ -21,7 +21,7 @@ export function DetailSidebarToggleButton({
className,
icon,
}: DetailSidebarToggleButtonProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['layout'])
const label = expand
? t(($) => $['sidebar.collapseSidebar'], { ns: 'layout' })
: t(($) => $['sidebar.expandSidebar'], { ns: 'layout' })
diff --git a/web/app/components/explore/category.tsx b/web/app/components/explore/category.tsx
index 687b46b6bbe..dfb5daf4d4b 100644
--- a/web/app/components/explore/category.tsx
+++ b/web/app/components/explore/category.tsx
@@ -16,7 +16,7 @@ type ICategoryProps = {
}
function Category({ className, list, value, onChange, allCategoriesEn }: ICategoryProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['explore'])
const isAllCategories = !list.includes(value) || value === allCategoriesEn
const selectedCategory = isAllCategories ? allCategoriesEn : value
diff --git a/web/app/components/explore/create-app-modal/index.tsx b/web/app/components/explore/create-app-modal/index.tsx
index 39b1a1c6192..112d28ee96f 100644
--- a/web/app/components/explore/create-app-modal/index.tsx
+++ b/web/app/components/explore/create-app-modal/index.tsx
@@ -71,7 +71,7 @@ const CreateAppModal = ({
const nameInputId = React.useId()
const descriptionInputId = React.useId()
const maxActiveRequestsInputId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common', 'explore'])
const [name, setName] = React.useState(appName)
const [appIcon, setAppIcon] = useState(() =>
diff --git a/web/app/components/explore/item-operation/index.tsx b/web/app/components/explore/item-operation/index.tsx
index c344e72f156..0ca1c6fb24a 100644
--- a/web/app/components/explore/item-operation/index.tsx
+++ b/web/app/components/explore/item-operation/index.tsx
@@ -31,8 +31,8 @@ function ItemOperation({
isShowDelete,
onDelete,
}: IItemOperationProps) {
- const { t } = useTranslation('explore')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['explore'])
+ const { t: tCommon } = useTranslation(['common'])
return (
<DropdownMenu modal={false}>
diff --git a/web/app/components/explore/learn-dify/index.tsx b/web/app/components/explore/learn-dify/index.tsx
index 4ec7d880206..446244d4230 100644
--- a/web/app/components/explore/learn-dify/index.tsx
+++ b/web/app/components/explore/learn-dify/index.tsx
@@ -43,7 +43,7 @@ const LearnDifyContent = ({
stepByStepTourTarget,
title,
}: LearnDifyContentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['explore'])
const locale = useLocale()
const [isClosing, setIsClosing] = useState(false)
const [collapseTransform, setCollapseTransform] = useState<string>()
diff --git a/web/app/components/explore/try-app/app-info/index.tsx b/web/app/components/explore/try-app/app-info/index.tsx
index 39c9a44aeef..940bbb65ee4 100644
--- a/web/app/components/explore/try-app/app-info/index.tsx
+++ b/web/app/components/explore/try-app/app-info/index.tsx
@@ -60,7 +60,7 @@ const AppInfo: FC<Props> = ({
appDetail,
onCreate,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'explore'])
const mode = appDetail?.mode
const visibleCategories = Array.from(new Set(categories?.filter(Boolean) ?? []))
const { requirements } = useGetRequirements({ appDetail, appId })
diff --git a/web/app/components/explore/try-app/app/chat.tsx b/web/app/components/explore/try-app/app/chat.tsx
index e5e3c3a2704..1149ab1b645 100644
--- a/web/app/components/explore/try-app/app/chat.tsx
+++ b/web/app/components/explore/try-app/app/chat.tsx
@@ -27,7 +27,7 @@ type Props = Readonly<{
}>
const TryApp: FC<Props> = ({ appId, appDetail, className }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['explore', 'share'])
const media = useBreakpoints()
const isMobile = media === MediaType.mobile
const { removeConversationIdInfo, ...chatData } = useEmbeddedChatbot(AppSourceType.tryApp, appId)
diff --git a/web/app/components/explore/try-app/app/text-generation.tsx b/web/app/components/explore/try-app/app/text-generation.tsx
index b837e63654d..f7e67596916 100644
--- a/web/app/components/explore/try-app/app/text-generation.tsx
+++ b/web/app/components/explore/try-app/app/text-generation.tsx
@@ -33,7 +33,7 @@ type Props = Readonly<{
}>
const TextGeneration: FC<Props> = ({ appId, className, isWorkflow, appData }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['explore', 'share'])
const [descExpanded, setDescExpanded] = useState(false)
const [showDescToggle, setShowDescToggle] = useState(false)
const handleDescRef = useCallback((node: HTMLDivElement | null) => {
diff --git a/web/app/components/explore/try-app/index.tsx b/web/app/components/explore/try-app/index.tsx
index 4c66b62a99b..1bb315a09e0 100644
--- a/web/app/components/explore/try-app/index.tsx
+++ b/web/app/components/explore/try-app/index.tsx
@@ -29,7 +29,7 @@ function TryApp({
onClose,
onCreate,
}: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'explore'])
const appId = app.app_id
const canUseTryTab = app.can_trial
const [type, setType] = useState<TypeEnum>(() => (canUseTryTab ? TypeEnum.TRY : TypeEnum.DETAIL))
diff --git a/web/app/components/goto-anything/components/empty-state.tsx b/web/app/components/goto-anything/components/empty-state.tsx
index a8b43d8bee6..fe03804a268 100644
--- a/web/app/components/goto-anything/components/empty-state.tsx
+++ b/web/app/components/goto-anything/components/empty-state.tsx
@@ -18,7 +18,7 @@ export function EmptyState({
error,
actions = {},
}: EmptyStateProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
if (variant === 'loading') {
return (
diff --git a/web/app/components/goto-anything/components/footer.tsx b/web/app/components/goto-anything/components/footer.tsx
index 5062ca21b47..cc45934cdf3 100644
--- a/web/app/components/goto-anything/components/footer.tsx
+++ b/web/app/components/goto-anything/components/footer.tsx
@@ -10,7 +10,7 @@ type FooterProps = {
}
export function Footer({ resultCount, canActivate, hasPartialFailure }: FooterProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const renderLeftContent = () => {
if (hasPartialFailure) {
diff --git a/web/app/components/goto-anything/index.tsx b/web/app/components/goto-anything/index.tsx
index 052eaaefd2b..a45f96bfce2 100644
--- a/web/app/components/goto-anything/index.tsx
+++ b/web/app/components/goto-anything/index.tsx
@@ -226,7 +226,7 @@ function chunkArray<T>(items: readonly T[], size: number): T[][] {
}
export function GotoAnything() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['agentV2', 'app', 'common', 'skill'])
const pathname = usePathname()
const router = useRouter()
const defaultLocale = useGetLanguage()
diff --git a/web/app/components/header/account-dropdown/compliance.tsx b/web/app/components/header/account-dropdown/compliance.tsx
index b027189cd34..8e3be709691 100644
--- a/web/app/components/header/account-dropdown/compliance.tsx
+++ b/web/app/components/header/account-dropdown/compliance.tsx
@@ -102,7 +102,7 @@ type ComplianceDocRowItemProps = {
}
function ComplianceDocRowItem({ icon, label, docName }: ComplianceDocRowItemProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'common'])
const { data: plan } = useQuery(
consoleQuery.features.get.queryOptions({
enabled: docName !== DocName.GDPR,
@@ -188,7 +188,7 @@ function ComplianceDocRowItem({ icon, label, docName }: ComplianceDocRowItemProp
// Submenu-only: this component must be rendered within an existing DropdownMenu root.
export default function Compliance() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<DropdownMenuSub>
diff --git a/web/app/components/header/account-dropdown/index.tsx b/web/app/components/header/account-dropdown/index.tsx
index 52d5adace3f..5f9df24571d 100644
--- a/web/app/components/header/account-dropdown/index.tsx
+++ b/web/app/components/header/account-dropdown/index.tsx
@@ -31,7 +31,7 @@ export default function AccountDropdown({ trigger }: AccountDropdownProps) {
getHydrationSnapshot,
getServerHydrationSnapshot,
)
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { mutateAsync: logout } = useLogout()
diff --git a/web/app/components/header/account-dropdown/main-nav-menu-content.tsx b/web/app/components/header/account-dropdown/main-nav-menu-content.tsx
index bab433bada1..eef9d5f71cc 100644
--- a/web/app/components/header/account-dropdown/main-nav-menu-content.tsx
+++ b/web/app/components/header/account-dropdown/main-nav-menu-content.tsx
@@ -55,7 +55,7 @@ function MainNavRadioItemContent({ iconClassName, label }: MainNavRadioItemConte
}
function AppearanceSubmenu() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { theme, setTheme } = useTheme()
const currentTheme: Theme =
theme === 'light' || theme === 'dark' || theme === 'system' ? theme : 'system'
@@ -118,7 +118,7 @@ type MainNavMenuContentProps = {
}
export function MainNavMenuContent({ onLogout }: MainNavMenuContentProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { data: userProfile } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile,
diff --git a/web/app/components/header/account-dropdown/workplace-selector/index.tsx b/web/app/components/header/account-dropdown/workplace-selector/index.tsx
index e34a6c5fe4a..088d06b51f4 100644
--- a/web/app/components/header/account-dropdown/workplace-selector/index.tsx
+++ b/web/app/components/header/account-dropdown/workplace-selector/index.tsx
@@ -39,7 +39,7 @@ export const WorkplaceSelectorContent = memo(
workspaces,
popupClassName = 'w-[280px] transition-none data-starting-style:scale-100 data-starting-style:opacity-100 data-ending-style:scale-100 data-ending-style:opacity-100',
}: WorkplaceSelectorContentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<SelectContent className={popupClassName}>
diff --git a/web/app/components/header/account-setting/access-rules-page/access-rule-row-menu.tsx b/web/app/components/header/account-setting/access-rules-page/access-rule-row-menu.tsx
index c167813814f..53313052f30 100644
--- a/web/app/components/header/account-setting/access-rules-page/access-rule-row-menu.tsx
+++ b/web/app/components/header/account-setting/access-rules-page/access-rule-row-menu.tsx
@@ -31,7 +31,7 @@ type AccessRuleRowMenuProps = {
}
const AccessRuleRowMenu = ({ rule, onView, onEdit }: AccessRuleRowMenuProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const [open, setOpen] = useState(false)
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false)
diff --git a/web/app/components/header/account-setting/access-rules-page/access-rule-row.tsx b/web/app/components/header/account-setting/access-rules-page/access-rule-row.tsx
index cc206d860d5..92598f26cd2 100644
--- a/web/app/components/header/account-setting/access-rules-page/access-rule-row.tsx
+++ b/web/app/components/header/account-setting/access-rules-page/access-rule-row.tsx
@@ -23,7 +23,7 @@ const AccessRuleRow = ({
onView,
onEdit,
}: AccessRuleRowProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['permission'])
const { policy } = rule
const description =
policy.description?.trim() || t(($) => $['accessRule.noDescription'], { ns: 'permission' })
diff --git a/web/app/components/header/account-setting/access-rules-page/access-rule-section.tsx b/web/app/components/header/account-setting/access-rules-page/access-rule-section.tsx
index 5c5e2c184f7..159f2570ebb 100644
--- a/web/app/components/header/account-setting/access-rules-page/access-rule-section.tsx
+++ b/web/app/components/header/account-setting/access-rules-page/access-rule-section.tsx
@@ -46,7 +46,7 @@ const AccessRuleSection = ({
onRetry,
className,
}: AccessRuleSectionProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const [expanded, setExpanded] = useState(defaultExpanded)
const listRef = useRef<HTMLDivElement>(null)
const anchorRef = useRef<HTMLDivElement>(null)
diff --git a/web/app/components/header/account-setting/access-rules-page/permission-set-modal/hooks.ts b/web/app/components/header/account-setting/access-rules-page/permission-set-modal/hooks.ts
index 37385f954dd..5f0a34a6b71 100644
--- a/web/app/components/header/account-setting/access-rules-page/permission-set-modal/hooks.ts
+++ b/web/app/components/header/account-setting/access-rules-page/permission-set-modal/hooks.ts
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
import { consoleQuery } from '@/service/console'
export const usePermissionsGroups = (resourceType: AccessPolicyResourceType) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['permission', 'permissionKeys'])
const permissionCatalogQueryOptions =
consoleQuery.workspaces.current.rbac.rolePermissions.catalog[resourceType].get.queryOptions({
input: {},
diff --git a/web/app/components/header/account-setting/access-rules-page/permission-set-modal/index.tsx b/web/app/components/header/account-setting/access-rules-page/permission-set-modal/index.tsx
index 29a67e9ba2d..1caeedfb3e0 100644
--- a/web/app/components/header/account-setting/access-rules-page/permission-set-modal/index.tsx
+++ b/web/app/components/header/account-setting/access-rules-page/permission-set-modal/index.tsx
@@ -44,7 +44,7 @@ const PermissionSetModalBody = ({
onClose,
onSubmit,
}: PermissionSetModalBodyProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const locale = useLocale()
const docLanguage = getDocLanguage(locale)
const [name, setName] = useState(initialValues?.name ?? '')
diff --git a/web/app/components/header/account-setting/access-rules-page/resource-access-rule-section.tsx b/web/app/components/header/account-setting/access-rules-page/resource-access-rule-section.tsx
index adee5bf1961..56f8cd1fa0a 100644
--- a/web/app/components/header/account-setting/access-rules-page/resource-access-rule-section.tsx
+++ b/web/app/components/header/account-setting/access-rules-page/resource-access-rule-section.tsx
@@ -27,7 +27,7 @@ export function ResourceAccessRuleSection({
}: {
resourceType: AccessPolicyResourceType
}) {
- const { t } = useTranslation('permission')
+ const { t } = useTranslation(['permission'])
const language = getAccessControlTemplateLanguage(useLocale())
const canManage = hasPermission(
useAtomValue(workspacePermissionKeysAtom),
diff --git a/web/app/components/header/account-setting/api-based-extension-page/__tests__/item.spec.tsx b/web/app/components/header/account-setting/api-based-extension-page/__tests__/item.spec.tsx
index b0a76663809..f0fe296cd72 100644
--- a/web/app/components/header/account-setting/api-based-extension-page/__tests__/item.spec.tsx
+++ b/web/app/components/header/account-setting/api-based-extension-page/__tests__/item.spec.tsx
@@ -202,7 +202,7 @@ describe('Item Component', () => {
t: withSelectorKey((key: string) => {
if (key === 'operation.delete') return ''
return `common.${key}`
- }, 'common') as unknown as TFunction,
+ }, 'common') as unknown as TFunction<['common']>,
} as unknown as ReturnType<typeof reactI18next.useTranslation>)
// Act
diff --git a/web/app/components/header/account-setting/api-based-extension-page/__tests__/modal.spec.tsx b/web/app/components/header/account-setting/api-based-extension-page/__tests__/modal.spec.tsx
index 7226f018bd2..34978e7c8d2 100644
--- a/web/app/components/header/account-setting/api-based-extension-page/__tests__/modal.spec.tsx
+++ b/web/app/components/header/account-setting/api-based-extension-page/__tests__/modal.spec.tsx
@@ -358,7 +358,7 @@ describe('ApiBasedExtensionModal', () => {
t: withSelectorKey((key: string) => {
if (missingKeys.includes(key)) return ''
return `common.${key}`
- }, 'common') as unknown as TFunction,
+ }, 'common') as unknown as TFunction<['common']>,
} as unknown as ReturnType<typeof reactI18next.useTranslation>)
// Act
diff --git a/web/app/components/header/account-setting/api-based-extension-page/empty.tsx b/web/app/components/header/account-setting/api-based-extension-page/empty.tsx
index 6a9138a2b94..55937929db7 100644
--- a/web/app/components/header/account-setting/api-based-extension-page/empty.tsx
+++ b/web/app/components/header/account-setting/api-based-extension-page/empty.tsx
@@ -3,7 +3,7 @@ import { STEP_BY_STEP_TOUR_TARGETS } from '@/app/components/step-by-step-tour/ta
import { useDocLink } from '@/context/i18n'
export function Empty() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const docLink = useDocLink()
return (
diff --git a/web/app/components/header/account-setting/api-based-extension-page/index.tsx b/web/app/components/header/account-setting/api-based-extension-page/index.tsx
index 9b44a240d94..c01220eedce 100644
--- a/web/app/components/header/account-setting/api-based-extension-page/index.tsx
+++ b/web/app/components/header/account-setting/api-based-extension-page/index.tsx
@@ -30,7 +30,7 @@ type ApiBasedExtensionPageProps = {
}
function ApiBasedExtensionListSkeleton() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div role="status" aria-label={t(($) => $.loading, { ns: 'common' })} className="space-y-2">
@@ -56,7 +56,7 @@ function ApiBasedExtensionListSkeleton() {
}
export function ApiBasedExtensionPage({ layout }: ApiBasedExtensionPageProps = {}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
const canManage = hasPermission(workspacePermissionKeys, 'api_extension.manage')
const { data: apiBasedExtensions = [], isPending: isLoading } = useQuery(
diff --git a/web/app/components/header/account-setting/api-based-extension-page/item.tsx b/web/app/components/header/account-setting/api-based-extension-page/item.tsx
index 331f254bb63..adf6e53f22e 100644
--- a/web/app/components/header/account-setting/api-based-extension-page/item.tsx
+++ b/web/app/components/header/account-setting/api-based-extension-page/item.tsx
@@ -19,7 +19,7 @@ type ItemProps = {
canManage?: boolean
}
export function Item({ apiBasedExtension, onEdit, canManage = true }: ItemProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false)
const deleteApiBasedExtensionMutation = useMutation(
consoleQuery.apiBasedExtension.byId.delete.mutationOptions(),
diff --git a/web/app/components/header/account-setting/api-based-extension-page/modal.tsx b/web/app/components/header/account-setting/api-based-extension-page/modal.tsx
index 2bf3ea1b1d6..d5fd8fe57ac 100644
--- a/web/app/components/header/account-setting/api-based-extension-page/modal.tsx
+++ b/web/app/components/header/account-setting/api-based-extension-page/modal.tsx
@@ -30,7 +30,7 @@ type ApiBasedExtensionModalProps = {
export function ApiBasedExtensionModal(props: ApiBasedExtensionModalProps) {
const { open, mode, onOpenChange, onSaved } = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const docLink = useDocLink()
const createApiBasedExtensionMutation = useMutation(
consoleQuery.apiBasedExtension.post.mutationOptions(),
diff --git a/web/app/components/header/account-setting/api-based-extension-page/selector.tsx b/web/app/components/header/account-setting/api-based-extension-page/selector.tsx
index 0b42c0c6fea..7ab3465ea37 100644
--- a/web/app/components/header/account-setting/api-based-extension-page/selector.tsx
+++ b/web/app/components/header/account-setting/api-based-extension-page/selector.tsx
@@ -23,7 +23,7 @@ type ApiBasedExtensionSelectorProps = {
}
export function ApiBasedExtensionSelector({ value, onChange }: ApiBasedExtensionSelectorProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [open, setOpen] = useState(false)
const [addModalOpen, setAddModalOpen] = useState(false)
const [, setSettingsDestination] = useQueryState(settingsQueryParamName, settingsQueryParser)
diff --git a/web/app/components/header/account-setting/data-source-page-new/card.tsx b/web/app/components/header/account-setting/data-source-page-new/card.tsx
index be8f519f48d..dc032a0c206 100644
--- a/web/app/components/header/account-setting/data-source-page-new/card.tsx
+++ b/web/app/components/header/account-setting/data-source-page-new/card.tsx
@@ -34,7 +34,7 @@ type CardProps = {
onPluginUpdate?: (isDelete?: boolean) => void
}
const Card = ({ item, disabled, pluginDetail, onPluginUpdate }: CardProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments', 'plugin'])
const { canUseCredential, canCreateCredential, canManageCredential } = useCredentialPermissions()
const renderI18nObject = useRenderI18nObject()
const { icon, label, credentials_list, credential_schema } = item
diff --git a/web/app/components/header/account-setting/data-source-page-new/configure.tsx b/web/app/components/header/account-setting/data-source-page-new/configure.tsx
index d6bd15731d7..6904641f09c 100644
--- a/web/app/components/header/account-setting/data-source-page-new/configure.tsx
+++ b/web/app/components/header/account-setting/data-source-page-new/configure.tsx
@@ -18,7 +18,7 @@ type ConfigureProps = {
disabled?: boolean
}
const Configure = ({ item, pluginPayload, onUpdate, disabled }: ConfigureProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const [open, setOpen] = useState(false)
const canApiKey = item.credential_schema?.length
const oAuthData = item.oauth_schema || {}
diff --git a/web/app/components/header/account-setting/data-source-page-new/index.tsx b/web/app/components/header/account-setting/data-source-page-new/index.tsx
index a6cc1738de2..604a3727187 100644
--- a/web/app/components/header/account-setting/data-source-page-new/index.tsx
+++ b/web/app/components/header/account-setting/data-source-page-new/index.tsx
@@ -42,7 +42,7 @@ function DataSourceCardSkeleton() {
}
function DataSourceListSkeleton() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div role="status" aria-label={t(($) => $.loading, { ns: 'common' })} className="space-y-2">
@@ -54,7 +54,7 @@ function DataSourceListSkeleton() {
}
const DataSourcePage = ({ layout, onOpenMarketplace, stickyToolbar }: DataSourcePageProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const queryClient = useQueryClient()
const renderI18nObject = useRenderI18nObject()
const [searchText, setSearchText] = useState('')
diff --git a/web/app/components/header/account-setting/data-source-page-new/install-from-marketplace.tsx b/web/app/components/header/account-setting/data-source-page-new/install-from-marketplace.tsx
index 03308542837..a3570671a1c 100644
--- a/web/app/components/header/account-setting/data-source-page-new/install-from-marketplace.tsx
+++ b/web/app/components/header/account-setting/data-source-page-new/install-from-marketplace.tsx
@@ -24,7 +24,7 @@ const InstallFromMarketplace = ({
providers,
searchText,
}: InstallFromMarketplaceProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const { theme } = useTheme()
const { canInstallPlugin } = usePluginSettingsAccess()
const [collapse, setCollapse] = useState(false)
diff --git a/web/app/components/header/account-setting/data-source-page-new/item.tsx b/web/app/components/header/account-setting/data-source-page-new/item.tsx
index f420704553e..e5ddae20f47 100644
--- a/web/app/components/header/account-setting/data-source-page-new/item.tsx
+++ b/web/app/components/header/account-setting/data-source-page-new/item.tsx
@@ -22,7 +22,7 @@ const Item = ({
canUseCredential = false,
canManageCredential = false,
}: ItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const [renaming, setRenaming] = useState(false)
const [renameValue, setRenameValue] = useState(credentialItem.name)
diff --git a/web/app/components/header/account-setting/data-source-page-new/operator.tsx b/web/app/components/header/account-setting/data-source-page-new/operator.tsx
index d74832b7dfe..476021a8327 100644
--- a/web/app/components/header/account-setting/data-source-page-new/operator.tsx
+++ b/web/app/components/header/account-setting/data-source-page-new/operator.tsx
@@ -25,7 +25,7 @@ const Operator = ({
canUseCredential = false,
canManageCredential = false,
}: OperatorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const { type } = credentialItem
const handleAction = useCallback(
(action: string, allowed: boolean) => {
diff --git a/web/app/components/header/account-setting/data-source-page-new/plugin-actions.tsx b/web/app/components/header/account-setting/data-source-page-new/plugin-actions.tsx
index 6586022adfe..bffd06858ef 100644
--- a/web/app/components/header/account-setting/data-source-page-new/plugin-actions.tsx
+++ b/web/app/components/header/account-setting/data-source-page-new/plugin-actions.tsx
@@ -40,7 +40,7 @@ const getDetailUrl = (detail: PluginDetail, locale: string, theme: string) => {
}
const DataSourcePluginActions = ({ detail, onUpdate }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const { theme } = useTheme()
const locale = useLocale()
const readmeTriggerId = useId()
diff --git a/web/app/components/header/account-setting/index.tsx b/web/app/components/header/account-setting/index.tsx
index 111f3af7eee..ca32ece1745 100644
--- a/web/app/components/header/account-setting/index.tsx
+++ b/web/app/components/header/account-setting/index.tsx
@@ -56,7 +56,7 @@ export default function AccountSetting({
activeTab,
onTabChangeAction,
}: IAccountSettingProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'billing', 'common', 'custom'])
const { data: enableReplaceWebAppLogo } = useQuery(
consoleQuery.features.get.queryOptions({
select: (features) => features.can_replace_logo,
diff --git a/web/app/components/header/account-setting/key-validator/ValidateStatus.tsx b/web/app/components/header/account-setting/key-validator/ValidateStatus.tsx
index be9bea52fda..06591ef681f 100644
--- a/web/app/components/header/account-setting/key-validator/ValidateStatus.tsx
+++ b/web/app/components/header/account-setting/key-validator/ValidateStatus.tsx
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next'
export const ValidatingTip = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className="mt-2 text-xs font-normal text-primary-600">
{t(($) => $['provider.validating'], { ns: 'common' })}
diff --git a/web/app/components/header/account-setting/members-page/assign-roles-modal/index.tsx b/web/app/components/header/account-setting/members-page/assign-roles-modal/index.tsx
index 0de25df92d7..f00fc216523 100644
--- a/web/app/components/header/account-setting/members-page/assign-roles-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/assign-roles-modal/index.tsx
@@ -28,7 +28,7 @@ const AssignRolesModalBody = ({
onClose,
onSubmit,
}: AssignRolesModalBodyProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [selected, setSelected] = useState(selectedRoles)
const selectedRoleIds = selected.map((role) => role.id)
const isConfirmDisabled = selected.length === 0
diff --git a/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx b/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx
index c04b05d97ba..c4aba8156d8 100644
--- a/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/edit-workspace-modal/index.tsx
@@ -15,7 +15,7 @@ type IEditWorkspaceModalProps = {
onCancel: () => void
}
const EditWorkspaceModal = ({ onCancel }: IEditWorkspaceModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const currentWorkspace = useAtomValue(currentWorkspaceAtom)
const isCurrentWorkspaceOwner = useAtomValue(isCurrentWorkspaceOwnerAtom)
const [name, setName] = useState<string>(currentWorkspace.name)
diff --git a/web/app/components/header/account-setting/members-page/index.tsx b/web/app/components/header/account-setting/members-page/index.tsx
index 3141b022438..da51c56ccbe 100644
--- a/web/app/components/header/account-setting/members-page/index.tsx
+++ b/web/app/components/header/account-setting/members-page/index.tsx
@@ -29,7 +29,7 @@ import MemberRow from './member-row'
import TransferOwnershipModal from './transfer-ownership-modal'
const MembersPage = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'common'])
const locale = useLocale()
const language = getAccessControlTemplateLanguage(locale)
diff --git a/web/app/components/header/account-setting/members-page/invite-button.tsx b/web/app/components/header/account-setting/members-page/invite-button.tsx
index 60676bc4ab1..d9acb6add05 100644
--- a/web/app/components/header/account-setting/members-page/invite-button.tsx
+++ b/web/app/components/header/account-setting/members-page/invite-button.tsx
@@ -11,7 +11,7 @@ import { useWorkspacePermissions } from '@/service/use-workspace'
type InviteButtonProps = Omit<ButtonProps, 'children' | 'variant'>
const InviteButton = (props: InviteButtonProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const currentWorkspaceId = useAtomValue(currentWorkspaceIdAtom)
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const { data: workspacePermissions, isFetching: isFetchingWorkspacePermissions } =
diff --git a/web/app/components/header/account-setting/members-page/invite-modal/email-recipients-field.tsx b/web/app/components/header/account-setting/members-page/invite-modal/email-recipients-field.tsx
index 0fe487893b7..1f4990e8a3d 100644
--- a/web/app/components/header/account-setting/members-page/invite-modal/email-recipients-field.tsx
+++ b/web/app/components/header/account-setting/members-page/invite-modal/email-recipients-field.tsx
@@ -30,7 +30,7 @@ export function EmailRecipientsField({
onChange,
disabled = false,
}: EmailRecipientsFieldProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const internalInputRef = useRef<HTMLInputElement>(null)
const chipButtonRef = useRef<Array<HTMLButtonElement | null>>([])
const selectDraftOnRenderRef = useRef(false)
diff --git a/web/app/components/header/account-setting/members-page/invite-modal/index.tsx b/web/app/components/header/account-setting/members-page/invite-modal/index.tsx
index 3d5d7223694..085b4433296 100644
--- a/web/app/components/header/account-setting/members-page/invite-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/invite-modal/index.tsx
@@ -47,7 +47,7 @@ type SubmissionError =
type InviteFormProps = Omit<InviteModalProps, 'open' | 'trigger'>
function InviteForm({ isEmailSetup, onOpenChange, onSend }: InviteFormProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const locale = useLocale()
const queryClient = useQueryClient()
const deploymentEdition = useAtomValue(deploymentEditionAtom)
@@ -190,7 +190,7 @@ export function InviteModal({
onOpenChange,
onSend,
}: InviteModalProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<Dialog open={open} onOpenChange={(nextOpen) => onOpenChange(nextOpen)}>
diff --git a/web/app/components/header/account-setting/members-page/invite-modal/role-selector.tsx b/web/app/components/header/account-setting/members-page/invite-modal/role-selector.tsx
index 7450738a363..c176373ac96 100644
--- a/web/app/components/header/account-setting/members-page/invite-modal/role-selector.tsx
+++ b/web/app/components/header/account-setting/members-page/invite-modal/role-selector.tsx
@@ -50,7 +50,7 @@ function getLegacyRoleDescriptionKey(role: Role) {
}
export function RoleSelector({ hasServerError = false, disabled = false }: RoleSelectorProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const locale = useLocale()
const [open, setOpen] = useState(false)
const listRef = useRef<HTMLDivElement>(null)
diff --git a/web/app/components/header/account-setting/members-page/invited-modal/index.tsx b/web/app/components/header/account-setting/members-page/invited-modal/index.tsx
index 7bd44a6a125..e40a68dc2a9 100644
--- a/web/app/components/header/account-setting/members-page/invited-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/invited-modal/index.tsx
@@ -18,7 +18,7 @@ type IInvitedModalProps = {
onCancel: () => void
}
const InvitedModal = ({ invitationResults, onCancel }: IInvitedModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/header/account-setting/members-page/invited-modal/invitation-link.tsx b/web/app/components/header/account-setting/members-page/invited-modal/invitation-link.tsx
index 03a6718a87a..8fb0056bebe 100644
--- a/web/app/components/header/account-setting/members-page/invited-modal/invitation-link.tsx
+++ b/web/app/components/header/account-setting/members-page/invited-modal/invitation-link.tsx
@@ -12,7 +12,7 @@ type IInvitationLinkProps = {
}
const InvitationLink = ({ value }: IInvitationLinkProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appApi'])
const [isCopied, setIsCopied] = useState(false)
const copyHandle = useCallback(() => {
diff --git a/web/app/components/header/account-setting/members-page/member-details-modal/index.tsx b/web/app/components/header/account-setting/members-page/member-details-modal/index.tsx
index 75f455707d9..931754ee7d3 100644
--- a/web/app/components/header/account-setting/members-page/member-details-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/member-details-modal/index.tsx
@@ -29,7 +29,7 @@ const MemberDetailsModal = ({
onClose,
onAssignSubmit,
}: MemberDetailsModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const locale = useLocale()
const [assignOpen, setAssignOpen] = useState(false)
const language = useMemo(() => getAccessControlTemplateLanguage(locale), [locale])
diff --git a/web/app/components/header/account-setting/members-page/member-details-modal/permission-role-chip.tsx b/web/app/components/header/account-setting/members-page/member-details-modal/permission-role-chip.tsx
index be861be48b6..9f687a9a205 100644
--- a/web/app/components/header/account-setting/members-page/member-details-modal/permission-role-chip.tsx
+++ b/web/app/components/header/account-setting/members-page/member-details-modal/permission-role-chip.tsx
@@ -23,7 +23,7 @@ const PermissionRoleChip = ({
onRemove,
className,
}: PermissionRoleChipProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permissionKeys'])
const permissions = permissionKeys
const canRemoveRole = !isOwner && !!onRemove
// Permission keys come from the catalog API, so this is a reviewed open-key boundary with a server-provided fallback.
diff --git a/web/app/components/header/account-setting/members-page/member-menu.tsx b/web/app/components/header/account-setting/members-page/member-menu.tsx
index 13c4d788ecf..a602245ab28 100644
--- a/web/app/components/header/account-setting/members-page/member-menu.tsx
+++ b/web/app/components/header/account-setting/members-page/member-menu.tsx
@@ -42,7 +42,7 @@ const MemberMenu = ({
allowMultipleRoles = true,
onTransferOwnership,
}: MemberMenuProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const queryClient = useQueryClient()
const [open, setOpen] = useState(false)
const [assignModalOpen, setAssignModalOpen] = useState(false)
diff --git a/web/app/components/header/account-setting/members-page/member-row.tsx b/web/app/components/header/account-setting/members-page/member-row.tsx
index 38e561f9a4a..b262396e2b3 100644
--- a/web/app/components/header/account-setting/members-page/member-row.tsx
+++ b/web/app/components/header/account-setting/members-page/member-row.tsx
@@ -32,7 +32,7 @@ const MemberRow = ({
onOpenDetails,
onTransferOwnership,
}: MemberRowProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { formatTimeFromNow } = useFormatTimeFromNow()
const roleNames = roles.map((role) => role.name)
diff --git a/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx b/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx
index 317236f0e0d..9053e341931 100644
--- a/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/transfer-ownership-modal/index.tsx
@@ -28,7 +28,7 @@ const getErrorMessage = (error: unknown) => {
}
const TransferOwnershipModal = ({ onClose, show }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const verificationCodeInputId = React.useId()
const currentWorkspace = useAtomValue(currentWorkspaceAtom)
const { data: userProfile } = useSuspenseQuery({
diff --git a/web/app/components/header/account-setting/members-page/transfer-ownership-modal/member-selector.tsx b/web/app/components/header/account-setting/members-page/transfer-ownership-modal/member-selector.tsx
index 51e129f80ca..30d131bc65d 100644
--- a/web/app/components/header/account-setting/members-page/transfer-ownership-modal/member-selector.tsx
+++ b/web/app/components/header/account-setting/members-page/transfer-ownership-modal/member-selector.tsx
@@ -15,7 +15,7 @@ type Props = Readonly<{
}>
const MemberSelector: FC<Props> = ({ value, onSelect, exclude = [] }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [open, setOpen] = useState(false)
const [searchValue, setSearchValue] = useState('')
const searchLabel = t(($) => $['operation.search'], { ns: 'common' })
diff --git a/web/app/components/header/account-setting/menu-dialog.tsx b/web/app/components/header/account-setting/menu-dialog.tsx
index ee9a9ae797b..7449eb3bacd 100644
--- a/web/app/components/header/account-setting/menu-dialog.tsx
+++ b/web/app/components/header/account-setting/menu-dialog.tsx
@@ -18,7 +18,7 @@ type MenuDialogProps = {
}
const MenuDialog = ({ children, title, onClose }: MenuDialogProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<Dialog
diff --git a/web/app/components/header/account-setting/model-provider-page/index.tsx b/web/app/components/header/account-setting/model-provider-page/index.tsx
index 3565e3a3c19..f87649df842 100644
--- a/web/app/components/header/account-setting/model-provider-page/index.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/index.tsx
@@ -54,7 +54,7 @@ const ModelProviderPage = ({
hideSystemModelSelectorProviderSettingsFooter,
}: Props) => {
const debouncedSearchText = useDebounce(searchText, { wait: 500 })
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { canSetPluginPreferences } = usePluginSettingsAccess()
const defaultModelQueryOptions = { enabled: canSetPluginPreferences }
const { data: textGenerationDefaultModel, isLoading: isTextGenerationDefaultModelLoading } =
diff --git a/web/app/components/header/account-setting/model-provider-page/install-from-marketplace.tsx b/web/app/components/header/account-setting/model-provider-page/install-from-marketplace.tsx
index e4d1f45c605..0678706aaba 100644
--- a/web/app/components/header/account-setting/model-provider-page/install-from-marketplace.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/install-from-marketplace.tsx
@@ -25,7 +25,7 @@ const InstallFromMarketplace = ({
searchText,
stepByStepTourTarget,
}: InstallFromMarketplaceProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const { theme } = useTheme()
const { canInstallPlugin } = usePluginSettingsAccess()
const [collapse, setCollapse] = useState(false)
diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/add-credential-in-load-balancing.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/add-credential-in-load-balancing.tsx
index cfda5547750..24f0f5facc8 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-auth/add-credential-in-load-balancing.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/add-credential-in-load-balancing.tsx
@@ -34,7 +34,7 @@ const AddCredentialInLoadBalancing = ({
onUpdate,
onRemove,
}: AddCredentialInLoadBalancingProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { canUseCredential, canCreateCredential, canManageCredential } = useCredentialPermissions()
const { available_credentials } = modelCredential
const canOpenCredentialMenu =
diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/add-custom-model.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/add-custom-model.tsx
index 276ab7ed5eb..8d93c580732 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-auth/add-custom-model.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/add-custom-model.tsx
@@ -29,7 +29,7 @@ const AddCustomModel = ({
open: controlledOpen,
onOpenChange,
}: AddCustomModelProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const [localOpen, setLocalOpen] = useState(false)
const open = controlledOpen ?? localOpen
const setOpen = (nextOpen: boolean) => {
diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/credential-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/credential-item.tsx
index 34c0c9860b6..c154be16f1b 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/credential-item.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/credential-item.tsx
@@ -35,7 +35,7 @@ const CredentialItem = ({
showSelectedIcon,
selectedCredentialId,
}: CredentialItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const showAction = useMemo(() => {
return !(disableRename && disableEdit && disableDelete)
}, [disableRename, disableEdit, disableDelete])
diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/index.tsx
index 77bdeef09ea..975a61e62ca 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/index.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/index.tsx
@@ -87,7 +87,7 @@ const Authorized = ({
disableDeleteButShowAction,
disableDeleteTip,
}: AuthorizedProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { canUseCredential, canCreateCredential, canManageCredential } = useCredentialPermissions()
const [isLocalOpen, setIsLocalOpen] = useState(false)
const mergedIsOpen = isOpen ?? isLocalOpen
diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/config-model.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/config-model.tsx
index cf84cd75988..6b2c600d7bb 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-auth/config-model.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/config-model.tsx
@@ -20,7 +20,7 @@ const ConfigModel = ({
loadBalancingInvalid,
credentialRemoved,
}: ConfigModelProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
if (loadBalancingInvalid) {
return (
diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/credential-selector.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/credential-selector.tsx
index 0cd7ac09d5a..925bbcde878 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-auth/credential-selector.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/credential-selector.tsx
@@ -21,7 +21,7 @@ const CredentialSelector = ({
disabled,
notAllowAddNewCredential,
}: CredentialSelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [open, setOpen] = useState(false)
const handleSelect = useCallback(
(credential: Credential & { addNewCredential?: boolean }) => {
diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-auth.ts b/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-auth.ts
index 25a3a73e91d..ed13a2f32f5 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-auth.ts
+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-auth.ts
@@ -38,7 +38,7 @@ export const useAuth = (
} = {},
) => {
const { isModelCredential, onUpdate, onRemove, mode } = extra
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const {
getDeleteCredentialService,
getActiveCredentialService,
diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-model-form-schemas.ts b/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-model-form-schemas.ts
index 7234a361560..29259665d61 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-model-form-schemas.ts
+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-model-form-schemas.ts
@@ -11,7 +11,7 @@ export const useModelFormSchemas = (
credential?: Credential,
model?: CustomModelCredential,
) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const { provider_credential_schema, supported_model_types, model_credential_schema } = provider
const formSchemas = useMemo(() => {
const schemas = providerFormSchemaPredefined
diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/manage-custom-model-credentials.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/manage-custom-model-credentials.tsx
index 0abd385e99e..c283e8bad07 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-auth/manage-custom-model-credentials.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/manage-custom-model-credentials.tsx
@@ -25,7 +25,7 @@ const ManageCustomModelCredentials = ({
isOpen,
onOpenChange,
}: ManageCustomModelCredentialsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const customModels = useCustomModels(provider)
const noModels = !customModels.length
diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/switch-credential-in-load-balancing.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/switch-credential-in-load-balancing.tsx
index 0249e68cd9a..d48685629ee 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-auth/switch-credential-in-load-balancing.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/switch-credential-in-load-balancing.tsx
@@ -33,7 +33,7 @@ const SwitchCredentialInLoadBalancing = ({
onUpdate,
onRemove,
}: SwitchCredentialInLoadBalancingProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const notAllowCustomCredential = provider.allow_custom_token === false
const { canUseCredential, canCreateCredential, canManageCredential } = useCredentialPermissions()
const canOpenCredentialMenu = canUseCredential || canCreateCredential || canManageCredential
diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx
index 739383babb4..2f489df6fbf 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx
@@ -83,7 +83,7 @@ const ModelModal: FC<ModelModalProps> = ({
const { credentials: formSchemasValue, available_credentials } = credentialData as any
const { canUseCredential, canCreateCredential, canManageCredential } = useCredentialPermissions()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const language = useLanguage()
const { formSchemas, formValues, modelNameAndTypeFormSchemas, modelNameAndTypeFormValues } =
useModelFormSchemas(provider, providerFormSchemaPredefined, formSchemasValue, credential, model)
diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx
index d4136dac346..924b5ca9e08 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/index.tsx
@@ -89,7 +89,7 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({
modelPredicate,
modelSuggestionPredicate,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const [open, setOpen] = useState(false)
const { currentProvider, currentModel, activeTextGenerationModelList } =
useTextGenerationCurrentProviderAndModelAndModelList({ provider, model: modelId })
diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/model-settings-trigger.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/model-settings-trigger.tsx
index e536813927c..6f8d65831fd 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/model-settings-trigger.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/model-settings-trigger.tsx
@@ -9,7 +9,7 @@ type ModelSettingsTriggerProps = {
}
function ModelSettingsTrigger({ disabled, surface = 'default' }: ModelSettingsTriggerProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const label = t(($) => $['modelProvider.modelSettings'], { ns: 'common' })
return (
diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx
index 15d02c88b56..2dde1efe104 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx
@@ -53,7 +53,7 @@ function ParameterItem({
nodesOutputVars,
availableNodes = [],
}: ParameterItemProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const language = useLanguage()
const labelId = useId()
const [localValue, setLocalValue] = useState(value)
diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/presets-parameter.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/presets-parameter.tsx
index 94c87995cd5..44eb30d9a5b 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/presets-parameter.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/presets-parameter.tsx
@@ -45,7 +45,7 @@ type PresetsParameterProps = {
}
function PresetsParameter({ onSelect, supportedParameterNames }: PresetsParameterProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const supportedParameterNameSet = supportedParameterNames
? new Set(supportedParameterNames)
: undefined
diff --git a/web/app/components/header/account-setting/model-provider-page/model-provider-page-body.tsx b/web/app/components/header/account-setting/model-provider-page/model-provider-page-body.tsx
index 42b49a1b4e4..57f1014afaf 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-provider-page-body.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-provider-page-body.tsx
@@ -47,7 +47,7 @@ function ModelProviderCardSkeleton() {
}
function ModelProviderListSkeleton() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div role="status" aria-label={t(($) => $.loading, { ns: 'common' })} className="space-y-2">
@@ -65,7 +65,7 @@ function EmptyProviderState({
enableMarketplace: boolean
stepByStepTourTarget?: string
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
return (
<div
@@ -168,7 +168,7 @@ const ModelProviderPageBody: FC<ModelProviderPageBodyProps> = ({
pluginSummaryMap,
onOpenMarketplace,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/feature-icon.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/feature-icon.tsx
index 38005bba7e8..309c155a64f 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-selector/feature-icon.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/feature-icon.tsx
@@ -10,7 +10,7 @@ type FeatureIconProps = {
showFeaturesLabel?: boolean
}
function FeatureIcon({ className, feature, showFeaturesLabel }: FeatureIconProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
if (feature === ModelFeatureEnum.vision) {
if (showFeaturesLabel) {
diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx
index 669912065a9..f1706298bd4 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/index.tsx
@@ -80,7 +80,7 @@ function ModelSelectorRoot({
surface: 'default' | 'workflow'
shape: 'standalone' | 'split'
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const [open, setOpen] = useState(false)
const [inputValue, setInputValue] = useState('')
const [settingsDestination, setSettingsDestination] = useQueryState(
diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/marketplace-section.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/marketplace-section.tsx
index 9634a20c902..9ec171cd1ef 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-selector/marketplace-section.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/marketplace-section.tsx
@@ -29,7 +29,7 @@ function MarketplaceSection({
onInstallPlugin,
onOpenMarketplace,
}: MarketplaceSectionProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const headingId = useId()
if (marketplaceProviders.length === 0) return null
diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/model-selector-trigger.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/model-selector-trigger.tsx
index 6afec796aff..e431c3b3193 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-selector/model-selector-trigger.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/model-selector-trigger.tsx
@@ -48,7 +48,7 @@ function ModelSelectorTrigger({
showModelMeta = true,
isModelCompatible = true,
}: ModelSelectorTriggerProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const showClear = !!defaultModel && !!onClear
const isSelected = !!currentProvider && !!currentModel
diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-empty-state.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-empty-state.tsx
index 2568587a548..dc8d8e7bb12 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-empty-state.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-empty-state.tsx
@@ -6,7 +6,7 @@ type ModelSelectorEmptyStateProps = {
}
function ModelSelectorEmptyState({ onConfigure }: ModelSelectorEmptyStateProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className="mx-2 flex flex-col gap-2 rounded-[10px] bg-linear-to-r from-state-base-hover to-background-gradient-mask-transparent p-4">
diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx
index 84663a7bc50..4650b5a4bbc 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx
@@ -63,7 +63,7 @@ function PopupItem({
}: PopupItemProps) {
const [dropdownOpen, setDropdownOpen] = useState(false)
const providerHeadingId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const language = useLanguage()
const providerLabel = renderI18nObject(model.label, language)
const suggestionTip = t(($) => $['modelProvider.selector.suggestionTip'], { ns: 'common' })
diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-layout.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-layout.tsx
index b4bd64eae3f..267a9a2c488 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-layout.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-layout.tsx
@@ -19,7 +19,7 @@ export function ModelSelectorSearchHeader({
inputValue,
onInputValueChange,
}: ModelSelectorSearchHeaderProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetSettings'])
return (
<div className="shrink-0 bg-components-panel-bg px-2 pt-2 pb-1">
@@ -57,7 +57,7 @@ export function ModelSelectorScrollBody({ children, label }: ModelSelectorScroll
}
export function CompatibleModelsNotice() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className="px-4 py-2 system-xs-regular text-text-tertiary">
@@ -75,7 +75,7 @@ export function ShowIncompatibleModelsButton({
showIncompatibleModels,
onClick,
}: ShowIncompatibleModelsButtonProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<Button
@@ -98,7 +98,7 @@ type ModelProviderSettingsFooterProps = {
}
export function ModelProviderSettingsFooter({ onOpenSettings }: ModelProviderSettingsFooterProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className="shrink-0 border-t border-divider-subtle p-1">
diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx
index 68d78f2250c..066d8f64c5a 100644
--- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup.tsx
@@ -82,7 +82,7 @@ function Popup({
onOpenMarketplace,
onHide,
}: PopupProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { theme } = useTheme()
const language = useLanguage()
const previewCardHandle = useMemo(
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/cooldown-timer.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/cooldown-timer.tsx
index aafdd4b220b..ce2a5d10ced 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/cooldown-timer.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/cooldown-timer.tsx
@@ -9,7 +9,7 @@ type CooldownTimerProps = {
}
const CooldownTimer = ({ secondsRemaining = 0, onFinish }: CooldownTimerProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [countdown, setCountdown] = useState({ secondsRemaining, displayTime: secondsRemaining })
if (countdown.secondsRemaining !== secondsRemaining) {
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/credential-panel.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/credential-panel.tsx
index 5729afc3edc..ab3e9e51123 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/credential-panel.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/credential-panel.tsx
@@ -98,7 +98,7 @@ const TEXT_LABEL_KEYS = {
} as const satisfies Partial<Record<CardVariant, string>>
function TextLabel({ variant }: { variant: CardVariant }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const isDestructive = isDestructiveVariant(variant)
const labelKey = TEXT_LABEL_KEYS[variant as keyof typeof TEXT_LABEL_KEYS]
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/index.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/index.tsx
index 01949571294..f5a486a4878 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/index.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/index.tsx
@@ -45,7 +45,7 @@ const ProviderAddedCard: FC<ProviderAddedCardProps> = ({
provider,
pluginSummary,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const {
data: { deploymentEdition, rbacEnabled },
} = useSuspenseQuery({
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/lazy-custom-model-actions.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/lazy-custom-model-actions.tsx
index 85412e87b1a..f9f9746b0c2 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/lazy-custom-model-actions.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/lazy-custom-model-actions.tsx
@@ -13,7 +13,7 @@ import { useLazyModelProviderDetail, useModelModalHandler } from '../hooks'
type ProviderSummary = ModelProviderSummaryResponse | ModelProvider
export default function LazyCustomModelActions({ provider }: { provider: ProviderSummary }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const handleOpenModelModal = useModelModalHandler()
const [isAddOpen, setIsAddOpen] = useState(false)
const [isManageOpen, setIsManageOpen] = useState(false)
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/api-key-section.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/api-key-section.tsx
index 218ac1db90a..9161df196c1 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/api-key-section.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/api-key-section.tsx
@@ -26,7 +26,7 @@ function ApiKeySection({
onDelete,
onAdd,
}: ApiKeySectionProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const notAllowCustomCredential = provider.allow_custom_token === false
const { canUseCredential, canCreateCredential, canManageCredential } = useCredentialPermissions()
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/button-config.ts b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/button-config.ts
index d0c299dc097..1b16ef931a8 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/button-config.ts
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/button-config.ts
@@ -1,7 +1,11 @@
import type { TFunction } from 'i18next'
import type { CardVariant } from '../use-credential-panel-state'
-export function getButtonConfig(variant: CardVariant, hasCredentials: boolean, t: TFunction) {
+export function getButtonConfig(
+ variant: CardVariant,
+ hasCredentials: boolean,
+ t: TFunction<['common']>,
+) {
if (variant === 'api-required-add') {
return {
text: t(($) => $['modelProvider.auth.addApiKey'], { ns: 'common' }),
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/credits-exhausted-alert.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/credits-exhausted-alert.tsx
index 81fcbcbe89b..adb42e222c4 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/credits-exhausted-alert.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/credits-exhausted-alert.tsx
@@ -21,7 +21,7 @@ export default function CreditsExhaustedAlert({
credits: creditsOverride,
totalCredits: totalCreditsOverride,
}: CreditsExhaustedAlertProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/credits-fallback-alert.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/credits-fallback-alert.tsx
index 61e0ab04bc8..df3fc32f1f6 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/credits-fallback-alert.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/credits-fallback-alert.tsx
@@ -5,7 +5,7 @@ type CreditsFallbackAlertProps = {
}
export default function CreditsFallbackAlert({ hasCredentials }: CreditsFallbackAlertProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const titleKey = hasCredentials
? 'modelProvider.card.apiKeyUnavailableFallback'
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/dropdown-content.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/dropdown-content.tsx
index 04f65fb36de..36c383b34bb 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/dropdown-content.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/dropdown-content.tsx
@@ -37,7 +37,7 @@ function DropdownContent({
onChangePriority,
onClose,
}: DropdownContentProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { available_credentials } = provider.custom_configuration
const { canUseCredential, canCreateCredential, canManageCredential } = useCredentialPermissions()
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/index.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/index.tsx
index 90c67bfaf2a..121debeb1a2 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/index.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/index.tsx
@@ -22,7 +22,7 @@ function ModelAuthDropdown({
isChangingPriority,
onChangePriority,
}: ModelAuthDropdownProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [open, setOpen] = useState(false)
const [isProviderDetailError, setIsProviderDetailError] = useState(false)
const isFullProvider = !('is_configured' in provider) || 'provider_credential_schema' in provider
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/usage-priority-section.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/usage-priority-section.tsx
index 43e4a6f0e73..54dd8fbfceb 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/usage-priority-section.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/usage-priority-section.tsx
@@ -23,7 +23,7 @@ export default function UsagePrioritySection({
}: UsagePrioritySectionProps) {
const priorityLabelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const selectedKey =
value === 'credits' ? PreferredProviderTypeEnum.system : PreferredProviderTypeEnum.custom
const usagePriorityTip = t(($) => $['modelProvider.card.usagePriorityTip'], { ns: 'common' })
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/use-activate-credential.ts b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/use-activate-credential.ts
index 98f67b6ce56..00295f60878 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/use-activate-credential.ts
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/use-activate-credential.ts
@@ -6,7 +6,7 @@ import { useActiveProviderCredential } from '@/service/use-models'
import { useUpdateModelList, useUpdateModelProviders } from '../../hooks'
export function useActivateCredential(provider: ModelProvider) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const updateModelProviders = useUpdateModelProviders()
const updateModelList = useUpdateModelList()
const { mutate, isPending } = useActiveProviderCredential(provider.provider)
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list-item.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list-item.tsx
index 8a01ac5e071..54ee316e576 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list-item.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list-item.tsx
@@ -39,7 +39,7 @@ const ModelListItem = ({
onChange,
onModifyLoadBalancing,
}: ModelListItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const deploymentEdition = useAtomValue(deploymentEditionAtom)
const { data: features } = useQuery(
consoleQuery.features.get.queryOptions({
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx
index 3d8015f1588..d70b25cdcb4 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-list.tsx
@@ -18,7 +18,7 @@ import ModelListItem from './model-list-item'
const ModelLoadBalancingLoadingDialog = ({
onClose,
}: Pick<ModelLoadBalancingModalProps, 'onClose'>) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<Dialog open onOpenChange={(open) => !open && onClose?.()}>
@@ -65,7 +65,7 @@ const loadModelLoadBalancingModal = () => {
}
const ModelList: FC<ModelListProps> = ({ provider, models, onCollapse, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const configurativeMethods = provider.configurate_methods.filter(
(method) => method !== ConfigurationMethodEnum.fetchFromRemote,
)
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-configs.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-configs.tsx
index bfb46378eb8..b6da3b6887b 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-configs.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-configs.tsx
@@ -55,7 +55,7 @@ const ModelLoadBalancingConfigs = ({
}: ModelLoadBalancingConfigsProps) => {
const loadBalancingLabelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx
index 1275275327f..910413f2d53 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx
@@ -51,7 +51,7 @@ const ModelLoadBalancingModal = ({
onClose,
onSave,
}: ModelLoadBalancingModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { doingAction, deleteModel, openConfirmDelete, closeConfirmDelete, handleConfirmDelete } =
useAuth(provider, configurateMethod, currentCustomConfigurationModelFixedFields, {
isModelCredential: true,
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/provider-card-actions.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/provider-card-actions.tsx
index fbee6a9392c..f7c8eb9bde0 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/provider-card-actions.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/provider-card-actions.tsx
@@ -98,7 +98,7 @@ const ProviderCardActions: FC<Props> = (props) => {
type SummaryProps = Extract<Props, { summary: ModelProviderPluginSummary }>
function SummaryProviderCardActions({ summary, providerLabel, onUpdate }: SummaryProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'plugin'])
const queryClient = useQueryClient()
const { canDeletePlugin, canUpdatePlugin } = usePluginSettingsAccess()
const [detail, setDetail] = useState<PluginDetail>()
@@ -292,7 +292,7 @@ function LoadedProviderCardActions({
onInitialActionHandled,
onUpdate,
}: LoadedProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'plugin'])
const { theme } = useTheme()
const locale = useLocale()
const { canDeletePlugin, canUpdatePlugin } = usePluginSettingsAccess()
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx
index 0b98b77d423..8cdb500c2d3 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx
@@ -79,7 +79,7 @@ type MarketplacePluginToInstall = {
}
const QuotaPanel: FC<QuotaPanelProps> = ({ providers }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/use-change-provider-priority.ts b/web/app/components/header/account-setting/model-provider-page/provider-added-card/use-change-provider-priority.ts
index d05cf2e7287..82e26054074 100644
--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/use-change-provider-priority.ts
+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/use-change-provider-priority.ts
@@ -10,7 +10,7 @@ import { useUpdateModelList, useUpdateModelProviders } from '../hooks'
export function useChangeProviderPriority(
provider: ModelProvider | ModelProviderSummaryResponse | undefined,
) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const queryClient = useQueryClient()
const updateModelList = useUpdateModelList()
const updateModelProviders = useUpdateModelProviders()
diff --git a/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx b/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx
index 0b5de3c955e..e88fce54301 100644
--- a/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx
+++ b/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx
@@ -65,7 +65,7 @@ const SystemModel: FC<SystemModelSelectorProps> = ({
}) => {
const modelLabelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
const { data: textGenerationModelList = [] } = useQuery(
consoleQuery.workspaces.current.models.modelTypes.byModelType.get.queryOptions({
diff --git a/web/app/components/header/account-setting/permission-group-list.tsx b/web/app/components/header/account-setting/permission-group-list.tsx
index e5c8502ffe3..19454d249cb 100644
--- a/web/app/components/header/account-setting/permission-group-list.tsx
+++ b/web/app/components/header/account-setting/permission-group-list.tsx
@@ -28,7 +28,7 @@ const PermissionGroupList = ({
className,
readonly = false,
}: PermissionGroupListProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['permission'])
const [expandedGroupKeys, setExpandedGroupKeys] = useState<Set<string> | null>(null)
const selectedSet = useMemo(() => new Set(value), [value])
diff --git a/web/app/components/header/account-setting/permissions-page/index.tsx b/web/app/components/header/account-setting/permissions-page/index.tsx
index 305ee6341f2..3dd8b2cb550 100644
--- a/web/app/components/header/account-setting/permissions-page/index.tsx
+++ b/web/app/components/header/account-setting/permissions-page/index.tsx
@@ -31,7 +31,7 @@ type ModalState = {
const PAGE_SIZE = 20
const PermissionsPage = ({ containerRef }: PermissionsPageProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['permission'])
const locale = useLocale()
const [modalState, setModalState] = useState<ModalState>(null)
const anchorRef = useRef<HTMLDivElement>(null)
diff --git a/web/app/components/header/account-setting/permissions-page/role-list/copy-members-confirm-dialog.tsx b/web/app/components/header/account-setting/permissions-page/role-list/copy-members-confirm-dialog.tsx
index 46380de922a..19d2810f699 100644
--- a/web/app/components/header/account-setting/permissions-page/role-list/copy-members-confirm-dialog.tsx
+++ b/web/app/components/header/account-setting/permissions-page/role-list/copy-members-confirm-dialog.tsx
@@ -25,7 +25,7 @@ export function CopyMembersConfirmDialog({
onOpenChange,
onDuplicate,
}: CopyMembersConfirmDialogProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const { data: membersOfRole, isPending: isLoadingMembersOfRole } = useGetMembersOfRole({
roleId: role.id,
page: 1,
diff --git a/web/app/components/header/account-setting/permissions-page/role-list/index.tsx b/web/app/components/header/account-setting/permissions-page/role-list/index.tsx
index 453386140b1..56684acfefb 100644
--- a/web/app/components/header/account-setting/permissions-page/role-list/index.tsx
+++ b/web/app/components/header/account-setting/permissions-page/role-list/index.tsx
@@ -31,7 +31,7 @@ const RoleList = ({
onView,
onEdit,
}: RoleListProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['permission'])
if (isLoading) {
return (
diff --git a/web/app/components/header/account-setting/permissions-page/role-list/row-menu.tsx b/web/app/components/header/account-setting/permissions-page/role-list/row-menu.tsx
index 167490c671b..107bf94665c 100644
--- a/web/app/components/header/account-setting/permissions-page/role-list/row-menu.tsx
+++ b/web/app/components/header/account-setting/permissions-page/role-list/row-menu.tsx
@@ -37,7 +37,7 @@ type RowMenuProps = {
}
const RowMenu = ({ roleCategory, role, onView, onEdit }: RowMenuProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const [open, setOpen] = useState(false)
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false)
const [showCopyMembersConfirm, setShowCopyMembersConfirm] = useState(false)
diff --git a/web/app/components/header/account-setting/permissions-page/role-list/row.tsx b/web/app/components/header/account-setting/permissions-page/role-list/row.tsx
index d9301bbfcd5..0f414d22e9a 100644
--- a/web/app/components/header/account-setting/permissions-page/role-list/row.tsx
+++ b/web/app/components/header/account-setting/permissions-page/role-list/row.tsx
@@ -15,7 +15,7 @@ type RowProps = {
}
const Row = ({ className, name, description, roleCategory, role, onView, onEdit }: RowProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['permission'])
return (
<div
diff --git a/web/app/components/header/account-setting/permissions-page/role-modal/hooks.ts b/web/app/components/header/account-setting/permissions-page/role-modal/hooks.ts
index 8b3ea6991b2..121c4d02161 100644
--- a/web/app/components/header/account-setting/permissions-page/role-modal/hooks.ts
+++ b/web/app/components/header/account-setting/permissions-page/role-modal/hooks.ts
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'
import { consoleQuery } from '@/service/console'
export const useWorkspacePermissionGroups = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['permission', 'permissionKeys'])
const { data: workspacePermissionCatalog } = useQuery(
consoleQuery.workspaces.current.rbac.rolePermissions.catalog.get.queryOptions({
input: {},
diff --git a/web/app/components/header/account-setting/permissions-page/role-modal/index.tsx b/web/app/components/header/account-setting/permissions-page/role-modal/index.tsx
index 740ab51a93c..acf8e02e9b6 100644
--- a/web/app/components/header/account-setting/permissions-page/role-modal/index.tsx
+++ b/web/app/components/header/account-setting/permissions-page/role-modal/index.tsx
@@ -35,7 +35,7 @@ type RoleModalProps = {
}
const RoleModal = ({ mode, open, role, onClose, onSubmit }: RoleModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const locale = useLocale()
const docLanguage = getDocLanguage(locale)
const [name, setName] = useState(role?.name ?? '')
diff --git a/web/app/components/header/account-setting/permissions-page/role-modal/permission-field.tsx b/web/app/components/header/account-setting/permissions-page/role-modal/permission-field.tsx
index 38925399d82..f423feab237 100644
--- a/web/app/components/header/account-setting/permissions-page/role-modal/permission-field.tsx
+++ b/web/app/components/header/account-setting/permissions-page/role-modal/permission-field.tsx
@@ -10,7 +10,7 @@ type PermissionFieldProps = {
}
const PermissionField = ({ value, onChange, readonly = false }: PermissionFieldProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['permission'])
return (
<div className="flex min-h-0 flex-1 flex-col gap-2">
diff --git a/web/app/components/header/account-setting/preference-page/index.tsx b/web/app/components/header/account-setting/preference-page/index.tsx
index e30061acf0b..c892379241d 100644
--- a/web/app/components/header/account-setting/preference-page/index.tsx
+++ b/web/app/components/header/account-setting/preference-page/index.tsx
@@ -49,7 +49,7 @@ export default function PreferencePage() {
})
const updateProfile = useMutation(consoleQuery.account.profile.patch.mutationOptions())
const [editing, setEditing] = useState(false)
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const router = useRouter()
const { theme, setTheme } = useTheme()
const languageOptions: SelectOption[] = languages.filter((item) => item.supported)
diff --git a/web/app/components/header/account-setting/update-setting-dialog-form.tsx b/web/app/components/header/account-setting/update-setting-dialog-form.tsx
index 8f77a712926..e013a7e7964 100644
--- a/web/app/components/header/account-setting/update-setting-dialog-form.tsx
+++ b/web/app/components/header/account-setting/update-setting-dialog-form.tsx
@@ -88,7 +88,7 @@ const UpdateSettingDialogForm = ({
onUpdateTimeChange,
renderTimePickerTrigger,
}: UpdateSettingDialogFormProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const [previewStrategy, setPreviewStrategy] = useState<AUTO_UPDATE_STRATEGY>()
const displayedStrategy = previewStrategy ?? autoUpgrade.strategy_setting
const getStrategyDescription = (strategy: AUTO_UPDATE_STRATEGY) => {
diff --git a/web/app/components/header/account-setting/update-setting-dialog.tsx b/web/app/components/header/account-setting/update-setting-dialog.tsx
index 756f40052c3..d29a59688dd 100644
--- a/web/app/components/header/account-setting/update-setting-dialog.tsx
+++ b/web/app/components/header/account-setting/update-setting-dialog.tsx
@@ -43,7 +43,7 @@ type Props = {
}
const UpdateSettingDialog = ({ category, disabled = false }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const { data: timezone } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.timezone || 'UTC',
diff --git a/web/app/components/header/account-setting/workflow-log-archives-page/index.tsx b/web/app/components/header/account-setting/workflow-log-archives-page/index.tsx
index 3d90af5d138..adce75d6828 100644
--- a/web/app/components/header/account-setting/workflow-log-archives-page/index.tsx
+++ b/web/app/components/header/account-setting/workflow-log-archives-page/index.tsx
@@ -64,7 +64,7 @@ function buildArchiveDownloadFileUrl(downloadId: string) {
}
export default function WorkflowLogArchivesPage() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
@@ -281,7 +281,7 @@ export default function WorkflowLogArchivesPage() {
}
function ArchivedLogsUpgradeBanner() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'billing'])
const [, setPricing] = useQueryState(pricingQueryParamName, pricingQueryParser)
return (
@@ -306,7 +306,7 @@ function ArchivedLogsUpgradeBanner() {
}
function WorkflowArchiveMonthRow({ archive }: { archive: WorkflowRunArchiveMonthResponse }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common'])
const archiveMonthLabelId = useId()
const downloadActionLabelId = useId()
const [downloadTask, setDownloadTask] = useState<WorkflowRunArchiveDownloadTaskResponse | null>(
diff --git a/web/app/components/header/account-setting/workspace-role-checkbox-list.tsx b/web/app/components/header/account-setting/workspace-role-checkbox-list.tsx
index 5445c25d58c..b0d2390c236 100644
--- a/web/app/components/header/account-setting/workspace-role-checkbox-list.tsx
+++ b/web/app/components/header/account-setting/workspace-role-checkbox-list.tsx
@@ -69,7 +69,7 @@ const WorkspaceRoleCheckboxList = ({
onSelectedRolesChange,
includeOwner = false,
}: WorkspaceRoleCheckboxListProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const locale = useLocale()
const [keyword, setKeyword] = useState('')
const containerRef = useRef<HTMLDivElement>(null)
diff --git a/web/app/components/header/env-nav/index.tsx b/web/app/components/header/env-nav/index.tsx
index 9adffec011e..34c029e47e5 100644
--- a/web/app/components/header/env-nav/index.tsx
+++ b/web/app/components/header/env-nav/index.tsx
@@ -10,7 +10,7 @@ const headerEnvClassName: { [k: string]: string } = {
}
const EnvNav = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { data: currentEnv } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.meta.currentEnv,
diff --git a/web/app/components/header/license-badge/index.tsx b/web/app/components/header/license-badge/index.tsx
index e0bad0bd089..0fe5d567ad6 100644
--- a/web/app/components/header/license-badge/index.tsx
+++ b/web/app/components/header/license-badge/index.tsx
@@ -8,7 +8,7 @@ import { consoleQuery } from '@/service/console'
import PremiumBadge from '../../base/premium-badge'
function LicenseBadge() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { data: license } = useQuery(consoleQuery.systemFeatures.license.get.queryOptions())
const isExpiring = license?.status === zLicenseStatus.enum.expiring
diff --git a/web/app/components/integrations/hooks/use-integration-nav.ts b/web/app/components/integrations/hooks/use-integration-nav.ts
index d0d4d0835c4..dbbdfe1558e 100644
--- a/web/app/components/integrations/hooks/use-integration-nav.ts
+++ b/web/app/components/integrations/hooks/use-integration-nav.ts
@@ -18,7 +18,7 @@ export const getPluginCategoryBySection = (section: IntegrationSection) => {
}
export function useIntegrationNav(section: IntegrationSection) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin', 'workflow'])
const providerItem = useMemo<IntegrationSidebarNavItemData>(
() => ({
section: 'provider',
diff --git a/web/app/components/integrations/index.tsx b/web/app/components/integrations/index.tsx
index e3a7b398ee3..c45f780a686 100644
--- a/web/app/components/integrations/index.tsx
+++ b/web/app/components/integrations/index.tsx
@@ -125,7 +125,7 @@ export default function IntegrationsPage({
section: routeSection,
syncDocumentTitle = false,
}: IntegrationsPageProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const navigationTitleId = useId()
const docLink = useDocLink()
const router = useRouter()
diff --git a/web/app/components/integrations/modal.tsx b/web/app/components/integrations/modal.tsx
index 5eb914c936e..fd8b9dea8d0 100644
--- a/web/app/components/integrations/modal.tsx
+++ b/web/app/components/integrations/modal.tsx
@@ -18,7 +18,7 @@ export default function IntegrationsSettingModal({
onCancel,
onSectionChange,
}: IntegrationsSettingModalProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const handleSwitchToMarketplace = useCallback((path: string) => {
window.open(
getMarketplaceUrl(path, undefined, { source: window.location.origin }),
diff --git a/web/app/components/integrations/permission-quick-panel.tsx b/web/app/components/integrations/permission-quick-panel.tsx
index 64ed8e4044e..4d7a18b7b58 100644
--- a/web/app/components/integrations/permission-quick-panel.tsx
+++ b/web/app/components/integrations/permission-quick-panel.tsx
@@ -28,7 +28,7 @@ const permissionOptionCardClassName = cn(
)
export function PermissionQuickPanel({ permission, onChange }: PermissionQuickPanelProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const rows: Array<{
key: PermissionSettingKey
label: string
diff --git a/web/app/components/integrations/sidebar-actions.tsx b/web/app/components/integrations/sidebar-actions.tsx
index 715284182ff..7e18118963a 100644
--- a/web/app/components/integrations/sidebar-actions.tsx
+++ b/web/app/components/integrations/sidebar-actions.tsx
@@ -65,7 +65,7 @@ export function IntegrationSidebarActions({
installContextCategory?: PluginCategoryEnum
onSwitchToMarketplace: () => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
return (
<IntegrationSidebarInstallActions
@@ -140,7 +140,7 @@ export function IntegrationSidebarUtilityActions({
showPermissionQuickPanel: boolean
onPermissionChange: (key: PermissionSettingKey, value: PermissionType) => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const debugLabel = t(($) => $['debugInfo.title'], { ns: 'plugin' })
const permissionsLabel = t(($) => $['privilege.permissions'], { ns: 'plugin' })
diff --git a/web/app/components/integrations/tool-provider-card.tsx b/web/app/components/integrations/tool-provider-card.tsx
index 85c4a804e28..e576888b86e 100644
--- a/web/app/components/integrations/tool-provider-card.tsx
+++ b/web/app/components/integrations/tool-provider-card.tsx
@@ -40,7 +40,7 @@ function IntegrationsToolProviderCard({
variant = 'default',
}: IntegrationsToolProviderCardProps) {
const language = useGetLanguage()
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset', 'tools'])
const title = renderI18nObject(collection.label, language)
const description = renderI18nObject(collection.description, language)
const { org, name } = getCollectionPluginIdentity(collection)
diff --git a/web/app/components/integrations/tool-provider-list.tsx b/web/app/components/integrations/tool-provider-list.tsx
index 634bd04b5e5..5f751d35825 100644
--- a/web/app/components/integrations/tool-provider-list.tsx
+++ b/web/app/components/integrations/tool-provider-list.tsx
@@ -50,7 +50,7 @@ const EMPTY_COLLECTIONS: Collection[] = []
const ProviderList = ({ category, contentInset = 'default', layout }: ProviderListProps) => {
// const searchParams = useSearchParams()
// searchParams.get('category') === 'workflow'
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
const { getTagLabel } = useTags()
const { canDeletePlugin, canSetPluginPreferences, canUpdatePlugin } = usePluginSettingsAccess()
const canManageTools = useCanManageTools()
diff --git a/web/app/components/integrations/tool-provider-toolbar.tsx b/web/app/components/integrations/tool-provider-toolbar.tsx
index d29ef57da43..a1e215ce0dc 100644
--- a/web/app/components/integrations/tool-provider-toolbar.tsx
+++ b/web/app/components/integrations/tool-provider-toolbar.tsx
@@ -43,7 +43,7 @@ export function ToolProviderToolbar({
onKeywordsChange: (keywords: string) => void
onTagsChange: (tags: string[]) => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
return (
<div
diff --git a/web/app/components/main-nav/components/help-menu.tsx b/web/app/components/main-nav/components/help-menu.tsx
index 270ca7fdc62..c426d815f2d 100644
--- a/web/app/components/main-nav/components/help-menu.tsx
+++ b/web/app/components/main-nav/components/help-menu.tsx
@@ -91,7 +91,7 @@ const MenuSwitchIndicator = ({ checked }: { checked: boolean }) => (
)
const HelpMenu = ({ triggerIcon, triggerClassName, triggerRef, triggerSize }: HelpMenuProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const docLink = useDocLink()
const creatorCenterUrl = useCreatorCenterUrl(MARKETPLACE_URL_PREFIX)
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
diff --git a/web/app/components/main-nav/components/help-menu/account-about-dialog.tsx b/web/app/components/main-nav/components/help-menu/account-about-dialog.tsx
index 3eb51f55547..0b2a8d493b4 100644
--- a/web/app/components/main-nav/components/help-menu/account-about-dialog.tsx
+++ b/web/app/components/main-nav/components/help-menu/account-about-dialog.tsx
@@ -22,7 +22,7 @@ export default function AccountAboutDialog({
langGeniusVersionInfo,
deploymentEdition,
}: AccountAboutDialogProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const isLatest = langGeniusVersionInfo.current_version === langGeniusVersionInfo.latest_version
const isNonCloudEdition = deploymentEdition === 'COMMUNITY' || deploymentEdition === 'ENTERPRISE'
diff --git a/web/app/components/main-nav/components/search-button.tsx b/web/app/components/main-nav/components/search-button.tsx
index 509b1a4c5cb..fdba9f6ac97 100644
--- a/web/app/components/main-nav/components/search-button.tsx
+++ b/web/app/components/main-nav/components/search-button.tsx
@@ -26,7 +26,7 @@ export function MainNavSearchButton({
}: {
initialPlatform?: ShortcutPlatform | null
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const displayPlatform = useDisplayPlatform(initialPlatform)
const ariaKeyShortcuts =
displayPlatform === null
diff --git a/web/app/components/main-nav/components/support-menu.tsx b/web/app/components/main-nav/components/support-menu.tsx
index 69f988b77dd..4f786912efb 100644
--- a/web/app/components/main-nav/components/support-menu.tsx
+++ b/web/app/components/main-nav/components/support-menu.tsx
@@ -19,7 +19,7 @@ import { systemFeaturesQueryOptions } from '@/features/system-features/client'
import { consoleQuery } from '@/service/console'
export default function SupportMenu() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'common'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/main-nav/components/web-apps-section.tsx b/web/app/components/main-nav/components/web-apps-section.tsx
index 444786729b0..a731ea91bd8 100644
--- a/web/app/components/main-nav/components/web-apps-section.tsx
+++ b/web/app/components/main-nav/components/web-apps-section.tsx
@@ -67,7 +67,7 @@ type WebAppListRow =
}
const WebAppsSectionContent = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'explore'])
const pathname = usePathname()
const scrollRef = useRef<HTMLDivElement>(null)
const sectionToggleRef = useRef<HTMLButtonElement>(null)
diff --git a/web/app/components/main-nav/components/workspace-card.tsx b/web/app/components/main-nav/components/workspace-card.tsx
index 695aec921e6..e8831bcc56e 100644
--- a/web/app/components/main-nav/components/workspace-card.tsx
+++ b/web/app/components/main-nav/components/workspace-card.tsx
@@ -107,7 +107,7 @@ function WorkspaceCardTrigger({
onPrefetchWorkspaces: () => void
onPlanClick: () => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const creditsUnit = t(($) => $['mainNav.workspace.creditsUnit'], { ns: 'common' })
const openMenuLabel = t(($) => $['mainNav.workspace.openMenu'], { ns: 'common' })
const isUnlimited = credits === -1
@@ -253,7 +253,7 @@ const selectCurrentWorkspaceCardData = (workspace: CurrentWorkspaceCardSource) =
})
export function WorkspaceCard() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'common'])
const queryClient = useQueryClient()
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
diff --git a/web/app/components/main-nav/components/workspace-switcher.tsx b/web/app/components/main-nav/components/workspace-switcher.tsx
index 3c89005b945..58e7d098854 100644
--- a/web/app/components/main-nav/components/workspace-switcher.tsx
+++ b/web/app/components/main-nav/components/workspace-switcher.tsx
@@ -43,7 +43,7 @@ function WorkspaceSwitchControls({
onSearchTextChange: (value: string) => void
onSortChange: (value: WorkspaceSort) => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [sortMenuOpen, setSortMenuOpen] = useState(false)
const sortMenuLabel = t(($) => $['mainNav.workspace.sort.openMenu'], {
ns: 'common',
@@ -152,7 +152,7 @@ export function WorkspaceSwitcher({
isPending,
onSwitchWorkspace,
}: WorkspaceSwitcherProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const workspaceListLabelId = useId()
const [workspaceSearchText, setWorkspaceSearchText] = useState('')
const [workspaceSort, setWorkspaceSort] = useState<WorkspaceSort>('lastOpened')
diff --git a/web/app/components/main-nav/index.tsx b/web/app/components/main-nav/index.tsx
index a3b7dfc7c70..39cdcb4fb8c 100644
--- a/web/app/components/main-nav/index.tsx
+++ b/web/app/components/main-nav/index.tsx
@@ -28,7 +28,7 @@ import { isMainNavRouteVisible, MAIN_NAV_ROUTES } from './routes'
const WebAppsSection = lazy(() => import('./components/web-apps-section'))
export function MainNav({ className, initialPlatform }: MainNavProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const pathname = usePathname()
const isCurrentWorkspaceDatasetOperator = useAtomValue(isCurrentWorkspaceDatasetOperatorAtom)
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
diff --git a/web/app/components/main-nav/layout.tsx b/web/app/components/main-nav/layout.tsx
index 676f4db4178..c7178924bea 100644
--- a/web/app/components/main-nav/layout.tsx
+++ b/web/app/components/main-nav/layout.tsx
@@ -41,7 +41,7 @@ function AppDetailStoreCleanup() {
}
const MainNavLayout = ({ children, detailSidebar, initialPlatform }: MainNavLayoutProps) => {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const pathname = usePathname()
const isCurrentWorkspaceDatasetOperator = useAtomValue(isCurrentWorkspaceDatasetOperatorAtom)
const useResponsiveNavigation = pathname === '/datasets/create'
diff --git a/web/app/components/main-nav/responsive-main-nav.tsx b/web/app/components/main-nav/responsive-main-nav.tsx
index 170d2efa6ab..d21a2d213f2 100644
--- a/web/app/components/main-nav/responsive-main-nav.tsx
+++ b/web/app/components/main-nav/responsive-main-nav.tsx
@@ -27,7 +27,7 @@ const getSnapshot = () => window.matchMedia(compactNavigationQuery).matches
const getServerSnapshot = () => false
export function ResponsiveMainNav({ initialPlatform }: Pick<MainNavProps, 'initialPlatform'>) {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const isCompact = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)
if (!isCompact) return <MainNav initialPlatform={initialPlatform} />
diff --git a/web/app/components/plugins/base/deprecation-notice.tsx b/web/app/components/plugins/base/deprecation-notice.tsx
index 4bebda2dae4..c003bd7e576 100644
--- a/web/app/components/plugins/base/deprecation-notice.tsx
+++ b/web/app/components/plugins/base/deprecation-notice.tsx
@@ -42,7 +42,7 @@ const DeprecationNotice: FC<DeprecationNoticeProps> = ({
iconWrapperClassName,
textClassName,
}) => {
- const { t } = useTranslation('plugin')
+ const { t } = useTranslation(['plugin'])
const deprecatedReasonKey = useMemo(() => {
if (!deprecatedReason) return null
diff --git a/web/app/components/plugins/base/key-value-item.tsx b/web/app/components/plugins/base/key-value-item.tsx
index 0c95c38b26f..7d2fc5b954b 100644
--- a/web/app/components/plugins/base/key-value-item.tsx
+++ b/web/app/components/plugins/base/key-value-item.tsx
@@ -21,7 +21,7 @@ function KeyValueItem({
maskedValue,
valueMaxWidthClassName = 'max-w-[162px]',
}: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [isCopied, setIsCopied] = useState(false)
const labelId = useId()
const handleCopy = useCallback(() => {
diff --git a/web/app/components/plugins/card/index.tsx b/web/app/components/plugins/card/index.tsx
index 8685e334fe5..f7fe76452bc 100644
--- a/web/app/components/plugins/card/index.tsx
+++ b/web/app/components/plugins/card/index.tsx
@@ -89,7 +89,7 @@ const Card = ({
variant = 'default',
}: Props) => {
const locale = useGetLanguage()
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const { categoriesMap } = useCategories(true)
const { category, type, name, org, label, brief, icon, icon_dark, verified, from } = payload
const badges = payload.badges ?? []
diff --git a/web/app/components/plugins/hooks.ts b/web/app/components/plugins/hooks.ts
index 102dc86172f..5a4bab315e0 100644
--- a/web/app/components/plugins/hooks.ts
+++ b/web/app/components/plugins/hooks.ts
@@ -13,7 +13,7 @@ export type Tag = {
}
export const useTags = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['pluginTags'])
const tags = useMemo(() => {
return tagKeys.map((tag) => {
@@ -54,7 +54,7 @@ type Category = {
}
export const useCategories = (isSingle?: boolean) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const categories = useMemo(() => {
return categoryKeys.map((category) => {
@@ -97,7 +97,7 @@ export const PLUGIN_PAGE_TABS_MAP = {
}
export const usePluginPageTabs = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const tabs = [
{ value: PLUGIN_PAGE_TABS_MAP.plugins, text: t(($) => $['menus.plugins'], { ns: 'common' }) },
{
diff --git a/web/app/components/plugins/install-plugin/base/installed.tsx b/web/app/components/plugins/install-plugin/base/installed.tsx
index 34f42fcf6db..421c2a2a981 100644
--- a/web/app/components/plugins/install-plugin/base/installed.tsx
+++ b/web/app/components/plugins/install-plugin/base/installed.tsx
@@ -67,7 +67,7 @@ const Installed: FC<Props> = ({
installContextCategory,
onCancel,
}) => {
- const { t } = useTranslation('plugin')
+ const { t } = useTranslation(['plugin', 'common'])
const installedCategory = payload?.category
const categoryTarget =
!isFailed && installContextCategory && installedCategory !== installContextCategory
diff --git a/web/app/components/plugins/install-plugin/base/loading-error.tsx b/web/app/components/plugins/install-plugin/base/loading-error.tsx
index 66cdd9c7a86..5d5b421b9ea 100644
--- a/web/app/components/plugins/install-plugin/base/loading-error.tsx
+++ b/web/app/components/plugins/install-plugin/base/loading-error.tsx
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next'
import { LoadingPlaceholder } from '@/app/components/plugins/card/base/placeholder'
const LoadingError: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
return (
<div className="flex items-center space-x-2">
<CheckboxSkeleton className="shrink-0" />
diff --git a/web/app/components/plugins/install-plugin/install-bundle/index.tsx b/web/app/components/plugins/install-plugin/install-bundle/index.tsx
index 027fcb42b56..0a59724c777 100644
--- a/web/app/components/plugins/install-plugin/install-bundle/index.tsx
+++ b/web/app/components/plugins/install-plugin/install-bundle/index.tsx
@@ -41,7 +41,7 @@ const InstallBundle: FC<Props> = ({
onClose,
onInstallComplete,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const [step, setStep] = useState<InstallStep>(
installType === InstallType.fromMarketplace
? InstallStep.readyToInstall
diff --git a/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx b/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx
index d998b98d4b0..69003bdd5e6 100644
--- a/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx
+++ b/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx
@@ -36,7 +36,7 @@ const Install: FC<Props> = ({
isFromMarketPlace,
isHideButton,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const [selectedPlugins, setSelectedPlugins] = React.useState<Plugin[]>([])
const [selectedIndexes, setSelectedIndexes] = React.useState<number[]>([])
const selectedPluginsNum = selectedPlugins.length
diff --git a/web/app/components/plugins/install-plugin/install-bundle/steps/installed.tsx b/web/app/components/plugins/install-plugin/install-bundle/steps/installed.tsx
index e121b0a84ad..8a87284a9a7 100644
--- a/web/app/components/plugins/install-plugin/install-bundle/steps/installed.tsx
+++ b/web/app/components/plugins/install-plugin/install-bundle/steps/installed.tsx
@@ -19,7 +19,7 @@ type Props = Readonly<{
}>
const Installed: FC<Props> = ({ list, installStatus, versionInfo, onCancel, isHideButton }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const { getIconUrl } = useGetIcon()
return (
<>
diff --git a/web/app/components/plugins/install-plugin/install-from-github/index.tsx b/web/app/components/plugins/install-plugin/install-from-github/index.tsx
index 89869b2304d..b11f0133300 100644
--- a/web/app/components/plugins/install-plugin/install-from-github/index.tsx
+++ b/web/app/components/plugins/install-plugin/install-from-github/index.tsx
@@ -43,7 +43,7 @@ const InstallFromGitHub: React.FC<InstallFromGitHubProps> = ({
onSuccess,
}) => {
const repoUrlInputRef = useRef<HTMLInputElement>(null)
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const { getIconUrl } = useGetIcon()
const { refreshPluginList } = useRefreshPluginList()
diff --git a/web/app/components/plugins/install-plugin/install-from-github/steps/loaded.tsx b/web/app/components/plugins/install-plugin/install-from-github/steps/loaded.tsx
index c0d281dc4f2..7754197264c 100644
--- a/web/app/components/plugins/install-plugin/install-from-github/steps/loaded.tsx
+++ b/web/app/components/plugins/install-plugin/install-from-github/steps/loaded.tsx
@@ -41,7 +41,7 @@ const Loaded: React.FC<LoadedProps> = ({
onInstalled,
onFailed,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const installButtonLabelId = React.useId()
const toInstallVersion = payload.version
const pluginId = (payload as Plugin).plugin_id
diff --git a/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx b/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx
index 690088bc7d6..2abc2e475c3 100644
--- a/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx
+++ b/web/app/components/plugins/install-plugin/install-from-github/steps/selectPackage.tsx
@@ -51,7 +51,7 @@ const SelectPackage: React.FC<SelectPackageProps> = ({
onFailed,
onBack,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const isEdit = Boolean(updatePayload)
const [isUploading, setIsUploading] = React.useState(false)
const selectedVersionOption = versions.find((item) => item.value === selectedVersion) ?? null
diff --git a/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx b/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx
index 4c48e75c7c0..229b962c496 100644
--- a/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx
+++ b/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx
@@ -27,7 +27,7 @@ const InstallFromLocalPackage: React.FC<InstallFromLocalPackageProps> = ({
installContextCategory,
onClose,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
// uploading -> !uploadFailed -> readyToInstall -> installed/failed
const [step, setStep] = useState<InstallStep>(InstallStep.uploading)
const [uniqueIdentifier, setUniqueIdentifier] = useState<string | null>(null)
diff --git a/web/app/components/plugins/install-plugin/install-from-local-package/steps/install.tsx b/web/app/components/plugins/install-plugin/install-from-local-package/steps/install.tsx
index cc2dd883f87..8daaa6bb66c 100644
--- a/web/app/components/plugins/install-plugin/install-from-local-package/steps/install.tsx
+++ b/web/app/components/plugins/install-plugin/install-from-local-package/steps/install.tsx
@@ -37,7 +37,7 @@ const Installed: FC<Props> = ({
onInstalled,
onFailed,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const toInstallVersion = payload.version
const pluginId = `${payload.author}/${payload.name}`
const { installedInfo, isLoading } = useCheckInstalled({
diff --git a/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx b/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx
index f4a4462baa8..fca205a5e2c 100644
--- a/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx
+++ b/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx
@@ -57,7 +57,7 @@ const Uploading: FC<Props> = ({
onBundleUploaded,
onFailed,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const fileName = file.name
const handleUploadedResponse = React.useCallback(
(response: unknown) => {
diff --git a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx
index c275aa7b765..1c99cc61673 100644
--- a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx
+++ b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx
@@ -34,7 +34,7 @@ const InstallFromMarketplace: React.FC<InstallFromMarketplaceProps> = ({
onSuccess,
onClose,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
// readyToInstall -> check installed -> installed/failed
const [step, setStep] = useState<InstallStep>(InstallStep.readyToInstall)
const [errorMsg, setErrorMsg] = useState<string | null>(null)
diff --git a/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx b/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx
index d049e708b33..cbc2eb4f6c8 100644
--- a/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx
+++ b/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx
@@ -45,7 +45,7 @@ const Installed: FC<Props> = ({
onInstalled,
onFailed,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const toInstallVersion = payload.version || payload.latest_version
const pluginId = (payload as Plugin).plugin_id
const { installedInfo, isLoading } = useCheckInstalled({
diff --git a/web/app/components/plugins/marketplace/creator-profile/creation-card.tsx b/web/app/components/plugins/marketplace/creator-profile/creation-card.tsx
index 647389565bf..73bb24a78b8 100644
--- a/web/app/components/plugins/marketplace/creator-profile/creation-card.tsx
+++ b/web/app/components/plugins/marketplace/creator-profile/creation-card.tsx
@@ -18,7 +18,7 @@ const cardClassName =
'group relative flex h-[152px] min-w-0 w-full flex-col overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg pb-3 text-left shadow-xs outline-hidden transition-shadow hover:bg-components-panel-on-panel-item-bg-hover hover:shadow-md focus-visible:ring-2 focus-visible:ring-state-accent-solid'
function CreationCardContent({ creation }: { creation: CreatorCreation }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const visibleDependencies = creation.dependencyIcons.slice(0, MAX_VISIBLE_DEPENDENCIES)
const remainingDependencies = Math.max(0, creation.dependencyCount - visibleDependencies.length)
diff --git a/web/app/components/plugins/marketplace/creator-profile/creator-content.tsx b/web/app/components/plugins/marketplace/creator-profile/creator-content.tsx
index bc3a890fad2..9601f1596c8 100644
--- a/web/app/components/plugins/marketplace/creator-profile/creator-content.tsx
+++ b/web/app/components/plugins/marketplace/creator-profile/creator-content.tsx
@@ -57,7 +57,7 @@ export default function CreatorContent({
locale = 'en-US',
onRecordsLoaded,
}: CreatorContentProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const [sort, setSort] = useQueryStates(creatorSortSearchParsers, sortSearchOptions)
const sortField = sort.sort_by
const sortOrder = sort.sort_order
diff --git a/web/app/components/plugins/marketplace/creator-profile/creator-sidebar.tsx b/web/app/components/plugins/marketplace/creator-profile/creator-sidebar.tsx
index 9167d6dbebc..986b7609c68 100644
--- a/web/app/components/plugins/marketplace/creator-profile/creator-sidebar.tsx
+++ b/web/app/components/plugins/marketplace/creator-profile/creator-sidebar.tsx
@@ -27,7 +27,7 @@ function SocialIcon({ platform }: { platform: CreatorSocialPlatform }) {
}
export default function CreatorSidebar({ profile }: CreatorSidebarProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const isOrganization = profile.kind === 'organization'
const isPartner = profile.badges.includes('partner')
const isVerified = profile.badges.includes('verified')
diff --git a/web/app/components/plugins/marketplace/creator-profile/header.tsx b/web/app/components/plugins/marketplace/creator-profile/header.tsx
index 027331dac41..6bd44f6ed5a 100644
--- a/web/app/components/plugins/marketplace/creator-profile/header.tsx
+++ b/web/app/components/plugins/marketplace/creator-profile/header.tsx
@@ -20,7 +20,7 @@ export default function CreatorProfileHeader({
locale,
onSuggestionSelect,
}: CreatorProfileHeaderProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const [searchValue, setSearchValue] = useState('')
return (
diff --git a/web/app/components/plugins/marketplace/creator-profile/view.tsx b/web/app/components/plugins/marketplace/creator-profile/view.tsx
index 1df52782886..38b20d266ce 100644
--- a/web/app/components/plugins/marketplace/creator-profile/view.tsx
+++ b/web/app/components/plugins/marketplace/creator-profile/view.tsx
@@ -49,7 +49,7 @@ export default function CreatorProfileView({
locale,
onRecordsLoaded,
}: CreatorProfileViewProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
return (
<div className="flex min-h-full shrink-0 flex-col bg-background-default">
diff --git a/web/app/components/plugins/marketplace/description/index.tsx b/web/app/components/plugins/marketplace/description/index.tsx
index fc484f4313e..edf764a5f19 100644
--- a/web/app/components/plugins/marketplace/description/index.tsx
+++ b/web/app/components/plugins/marketplace/description/index.tsx
@@ -30,8 +30,8 @@ const Description = ({
marketplaceNav,
scrollContainerId = MARKETPLACE_CONTAINER_ID,
}: DescriptionProps) => {
- const { t } = useTranslation('plugin')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['plugin'])
+ const { t: tCommon } = useTranslation(['common'])
const locale = useLocale()
const isZhHans = locale === 'zh-Hans'
const rafRef = useRef<number | null>(null)
diff --git a/web/app/components/plugins/marketplace/detail-dialog/frame.tsx b/web/app/components/plugins/marketplace/detail-dialog/frame.tsx
index afd671364eb..26a6b2e0fef 100644
--- a/web/app/components/plugins/marketplace/detail-dialog/frame.tsx
+++ b/web/app/components/plugins/marketplace/detail-dialog/frame.tsx
@@ -36,7 +36,7 @@ export default function MarketplaceDetailDialogFrame({
onMessage,
onOpenChange,
}: MarketplaceDetailDialogFrameProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const iframeRef = useRef<HTMLIFrameElement>(null)
const closeButtonRef = useRef<HTMLButtonElement>(null)
const [isLoading, setIsLoading] = useState(true)
diff --git a/web/app/components/plugins/marketplace/detail-dialog/index.tsx b/web/app/components/plugins/marketplace/detail-dialog/index.tsx
index 79462b365c8..fa9976d5711 100644
--- a/web/app/components/plugins/marketplace/detail-dialog/index.tsx
+++ b/web/app/components/plugins/marketplace/detail-dialog/index.tsx
@@ -117,7 +117,7 @@ function MarketplaceDetailDialog({
plugin,
onOpenChange,
}: MarketplaceDetailDialogProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const locale = useLocale()
const { canInstallPlugin } = useOptionalPluginInstallPermission()
// resolvedTheme maps the "system" preference to the concrete light/dark
diff --git a/web/app/components/plugins/marketplace/empty/index.tsx b/web/app/components/plugins/marketplace/empty/index.tsx
index 2e8b4bec4e2..782db678650 100644
--- a/web/app/components/plugins/marketplace/empty/index.tsx
+++ b/web/app/components/plugins/marketplace/empty/index.tsx
@@ -10,7 +10,7 @@ type Props = Readonly<{
}>
const Empty = ({ text, lightCard, className }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
return (
<div className={cn('relative flex h-0 grow flex-wrap overflow-hidden p-2', className)}>
diff --git a/web/app/components/plugins/marketplace/home/__tests__/home-guide.spec.tsx b/web/app/components/plugins/marketplace/home/__tests__/home-guide.spec.tsx
index a5593bae957..a54e789e394 100644
--- a/web/app/components/plugins/marketplace/home/__tests__/home-guide.spec.tsx
+++ b/web/app/components/plugins/marketplace/home/__tests__/home-guide.spec.tsx
@@ -12,6 +12,7 @@ const mocks = vi.hoisted(() => ({
vi.mock('#i18n', async () => {
const { withSelectorKey } = await import('@/test/i18n-mock')
return {
+ useLocale: () => 'en-US',
useTranslation: () => ({
i18n: {
language: 'en-US',
diff --git a/web/app/components/plugins/marketplace/home/__tests__/home-header.spec.tsx b/web/app/components/plugins/marketplace/home/__tests__/home-header.spec.tsx
index d35bde9ac12..fe5763ba9e5 100644
--- a/web/app/components/plugins/marketplace/home/__tests__/home-header.spec.tsx
+++ b/web/app/components/plugins/marketplace/home/__tests__/home-header.spec.tsx
@@ -9,6 +9,7 @@ const mocks = vi.hoisted(() => ({
vi.mock('#i18n', async () => {
const { withSelectorKey } = await import('@/test/i18n-mock')
return {
+ useLocale: () => 'en-US',
useTranslation: () => ({
i18n: {
language: 'en-US',
diff --git a/web/app/components/plugins/marketplace/home/catalog-languages-filter.tsx b/web/app/components/plugins/marketplace/home/catalog-languages-filter.tsx
index 8db0c496593..3e6f3e38041 100644
--- a/web/app/components/plugins/marketplace/home/catalog-languages-filter.tsx
+++ b/web/app/components/plugins/marketplace/home/catalog-languages-filter.tsx
@@ -14,7 +14,7 @@ import { useFilterTemplateLanguages } from '../atoms'
import { LANGUAGE_OPTIONS } from '../templates/template-language'
export default function CatalogLanguagesFilter() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const [languages, setLanguages] = useFilterTemplateLanguages()
const [searchText, setSearchText] = useState('')
const triggerRef = useRef<HTMLButtonElement>(null)
diff --git a/web/app/components/plugins/marketplace/home/embedded-marketplace-search.tsx b/web/app/components/plugins/marketplace/home/embedded-marketplace-search.tsx
index e94ae93cdca..8eb5fd76c00 100644
--- a/web/app/components/plugins/marketplace/home/embedded-marketplace-search.tsx
+++ b/web/app/components/plugins/marketplace/home/embedded-marketplace-search.tsx
@@ -26,7 +26,7 @@ const normalizePlugin = (plugin: Plugin): Plugin => ({
})
export default function EmbeddedMarketplaceSearch() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const locale = useLocale()
const router = useRouter()
const navigation = useMarketplaceDetailNavigation()
diff --git a/web/app/components/plugins/marketplace/home/home-catalog-navigation.tsx b/web/app/components/plugins/marketplace/home/home-catalog-navigation.tsx
index 46aa76f66fe..aa45f406a99 100644
--- a/web/app/components/plugins/marketplace/home/home-catalog-navigation.tsx
+++ b/web/app/components/plugins/marketplace/home/home-catalog-navigation.tsx
@@ -27,7 +27,7 @@ function HomeCatalogNavigation({
catalogTrailing,
isMarketplacePlatform,
}: HomeCatalogNavigationProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const isPinned = useAtomValue(homeCatalogPinnedAtom)
const setIsPinned = useSetAtom(homeCatalogPinnedAtom)
const isPinnedRef = useRef(isPinned)
diff --git a/web/app/components/plugins/marketplace/home/home-catalog-tabs.tsx b/web/app/components/plugins/marketplace/home/home-catalog-tabs.tsx
index 30dcbc41106..54bc9752a88 100644
--- a/web/app/components/plugins/marketplace/home/home-catalog-tabs.tsx
+++ b/web/app/components/plugins/marketplace/home/home-catalog-tabs.tsx
@@ -20,7 +20,8 @@ const HomeCatalogTabs = ({
labels,
language,
}: HomeCatalogTabsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
+ const { t: tPlugin } = useTranslation(['plugin'])
const catalogParams = language ? { language } : undefined
const getRelativeCatalogHref = (path: string) => {
const searchParams = new URLSearchParams(catalogParams)
@@ -33,9 +34,10 @@ const HomeCatalogTabs = ({
const templatesHref = getRelativeCatalogHref('/templates')
const isPluginsActive = activeTab === 'plugins'
const isTemplatesActive = activeTab === 'templates'
- const pluginsLabel = labels?.plugins ?? t(($) => $['marketplace.home.plugins'], { ns: 'plugin' })
+ const pluginsLabel =
+ labels?.plugins ?? tPlugin(($) => $['marketplace.home.plugins'], { ns: 'plugin' })
const templatesLabel =
- labels?.templates ?? t(($) => $['marketplace.home.templates'], { ns: 'plugin' })
+ labels?.templates ?? tPlugin(($) => $['marketplace.home.templates'], { ns: 'plugin' })
return (
<nav
diff --git a/web/app/components/plugins/marketplace/home/home-creator-center.tsx b/web/app/components/plugins/marketplace/home/home-creator-center.tsx
index 954ca24453b..b61ef3ff9f7 100644
--- a/web/app/components/plugins/marketplace/home/home-creator-center.tsx
+++ b/web/app/components/plugins/marketplace/home/home-creator-center.tsx
@@ -9,7 +9,7 @@ import { trackMarketplaceSiteEvent } from '@/utils/marketplace-site-track'
import { useCreatorCenterUrl } from '../creator-center-url'
export default function HomeCreatorCenter() {
- const { t } = useTranslation('plugin')
+ const { t } = useTranslation(['plugin'])
const creatorCenterUrl = useCreatorCenterUrl(MARKETPLACE_URL_PREFIX)
const label = t(($) => $['marketplace.home.creatorCenter'])
diff --git a/web/app/components/plugins/marketplace/home/home-guide.tsx b/web/app/components/plugins/marketplace/home/home-guide.tsx
index 950a56e3a59..c3225f72816 100644
--- a/web/app/components/plugins/marketplace/home/home-guide.tsx
+++ b/web/app/components/plugins/marketplace/home/home-guide.tsx
@@ -1,7 +1,7 @@
'use client'
import type { DocPathWithoutLang } from '@/types/doc-paths'
-import { useTranslation } from '#i18n'
+import { useLocale } from '#i18n'
import {
SubmitRequestDropdown,
SubmitRequestDropdownMenu,
@@ -10,8 +10,8 @@ import { defaultDocBaseUrl } from '@/context/i18n'
import { getDocLanguage } from '@/i18n/language'
function MarketplaceGuide() {
- const { i18n } = useTranslation()
- const docLanguage = getDocLanguage(i18n.language)
+ const locale = useLocale()
+ const docLanguage = getDocLanguage(locale)
const docLink = (path: DocPathWithoutLang) => `${defaultDocBaseUrl}/${docLanguage}${path}`
return <SubmitRequestDropdownMenu dividerAfterFirst docLink={docLink} />
diff --git a/web/app/components/plugins/marketplace/home/home-hero.tsx b/web/app/components/plugins/marketplace/home/home-hero.tsx
index 3b685c340ba..3d97e209ed9 100644
--- a/web/app/components/plugins/marketplace/home/home-hero.tsx
+++ b/web/app/components/plugins/marketplace/home/home-hero.tsx
@@ -65,7 +65,7 @@ const HeroDecorations = () => (
)
const HomeHero = ({ isMarketplacePlatform, subtitle, title }: HomeHeroProps) => {
- const { t } = useTranslation('plugin')
+ const { t } = useTranslation(['plugin'])
return (
<section
diff --git a/web/app/components/plugins/marketplace/home/home-trending-navigation.tsx b/web/app/components/plugins/marketplace/home/home-trending-navigation.tsx
index 0118d6247df..1e9ad0986f3 100644
--- a/web/app/components/plugins/marketplace/home/home-trending-navigation.tsx
+++ b/web/app/components/plugins/marketplace/home/home-trending-navigation.tsx
@@ -47,7 +47,7 @@ function TrendingNavigation({
onNext: () => void
onPausedChange?: (paused: boolean) => void
}) {
- const { t } = useTranslation('plugin')
+ const { t } = useTranslation(['plugin'])
const progressRef = useRef<HTMLSpanElement>(null)
const progressAnimationRef = useRef<Animation | null>(null)
const pauseReasonsRef = useRefWithInit(
diff --git a/web/app/components/plugins/marketplace/home/home-trending-slides.tsx b/web/app/components/plugins/marketplace/home/home-trending-slides.tsx
index 39142cc6cf4..f7bae91431e 100644
--- a/web/app/components/plugins/marketplace/home/home-trending-slides.tsx
+++ b/web/app/components/plugins/marketplace/home/home-trending-slides.tsx
@@ -207,7 +207,7 @@ function TrendingCopy({
banner: BannerRecommend
isMarketplacePlatform: boolean
}) {
- const { t } = useTranslation('plugin')
+ const { t } = useTranslation(['plugin'])
const heading = banner.content.heading || t(($) => $['marketplace.home.trendingTitle'])
const description =
banner.content.description ||
@@ -266,7 +266,7 @@ function trackRecommendCardClick(
}
function RecommendCardFace({ card }: { card: BannerRecommendCard }) {
- const { t } = useTranslation('plugin')
+ const { t } = useTranslation(['plugin'])
const iconURL = getMarketplaceAssetURL(card.icon_url)
const creator = getCardCreator(card)
const isPartner = card.badges?.includes('partner')
@@ -603,7 +603,7 @@ function BlogBannerSlide({
isMarketplacePlatform: boolean
page: MarketplaceBannerPage
}) {
- const { t } = useTranslation('plugin')
+ const { t } = useTranslation(['plugin'])
const href = sanitizeMarketplaceHref(banner.content.link)
if (!href) return null
const opensInNewTab = /^https?:\/\//.test(href)
diff --git a/web/app/components/plugins/marketplace/home/home-trending.tsx b/web/app/components/plugins/marketplace/home/home-trending.tsx
index 5ea89ce5aaa..68a03da4b7f 100644
--- a/web/app/components/plugins/marketplace/home/home-trending.tsx
+++ b/web/app/components/plugins/marketplace/home/home-trending.tsx
@@ -92,7 +92,7 @@ function HomeTrending({
isMarketplacePlatform: boolean
page: MarketplaceBannerPage
}) {
- const { t } = useTranslation('plugin')
+ const { t } = useTranslation(['plugin'])
const carouselRootRef = useRef<HTMLDivElement>(null)
const swipeGestureRef = useRef<SwipeGesture | null>(null)
const suppressClickRef = useRef(false)
diff --git a/web/app/components/plugins/marketplace/home/marketplace-search-autocomplete.tsx b/web/app/components/plugins/marketplace/home/marketplace-search-autocomplete.tsx
index 2f12ed87c2a..0ddb76d5f26 100644
--- a/web/app/components/plugins/marketplace/home/marketplace-search-autocomplete.tsx
+++ b/web/app/components/plugins/marketplace/home/marketplace-search-autocomplete.tsx
@@ -181,7 +181,9 @@ export function MarketplaceSearchAutocomplete({
scope,
value,
}: MarketplaceSearchAutocompleteProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
+ const { t: tCommon } = useTranslation(['common'])
+ const { t: tPlugin } = useTranslation(['plugin'])
const [isOpen, setIsOpen] = useState(false)
const searchRootRef = useRef<HTMLDivElement>(null)
const resultsPanelRef = useRef<HTMLDivElement>(null)
@@ -271,7 +273,7 @@ export function MarketplaceSearchAutocomplete({
{
id: 'template' as const,
items: templateSuggestions,
- label: t(($) => $['marketplace.home.templates'], { ns: 'plugin' }),
+ label: tPlugin(($) => $['marketplace.home.templates'], { ns: 'plugin' }),
},
]
: []),
@@ -280,7 +282,7 @@ export function MarketplaceSearchAutocomplete({
{
id: 'plugin' as const,
items: pluginSuggestions,
- label: t(($) => $['marketplace.home.plugins'], { ns: 'plugin' }),
+ label: tPlugin(($) => $['marketplace.home.plugins'], { ns: 'plugin' }),
},
]
: []),
@@ -297,10 +299,10 @@ export function MarketplaceSearchAutocomplete({
suggestions.length === 0 &&
((searchesPlugins && pluginQuery.isError) || (searchesTemplates && templateQuery.isError))
const emptyText = hasLoadError
- ? t(($) => $['marketplace.loadError'], { ns: 'plugin' })
+ ? tPlugin(($) => $['marketplace.loadError'], { ns: 'plugin' })
: scope === 'templates'
? t(($) => $['newApp.noTemplateFound'], { ns: 'app' })
- : t(($) => $['marketplace.noPluginFound'], { ns: 'plugin' })
+ : tPlugin(($) => $['marketplace.noPluginFound'], { ns: 'plugin' })
useEffect(() => {
if (!isPopupOpen) return
@@ -359,7 +361,7 @@ export function MarketplaceSearchAutocomplete({
/>
{!!value && (
<AutocompleteClear
- aria-label={t(($) => $.clearSearch, { ns: 'plugin', label: placeholder })}
+ aria-label={tPlugin(($) => $.clearSearch, { ns: 'plugin', label: placeholder })}
size="large"
/>
)}
@@ -376,7 +378,7 @@ export function MarketplaceSearchAutocomplete({
{!isSearching && suggestions.length === 0 ? emptyText : null}
</AutocompleteEmpty>
<AutocompleteStatus className="empty:h-0 empty:p-0">
- {isSearching ? t(($) => $.loading, { ns: 'common' }) : null}
+ {isSearching ? tCommon(($) => $.loading, { ns: 'common' }) : null}
</AutocompleteStatus>
</div>
</AutocompletePositioner>
diff --git a/web/app/components/plugins/marketplace/list/card-wrapper.tsx b/web/app/components/plugins/marketplace/list/card-wrapper.tsx
index 102a25fe3ee..800530391bc 100644
--- a/web/app/components/plugins/marketplace/list/card-wrapper.tsx
+++ b/web/app/components/plugins/marketplace/list/card-wrapper.tsx
@@ -33,7 +33,7 @@ const CardWrapperContent = ({
section = 'list',
externalDetailHref,
}: CardWrapperProps & { externalDetailHref?: string }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const locale = useGetLanguage()
const [
isShowInstallFromMarketplace,
diff --git a/web/app/components/plugins/marketplace/list/carousel.tsx b/web/app/components/plugins/marketplace/list/carousel.tsx
index f0ca9711fec..3c9380bc53e 100644
--- a/web/app/components/plugins/marketplace/list/carousel.tsx
+++ b/web/app/components/plugins/marketplace/list/carousel.tsx
@@ -70,7 +70,7 @@ const CarouselControls = ({
scrollSnaps,
scrollTo,
}: CarouselControlsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const paginationItems = scrollSnaps.map((snap, index) => ({
id: `${snap}-${index}`,
snap,
diff --git a/web/app/components/plugins/marketplace/list/list-with-collection.tsx b/web/app/components/plugins/marketplace/list/list-with-collection.tsx
index 09588c55751..3ab83830767 100644
--- a/web/app/components/plugins/marketplace/list/list-with-collection.tsx
+++ b/web/app/components/plugins/marketplace/list/list-with-collection.tsx
@@ -108,7 +108,7 @@ const CollectionSection = ({
installedPluginIds,
deferMount,
}: CollectionSectionProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const locale = useLocale()
const collectionLabelId = useId()
const sectionRef = useRef<HTMLDivElement>(null)
diff --git a/web/app/components/plugins/marketplace/list/list-wrapper.tsx b/web/app/components/plugins/marketplace/list/list-wrapper.tsx
index 3945dfd22e0..ea96f0235df 100644
--- a/web/app/components/plugins/marketplace/list/list-wrapper.tsx
+++ b/web/app/components/plugins/marketplace/list/list-wrapper.tsx
@@ -29,7 +29,8 @@ const ListWrapper = ({
showInstallButton,
linkToMarketplaceDetail,
}: ListWrapperProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
+ const { t: tPlugin } = useTranslation(['plugin'])
const {
plugins,
@@ -86,16 +87,16 @@ const ListWrapper = ({
{isLoading || isRefreshing || isFetchingNextPage
? t(($) => $.loading, { ns: 'common' })
: isError
- ? t(($) => $['marketplace.loadError'], { ns: 'plugin' })
+ ? tPlugin(($) => $['marketplace.loadError'], { ns: 'plugin' })
: plugins
- ? t(($) => $['marketplace.pluginsResult'], { ns: 'plugin', num: pluginsTotal })
+ ? tPlugin(($) => $['marketplace.pluginsResult'], { ns: 'plugin', num: pluginsTotal })
: null}
</div>
<div className="flex w-full grow flex-col">
{plugins && (
<div className="mb-4 flex items-center pt-3">
<div className="title-xl-semi-bold text-text-primary">
- {t(($) => $['marketplace.pluginsResult'], { ns: 'plugin', num: pluginsTotal })}
+ {tPlugin(($) => $['marketplace.pluginsResult'], { ns: 'plugin', num: pluginsTotal })}
</div>
<div className="mx-3 h-3.5 w-px bg-divider-regular"></div>
<SortDropdown />
@@ -103,7 +104,7 @@ const ListWrapper = ({
)}
{isError && !plugins?.length ? (
<div className="flex min-h-60 flex-col items-center justify-center gap-3 text-sm text-text-tertiary">
- <span>{t(($) => $['marketplace.loadError'], { ns: 'plugin' })}</span>
+ <span>{tPlugin(($) => $['marketplace.loadError'], { ns: 'plugin' })}</span>
<Button size="small" variant="secondary" onClick={() => void refetch()}>
{t(($) => $['operation.retry'], { ns: 'common' })}
</Button>
diff --git a/web/app/components/plugins/marketplace/plugin-type-switch.tsx b/web/app/components/plugins/marketplace/plugin-type-switch.tsx
index 91a2dcc163b..e611b096a7f 100644
--- a/web/app/components/plugins/marketplace/plugin-type-switch.tsx
+++ b/web/app/components/plugins/marketplace/plugin-type-switch.tsx
@@ -14,7 +14,7 @@ type PluginTypeSwitchProps = {
variant?: 'default' | 'hero' | 'home'
}
const PluginTypeSwitch = ({ className, variant = 'default' }: PluginTypeSwitchProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const [activePluginType, handleActivePluginTypeChange] = useActivePluginType()
const setSearchMode = useSetAtom(searchModeAtom)
const isHero = variant === 'hero'
diff --git a/web/app/components/plugins/marketplace/search-box/index.tsx b/web/app/components/plugins/marketplace/search-box/index.tsx
index c0d9b33dc15..6487ac2e16d 100644
--- a/web/app/components/plugins/marketplace/search-box/index.tsx
+++ b/web/app/components/plugins/marketplace/search-box/index.tsx
@@ -43,7 +43,7 @@ function SearchBox({
autoFocus = false,
showTags = true,
}: SearchBoxProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin', 'tools'])
const accessibleLabel = placeholder || t(($) => $.searchTools, { ns: 'plugin' })!
const inputRef = useRef<HTMLInputElement>(null)
useImperativeHandle(ref, () => inputRef.current as HTMLInputElement, [])
diff --git a/web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx b/web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx
index 31ed25cfdd0..4d27c3aa78b 100644
--- a/web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx
+++ b/web/app/components/plugins/marketplace/search-box/search-box-wrapper.tsx
@@ -25,7 +25,7 @@ const SearchBoxWrapper = ({
showTags = true,
usedInMarketplace = true,
}: SearchBoxWrapperProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const [searchPluginText, handleSearchPluginTextChange] = useSearchPluginText()
const [filterPluginTags, handleFilterPluginTagsChange] = useFilterPluginTags()
diff --git a/web/app/components/plugins/marketplace/search-box/tags-filter.tsx b/web/app/components/plugins/marketplace/search-box/tags-filter.tsx
index 011fc405b6b..85b02bc8fa3 100644
--- a/web/app/components/plugins/marketplace/search-box/tags-filter.tsx
+++ b/web/app/components/plugins/marketplace/search-box/tags-filter.tsx
@@ -17,7 +17,7 @@ type TagsFilterProps = {
usedInMarketplace?: boolean
}
function TagsFilter({ tags, onTagsChange, usedInMarketplace = false }: TagsFilterProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['pluginTags'])
const [searchText, setSearchText] = useState('')
const { tags: options, tagsMap } = useTags()
const filteredOptions = options.filter((option) =>
diff --git a/web/app/components/plugins/marketplace/search-box/trigger/marketplace.tsx b/web/app/components/plugins/marketplace/search-box/trigger/marketplace.tsx
index 2762a969544..3cc82adbaf4 100644
--- a/web/app/components/plugins/marketplace/search-box/trigger/marketplace.tsx
+++ b/web/app/components/plugins/marketplace/search-box/trigger/marketplace.tsx
@@ -19,7 +19,7 @@ function MarketplaceTrigger({
tagsMap,
onTagsChange,
}: MarketplaceTriggerProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['pluginTags'])
const triggerRef = useRef<HTMLButtonElement>(null)
const shouldRestoreFocusRef = useRef(false)
const selectedTagLabels = tags.map((tag) => tagsMap[tag]?.label).filter(Boolean)
diff --git a/web/app/components/plugins/marketplace/search-box/trigger/tool-selector.tsx b/web/app/components/plugins/marketplace/search-box/trigger/tool-selector.tsx
index 31b68c09741..070058af986 100644
--- a/web/app/components/plugins/marketplace/search-box/trigger/tool-selector.tsx
+++ b/web/app/components/plugins/marketplace/search-box/trigger/tool-selector.tsx
@@ -19,7 +19,7 @@ function ToolSelectorTrigger({
tagsMap,
onTagsChange,
}: ToolSelectorTriggerProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['pluginTags'])
const triggerRef = useRef<HTMLButtonElement>(null)
const shouldRestoreFocusRef = useRef(false)
const selectedTagLabels = tags.map((tag) => tagsMap[tag]?.label).filter(Boolean)
diff --git a/web/app/components/plugins/marketplace/sort-dropdown/index.tsx b/web/app/components/plugins/marketplace/sort-dropdown/index.tsx
index 52c4f0c6e9b..e44e5b013e5 100644
--- a/web/app/components/plugins/marketplace/sort-dropdown/index.tsx
+++ b/web/app/components/plugins/marketplace/sort-dropdown/index.tsx
@@ -10,7 +10,7 @@ import { useTranslation } from '#i18n'
import { useMarketplaceSort } from '../atoms'
const SortDropdown = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const options = [
{
value: 'install_count',
diff --git a/web/app/components/plugins/marketplace/templates/template-detail-dialog.tsx b/web/app/components/plugins/marketplace/templates/template-detail-dialog.tsx
index 1e230705e9e..c0d118f08bb 100644
--- a/web/app/components/plugins/marketplace/templates/template-detail-dialog.tsx
+++ b/web/app/components/plugins/marketplace/templates/template-detail-dialog.tsx
@@ -22,7 +22,7 @@ export default function TemplateDetailDialog({
onInstall,
onOpenChange,
}: TemplateDetailDialogProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const locale = useLocale()
// resolvedTheme maps the "system" preference to the concrete light/dark
// value the marketplace page expects.
diff --git a/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx b/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx
index 737df3301ff..5a7d1acd5de 100644
--- a/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx
+++ b/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx
@@ -59,7 +59,7 @@ const AddOAuthButton = ({
renderTrigger,
oAuthData,
}: AddOAuthButtonProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const renderI18nObject = useRenderI18nObject()
const [isOAuthSettingsOpen, setIsOAuthSettingsOpen] = useState(false)
const [isOAuthSettingsMounted, setIsOAuthSettingsMounted] = useState(false)
diff --git a/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx b/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx
index a88e48fdfaf..5d604174762 100644
--- a/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx
+++ b/web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx
@@ -43,7 +43,7 @@ const ApiKeyModal = ({
onUpdate,
formSchemas: formSchemasFromProps = [],
}: ApiKeyModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const [doingAction, setDoingAction] = useState(false)
const doingActionRef = useRef(doingAction)
const handleSetDoingAction = useCallback((value: boolean) => {
diff --git a/web/app/components/plugins/plugin-auth/authorize/index.tsx b/web/app/components/plugins/plugin-auth/authorize/index.tsx
index b0da11c70da..f390411c8c2 100644
--- a/web/app/components/plugins/plugin-auth/authorize/index.tsx
+++ b/web/app/components/plugins/plugin-auth/authorize/index.tsx
@@ -35,7 +35,7 @@ const Authorize = ({
notAllowCustomCredential,
onApiKeyClick,
}: AuthorizeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const { canCreateCredential } = useCredentialPermissions()
const oAuthButtonProps: AddOAuthButtonProps = useMemo(() => {
diff --git a/web/app/components/plugins/plugin-auth/authorize/oauth-client-settings.tsx b/web/app/components/plugins/plugin-auth/authorize/oauth-client-settings.tsx
index 6296cec2202..3124c189a27 100644
--- a/web/app/components/plugins/plugin-auth/authorize/oauth-client-settings.tsx
+++ b/web/app/components/plugins/plugin-auth/authorize/oauth-client-settings.tsx
@@ -39,7 +39,7 @@ const OAuthClientSettings = ({
hasOriginalClientParams,
onUpdate,
}: OAuthClientSettingsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const [doingAction, setDoingAction] = useState(false)
const doingActionRef = useRef(doingAction)
const handleSetDoingAction = useCallback((value: boolean) => {
diff --git a/web/app/components/plugins/plugin-auth/authorize/oauth-visibility-dialog.tsx b/web/app/components/plugins/plugin-auth/authorize/oauth-visibility-dialog.tsx
index 1c7364d656d..eaeddd93b69 100644
--- a/web/app/components/plugins/plugin-auth/authorize/oauth-visibility-dialog.tsx
+++ b/web/app/components/plugins/plugin-auth/authorize/oauth-visibility-dialog.tsx
@@ -29,7 +29,7 @@ const OAuthVisibilityDialog = ({
onConfirm,
loading = false,
}: OAuthVisibilityDialogProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const handleOpenChange = (nextOpen: boolean) => {
if (loading && !nextOpen) return
onOpenChange(nextOpen)
diff --git a/web/app/components/plugins/plugin-auth/authorize/permission-selector.tsx b/web/app/components/plugins/plugin-auth/authorize/permission-selector.tsx
index 0e5b636d59f..239461998f9 100644
--- a/web/app/components/plugins/plugin-auth/authorize/permission-selector.tsx
+++ b/web/app/components/plugins/plugin-auth/authorize/permission-selector.tsx
@@ -21,7 +21,7 @@ type PermissionSelectorProps = {
}
const PermissionSelector = ({ disabled, permission, onChange }: PermissionSelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetSettings', 'plugin'])
const { data: userProfile } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile,
diff --git a/web/app/components/plugins/plugin-auth/authorized-in-data-source-node.tsx b/web/app/components/plugins/plugin-auth/authorized-in-data-source-node.tsx
index 913ff1c11e3..56734c5c85c 100644
--- a/web/app/components/plugins/plugin-auth/authorized-in-data-source-node.tsx
+++ b/web/app/components/plugins/plugin-auth/authorized-in-data-source-node.tsx
@@ -13,7 +13,7 @@ const AuthorizedInDataSourceNode = ({
authorizationsNum,
onJumpToDataSourcePage,
}: AuthorizedInDataSourceNodeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
return (
<Button size="small" onClick={onJumpToDataSourcePage}>
diff --git a/web/app/components/plugins/plugin-auth/authorized-in-node.tsx b/web/app/components/plugins/plugin-auth/authorized-in-node.tsx
index 7f0f084ab29..3630e86a1c1 100644
--- a/web/app/components/plugins/plugin-auth/authorized-in-node.tsx
+++ b/web/app/components/plugins/plugin-auth/authorized-in-node.tsx
@@ -20,7 +20,7 @@ const AuthorizedInNode = ({
credentialId,
onDefaultCredentialChange,
}: AuthorizedInNodeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const [isOpen, setIsOpen] = useState(false)
const {
canApiKey,
diff --git a/web/app/components/plugins/plugin-auth/authorized/index.tsx b/web/app/components/plugins/plugin-auth/authorized/index.tsx
index 9c2325c9328..06f0009321d 100644
--- a/web/app/components/plugins/plugin-auth/authorized/index.tsx
+++ b/web/app/components/plugins/plugin-auth/authorized/index.tsx
@@ -66,7 +66,7 @@ const Authorized = ({
onUpdate,
notAllowCustomCredential,
}: AuthorizedProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetDocuments', 'plugin'])
const { canUseCredential, canCreateCredential, canManageCredential } = useCredentialPermissions()
const [isLocalOpen, setIsLocalOpen] = useState(false)
const mergedIsOpen = isOpen ?? isLocalOpen
diff --git a/web/app/components/plugins/plugin-auth/authorized/item.tsx b/web/app/components/plugins/plugin-auth/authorized/item.tsx
index 52e67434522..9c9aa56ffc2 100644
--- a/web/app/components/plugins/plugin-auth/authorized/item.tsx
+++ b/web/app/components/plugins/plugin-auth/authorized/item.tsx
@@ -44,7 +44,7 @@ const Item = ({
selectedCredentialId,
disabled,
}: ItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const [renaming, setRenaming] = useState(false)
const [renameValue, setRenameValue] = useState(credential.name)
const { canUseCredential, canManageCredential } = useCredentialPermissions()
diff --git a/web/app/components/plugins/plugin-auth/hooks/use-plugin-auth-action.ts b/web/app/components/plugins/plugin-auth/hooks/use-plugin-auth-action.ts
index 13a12965da5..d238c0d1f6e 100644
--- a/web/app/components/plugins/plugin-auth/hooks/use-plugin-auth-action.ts
+++ b/web/app/components/plugins/plugin-auth/hooks/use-plugin-auth-action.ts
@@ -9,7 +9,7 @@ import {
} from '../hooks/use-credential'
export const usePluginAuthAction = (pluginPayload: PluginPayload, onUpdate?: () => void) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const pendingOperationCredentialId = useRef<string | null>(null)
const [deleteCredentialId, setDeleteCredentialId] = useState<string | null>(null)
const { mutateAsync: deletePluginCredential } = useDeletePluginCredentialHook(pluginPayload)
diff --git a/web/app/components/plugins/plugin-auth/plugin-auth-in-agent.tsx b/web/app/components/plugins/plugin-auth/plugin-auth-in-agent.tsx
index 7a5154f17ff..6f4bb03d706 100644
--- a/web/app/components/plugins/plugin-auth/plugin-auth-in-agent.tsx
+++ b/web/app/components/plugins/plugin-auth/plugin-auth-in-agent.tsx
@@ -20,7 +20,7 @@ const PluginAuthInAgent = ({
credentialId,
onAuthorizationItemClick,
}: PluginAuthInAgentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const [isOpen, setIsOpen] = useState(false)
const {
isAuthorized,
diff --git a/web/app/components/plugins/plugin-auth/plugin-auth-in-datasource-node.tsx b/web/app/components/plugins/plugin-auth/plugin-auth-in-datasource-node.tsx
index 046ba69e537..e7b22f31d2f 100644
--- a/web/app/components/plugins/plugin-auth/plugin-auth-in-datasource-node.tsx
+++ b/web/app/components/plugins/plugin-auth/plugin-auth-in-datasource-node.tsx
@@ -14,7 +14,7 @@ const PluginAuthInDataSourceNode = ({
isAuthorized,
onJumpToDataSourcePage,
}: PluginAuthInDataSourceNodeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<>
{!isAuthorized && (
diff --git a/web/app/components/plugins/plugin-auth/plugin-auth.tsx b/web/app/components/plugins/plugin-auth/plugin-auth.tsx
index 32a64450bb5..bbae93ef9bc 100644
--- a/web/app/components/plugins/plugin-auth/plugin-auth.tsx
+++ b/web/app/components/plugins/plugin-auth/plugin-auth.tsx
@@ -19,7 +19,7 @@ type PluginAuthProps = {
className?: string
}
const PluginAuth = ({ pluginPayload, children, className }: PluginAuthProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const [, setSettingsDestination] = useQueryState(settingsQueryParamName, settingsQueryParser)
const { canCreateCredential } = useCredentialPermissions()
const {
diff --git a/web/app/components/plugins/plugin-detail-panel/action-list.tsx b/web/app/components/plugins/plugin-detail-panel/action-list.tsx
index 026278363bf..10dd51dc2a5 100644
--- a/web/app/components/plugins/plugin-detail-panel/action-list.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/action-list.tsx
@@ -10,7 +10,7 @@ type Props = Readonly<{
}>
const ActionList = ({ detail }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const providerBriefInfo = detail.declaration?.tool?.identity
const providerKey = providerBriefInfo ? `${detail.plugin_id}/${providerBriefInfo.name}` : ''
const { data: collectionList = [] } = useAllToolProviders()
diff --git a/web/app/components/plugins/plugin-detail-panel/agent-strategy-list.tsx b/web/app/components/plugins/plugin-detail-panel/agent-strategy-list.tsx
index 884a3cec0c5..4f878224c3b 100644
--- a/web/app/components/plugins/plugin-detail-panel/agent-strategy-list.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/agent-strategy-list.tsx
@@ -10,7 +10,7 @@ type Props = Readonly<{
}>
const AgentStrategyList = ({ detail }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const providerName = detail.declaration.agent_strategy?.identity.name
const { data: strategyProviderDetail } = useQuery(
consoleQuery.workspaces.current.agentProvider.byProviderName.get.queryOptions({
diff --git a/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-form.tsx b/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-form.tsx
index 1d3d58db6da..fe08e99b924 100644
--- a/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-form.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-form.tsx
@@ -20,7 +20,7 @@ type Props = Readonly<{
onFormChange: (value: Record<string, any>) => void
}>
const AppInputsForm = ({ inputsForms, inputs, inputsRef, onFormChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const baseId = useId()
const handleFormChange = useCallback(
diff --git a/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-panel.tsx b/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-panel.tsx
index 1b627b9ff08..532013fe8d8 100644
--- a/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-panel.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-panel.tsx
@@ -18,7 +18,7 @@ type Props = Readonly<{
}>
const AppInputsPanel = ({ value, appDetail, onFormChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common'])
const inputsRef = useRef<Record<string, unknown>>(value?.inputs || {})
const { inputFormSchema, isError, isLoading, retry } = useAppInputsFormSchema({ appDetail })
diff --git a/web/app/components/plugins/plugin-detail-panel/app-selector/app-picker.tsx b/web/app/components/plugins/plugin-detail-panel/app-selector/app-picker.tsx
index c31da068923..2eb66f7e0d4 100644
--- a/web/app/components/plugins/plugin-detail-panel/app-selector/app-picker.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/app-selector/app-picker.tsx
@@ -113,7 +113,7 @@ export function AppPicker({
searchText,
onSearchChange,
}: AppPickerProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common', 'workflow'])
const inputRef = useRef<HTMLInputElement>(null)
const handleValueChange = useCallback(
diff --git a/web/app/components/plugins/plugin-detail-panel/app-selector/app-trigger.tsx b/web/app/components/plugins/plugin-detail-panel/app-selector/app-trigger.tsx
index 68933f95ac6..aeeef7491ae 100644
--- a/web/app/components/plugins/plugin-detail-panel/app-selector/app-trigger.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/app-selector/app-trigger.tsx
@@ -15,7 +15,7 @@ type AppTriggerProps = {
}
export function AppTrigger({ open, appDetail }: AppTriggerProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const appIconType = zIconType.safeParse(appDetail?.icon_type).data ?? null
return (
diff --git a/web/app/components/plugins/plugin-detail-panel/app-selector/index.tsx b/web/app/components/plugins/plugin-detail-panel/app-selector/index.tsx
index b5a8f020f22..8ecde1b95d1 100644
--- a/web/app/components/plugins/plugin-detail-panel/app-selector/index.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/app-selector/index.tsx
@@ -28,7 +28,7 @@ type AppSelectorProps = {
}
export function AppSelector({ value, disabled, offset = 4, onSelect }: AppSelectorProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const [isShowChooseApp, setIsShowChooseApp] = useState(false)
const [searchText, setSearchText] = useState('')
diff --git a/web/app/components/plugins/plugin-detail-panel/datasource-action-list.tsx b/web/app/components/plugins/plugin-detail-panel/datasource-action-list.tsx
index bcdd8fe49c5..3007b4e1cc5 100644
--- a/web/app/components/plugins/plugin-detail-panel/datasource-action-list.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/datasource-action-list.tsx
@@ -8,7 +8,7 @@ type Props = Readonly<{
}>
const ActionList = ({ detail }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const { data: hasProvider } = useQuery(
consoleQuery.rag.pipelines.datasourcePlugins.get.queryOptions({
select: (providers) => providers.some((provider) => provider.plugin_id === detail.plugin_id),
diff --git a/web/app/components/plugins/plugin-detail-panel/detail-header/components/header-modals.tsx b/web/app/components/plugins/plugin-detail-panel/detail-header/components/header-modals.tsx
index ada6b5e48b2..7657f6c15dc 100644
--- a/web/app/components/plugins/plugin-detail-panel/detail-header/components/header-modals.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/detail-header/components/header-modals.tsx
@@ -39,7 +39,7 @@ const HeaderModals: FC<HeaderModalsProps> = ({
onUpdatedFromMarketplace,
onDelete,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const locale = useGetLanguage()
const { source, version, meta } = detail
diff --git a/web/app/components/plugins/plugin-detail-panel/detail-header/components/plugin-source-badge.tsx b/web/app/components/plugins/plugin-detail-panel/detail-header/components/plugin-source-badge.tsx
index 373d6998b71..9223ff04793 100644
--- a/web/app/components/plugins/plugin-detail-panel/detail-header/components/plugin-source-badge.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/detail-header/components/plugin-source-badge.tsx
@@ -50,7 +50,7 @@ const SOURCE_CONFIG_MAP: Record<PluginSource, SourceConfig | null> = {
}
const PluginSourceBadge: FC<PluginSourceBadgeProps> = ({ source }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const config = SOURCE_CONFIG_MAP[source]
if (!config) return null
diff --git a/web/app/components/plugins/plugin-detail-panel/detail-header/hooks/use-plugin-operations.ts b/web/app/components/plugins/plugin-detail-panel/detail-header/hooks/use-plugin-operations.ts
index e2b4d31d739..52350cc68e6 100644
--- a/web/app/components/plugins/plugin-detail-panel/detail-header/hooks/use-plugin-operations.ts
+++ b/web/app/components/plugins/plugin-detail-panel/detail-header/hooks/use-plugin-operations.ts
@@ -41,7 +41,7 @@ export const usePluginOperations = ({
isFromMarketplace,
onUpdate,
}: UsePluginOperationsParams): UsePluginOperationsReturn => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const { setShowUpdatePluginModal } = useModalContext()
const { refreshPluginList } = useRefreshPluginList()
const invalidateCheckInstalled = useInvalidateCheckInstalled()
diff --git a/web/app/components/plugins/plugin-detail-panel/detail-header/index.tsx b/web/app/components/plugins/plugin-detail-panel/detail-header/index.tsx
index eb5c7d873ff..f318f7864f2 100644
--- a/web/app/components/plugins/plugin-detail-panel/detail-header/index.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/detail-header/index.tsx
@@ -84,7 +84,7 @@ const DetailHeader = ({
onHide,
onUpdate,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const openReadmePanel = useReadmePanelStore((s) => s.openReadmePanel)
const { data: timezone } = useQuery({
...userProfileQueryOptions(),
diff --git a/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx b/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx
index 675200f4128..cb74e31cb35 100644
--- a/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx
@@ -28,7 +28,7 @@ type Props = Readonly<{
}>
const EndpointCard = ({ pluginDetail, data }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const endpointID = data.id
const [isShowDisableConfirm, { setTrue: showDisableConfirm, setFalse: hideDisableConfirm }] =
useBoolean(false)
diff --git a/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx b/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx
index 4ca332e8ab9..183b2d1a394 100644
--- a/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx
@@ -23,7 +23,7 @@ type EndpointListContentProps = Readonly<{
}>
const EndpointListContent = ({ declaration, detail }: EndpointListContentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const docLink = useDocLink()
const pluginUniqueID = detail.plugin_unique_identifier
const showTopBorder = detail.declaration.tool
diff --git a/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx b/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx
index 415de6447a5..d997c8413c6 100644
--- a/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx
@@ -102,7 +102,7 @@ const EndpointModal = ({
pluginDetail,
}: Props) => {
const getValueFromI18nObject = useRenderI18nObject()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin', 'tools'])
const fields = [NAME_FIELD, ...settings]
const formSchemas = fields.map(toFormSchema)
const [tempCredential, setTempCredential] = React.useState<Record<string, unknown>>(() => {
diff --git a/web/app/components/plugins/plugin-detail-panel/model-list.tsx b/web/app/components/plugins/plugin-detail-panel/model-list.tsx
index 7c4e6523b35..7f4c42c271c 100644
--- a/web/app/components/plugins/plugin-detail-panel/model-list.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/model-list.tsx
@@ -10,7 +10,7 @@ type Props = Readonly<{
}>
const ModelList = ({ detail }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const { data: res } = useModelProviderModelList(
`${detail.plugin_id}/${detail.declaration.model.provider}`,
)
diff --git a/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx b/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx
index 3a49bcbfab2..cac093a8e23 100644
--- a/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/model-selector/index.tsx
@@ -50,7 +50,7 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({
isInWorkflow,
scope = ModelTypeEnum.textGeneration,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [open, setOpen] = useState(false)
const scopeArray = scope.split('&')
const scopeFeatures = useMemo((): ModelFeatureEnum[] => {
diff --git a/web/app/components/plugins/plugin-detail-panel/model-selector/llm-params-panel.tsx b/web/app/components/plugins/plugin-detail-panel/model-selector/llm-params-panel.tsx
index 76121c0fc77..142a6499002 100644
--- a/web/app/components/plugins/plugin-detail-panel/model-selector/llm-params-panel.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/model-selector/llm-params-panel.tsx
@@ -29,7 +29,7 @@ const LLMParamsPanel = ({
completionParams,
onCompletionParamsChange,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { data: parameterRulesData, isLoading } = useModelParameterRules(provider, modelId)
const isRulesLoading = !!provider && !!modelId && isLoading
diff --git a/web/app/components/plugins/plugin-detail-panel/model-selector/tts-params-panel.tsx b/web/app/components/plugins/plugin-detail-panel/model-selector/tts-params-panel.tsx
index e67a06e8485..88117391b14 100644
--- a/web/app/components/plugins/plugin-detail-panel/model-selector/tts-params-panel.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/model-selector/tts-params-panel.tsx
@@ -22,7 +22,7 @@ type Props = Readonly<{
const supportedLanguages = languages.filter((item) => item.supported)
const TTSParamsPanel = ({ currentModel, language, voice, onChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const voiceList = useMemo<Array<{ label: string; value: string }>>(() => {
if (!currentModel) return []
return currentModel.model_properties.voices.map((item: { mode: string; name: string }) => ({
diff --git a/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.tsx b/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.tsx
index 40e5968e963..da4fd23df2f 100644
--- a/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.tsx
@@ -44,7 +44,7 @@ const MultipleToolSelector = ({
}: Props) => {
const titleId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'plugin'])
const { allowed: isMCPToolAllowed } = useMCPToolAvailability()
const { data: mcpTools } = useAllMCPTools()
const addToolButtonRef = React.useRef<HTMLButtonElement>(null)
diff --git a/web/app/components/plugins/plugin-detail-panel/operation-dropdown.tsx b/web/app/components/plugins/plugin-detail-panel/operation-dropdown.tsx
index 23ffc52047a..4a16949de1f 100644
--- a/web/app/components/plugins/plugin-detail-panel/operation-dropdown.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/operation-dropdown.tsx
@@ -47,7 +47,7 @@ export function OperationDropdown({
showCheckVersion = true,
showRemove = true,
}: OperationDropdownProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const { data: enable_marketplace } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: (s) => s.enable_marketplace,
diff --git a/web/app/components/plugins/plugin-detail-panel/strategy-detail.tsx b/web/app/components/plugins/plugin-detail-panel/strategy-detail.tsx
index e8a69850a23..363a7fc681f 100644
--- a/web/app/components/plugins/plugin-detail-panel/strategy-detail.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/strategy-detail.tsx
@@ -46,7 +46,7 @@ const getOutputType = (schema: unknown): string => {
const StrategyDetail: FC<Props> = ({ provider, tenantId, detail, onHide }) => {
const getValueFromI18nObject = useRenderI18nObject()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
const outputSchema = useMemo(() => {
const properties = detail.output_schema?.properties
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx
index bc54ccc88f5..d57cf3ad910 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx
@@ -40,7 +40,7 @@ export const CommonCreateModal = ({ open = true, onClose, createType, builder }:
}
function CommonCreateModalContent({ onClose, createType, builder }: Omit<Props, 'open'>) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'pluginTrigger'])
const {
currentStep,
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/components/modal-steps.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/components/modal-steps.tsx
index 1c982bceb56..d540da82cb5 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/components/modal-steps.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/components/modal-steps.tsx
@@ -41,7 +41,7 @@ type MultiStepsProps = {
}
export const MultiSteps = ({ currentStep }: MultiStepsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['pluginTrigger'])
return (
<div className="mb-6 flex w-1/3 items-center gap-2">
<StatusStep
@@ -90,7 +90,7 @@ type SubscriptionFormProps = {
}
const SubscriptionForm = ({ subscriptionFormRef, endpoint }: SubscriptionFormProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['pluginTrigger'])
const formSchemas = React.useMemo(
() => [
@@ -216,7 +216,7 @@ const ManualPropertiesSection = ({
logs,
pluginName,
}: ManualPropertiesSectionProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['pluginTrigger'])
const formSchemas = React.useMemo(
() =>
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.ts b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.ts
index 86c8aca415c..d3c283c81a4 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.ts
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.ts
@@ -107,7 +107,7 @@ export const useCommonModalState = ({
builder,
onClose,
}: UseCommonModalStateParams): UseCommonModalStateReturn => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['pluginTrigger'])
const translatePluginTriggerKey = useCallback<PluginTriggerTranslate>(
(selector, options) => t(selector, options),
[t],
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-oauth-client-state.ts b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-oauth-client-state.ts
index 92bc82b503c..a9c3f29b939 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-oauth-client-state.ts
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-oauth-client-state.ts
@@ -77,7 +77,7 @@ export const useOAuthClientState = ({
onOpenChange,
showOAuthCreateModal,
}: UseOAuthClientStateParams): UseOAuthClientStateReturn => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin', 'pluginTrigger'])
// State management
const [subscriptionBuilder, setSubscriptionBuilder] = useState<
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/index.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/index.tsx
index bb64f851b6f..27d629d3e82 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/index.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/index.tsx
@@ -50,7 +50,7 @@ export const CreateSubscriptionButton = ({
buttonType = CreateButtonType.FULL_BUTTON,
shape = 'square',
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin', 'pluginTrigger'])
const { subscriptions } = useSubscriptionList()
const subscriptionCount = subscriptions?.length || 0
const [selectedCreateInfo, setSelectedCreateInfo] = useState<{
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/oauth-client.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/oauth-client.tsx
index 22ab5d89cca..8f0d5cfacb0 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/oauth-client.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/oauth-client.tsx
@@ -32,7 +32,7 @@ export const OAuthClientSettingsModal = ({
onOpenChange,
showOAuthCreateModal,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin', 'pluginTrigger'])
const detail = usePluginStore((state) => state.detail)
const providerName = detail?.provider || ''
const closeModal = useCallback(() => onOpenChange(false), [onOpenChange])
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx
index 6b75865ee9d..697e54be452 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx
@@ -29,7 +29,7 @@ export const DeleteConfirm = (props: Props) => {
const { onClose, isShow, currentId, currentName, workflowsInUse } = props
const { refetch } = useSubscriptionList()
const { mutate: deleteSubscription, isPending: isDeleting } = useDeleteTriggerSubscription()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'pluginTrigger'])
const [inputName, setInputName] = useState('')
const handleOpenChange = (open: boolean) => {
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/apikey-edit-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/apikey-edit-modal.tsx
index d98feaeab56..18ea5cddcbd 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/apikey-edit-modal.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/apikey-edit-modal.tsx
@@ -98,7 +98,7 @@ const MultiSteps = ({
currentStep: EditStep
onStepClick?: (step: EditStep) => void
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['pluginTrigger'])
return (
<div className="mb-6 flex w-1/3 items-center gap-2">
<StatusStep
@@ -117,7 +117,7 @@ const MultiSteps = ({
}
export const ApiKeyEditModal = ({ onClose, subscription, pluginDetail }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'pluginTrigger'])
const detail = usePluginStore((state) => state.detail)
const { refetch } = useSubscriptionList()
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/manual-edit-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/manual-edit-modal.tsx
index 726fea0550c..4c4f1d28846 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/manual-edit-modal.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/manual-edit-modal.tsx
@@ -44,7 +44,7 @@ const normalizeFormType = (type: string): FormTypeEnum => {
}
export const ManualEditModal = ({ onClose, subscription, pluginDetail }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'pluginTrigger'])
const detail = usePluginStore((state) => state.detail)
const { refetch } = useSubscriptionList()
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/oauth-edit-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/oauth-edit-modal.tsx
index a1d90c83cdf..77f56f137dc 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/oauth-edit-modal.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/oauth-edit-modal.tsx
@@ -44,7 +44,7 @@ const normalizeFormType = (type: string): FormTypeEnum => {
}
export const OAuthEditModal = ({ onClose, subscription, pluginDetail }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'pluginTrigger'])
const detail = usePluginStore((state) => state.detail)
const { refetch } = useSubscriptionList()
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/list-view.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/list-view.tsx
index 44db2049870..201f628335f 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/list-view.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/list-view.tsx
@@ -20,7 +20,7 @@ export const SubscriptionListView: React.FC<SubscriptionListViewProps> = ({
}) => {
const titleId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['pluginTrigger'])
const { subscriptions } = useSubscriptionList()
const subscriptionCount = subscriptions?.length || 0
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/log-viewer.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/log-viewer.tsx
index f01ad8eede3..27a440cc4a1 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/log-viewer.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/log-viewer.tsx
@@ -29,7 +29,7 @@ const LogTypeEnum = {
type LogTypeEnum = (typeof LogTypeEnum)[keyof typeof LogTypeEnum]
const LogViewer = ({ logs, className }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'pluginTrigger'])
const [expandedLogs, setExpandedLogs] = useState<Set<string>>(new Set())
const toggleLogExpansion = (logId: string) => {
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/selector-entry.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/selector-entry.tsx
index 13a516b3068..5781899ee36 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/selector-entry.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/selector-entry.tsx
@@ -20,7 +20,7 @@ const SubscriptionTriggerButton: React.FC<SubscriptionTriggerButtonProps> = ({
isOpen = false,
className,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['pluginTrigger'])
const { subscriptions } = useSubscriptionList()
const statusConfig = useMemo(() => {
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/selector-view.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/selector-view.tsx
index bc56c541bcf..fba68453100 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/selector-view.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/selector-view.tsx
@@ -22,7 +22,7 @@ export const SubscriptionSelectorView: React.FC<SubscriptionSelectorProps> = ({
}) => {
const titleId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'pluginTrigger'])
const { subscriptions } = useSubscriptionList()
const [deletedSubscription, setDeletedSubscription] = useState<TriggerSubscription | null>(null)
const subscriptionCount = subscriptions?.length || 0
diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/subscription-card.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/subscription-card.tsx
index b34cd00a623..6134069dffa 100644
--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/subscription-card.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/subscription-card.tsx
@@ -15,7 +15,7 @@ type Props = Readonly<{
}>
const SubscriptionCard = ({ data, pluginDetail }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'pluginTrigger'])
const [isShowDeleteModal, { setTrue: showDeleteModal, setFalse: hideDeleteModal }] =
useBoolean(false)
const [isShowEditModal, { setTrue: showEditModal, setFalse: hideEditModal }] = useBoolean(false)
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx
index 26007410a80..8d5483555d7 100644
--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx
@@ -68,7 +68,7 @@ const ReasoningConfigForm: React.FC<Props> = ({
}) => {
const fieldLabelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin', 'tools', 'workflow'])
const language = useLanguage()
const { data: timezone } = useSuspenseQuery({
...userProfileQueryOptions(),
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/schema-modal.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/schema-modal.tsx
index adca9d2f3bb..427ef87cfcd 100644
--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/schema-modal.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/schema-modal.tsx
@@ -16,7 +16,7 @@ type Props = Readonly<{
}>
export function SchemaModal({ isShow, schema, rootName, onClose }: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
return (
<Dialog open={isShow} onOpenChange={(open) => !open && onClose()}>
<DialogContent className="w-full max-w-240 p-0">
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-base-form.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-base-form.tsx
index 86895d08b2c..6da7d53b7c2 100644
--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-base-form.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-base-form.tsx
@@ -43,7 +43,7 @@ export function ToolBaseForm({
onSelectMultipleTool,
onDescriptionChange,
}: ToolBaseFormProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
return (
<div className="flex flex-col gap-3 px-4 py-2">
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx
index 83398f974e2..b855f6217d7 100644
--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-item.tsx
@@ -59,7 +59,7 @@ export function ToolItem({
versionMismatch,
authRemoved,
}: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin', 'tools'])
const { allowed: isMCPToolAllowed } = useMCPToolAvailability()
const providerNameText = isMCPTool ? providerShowName : providerName?.split('/').pop()
const isTransparent = uninstalled || versionMismatch || isError
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-settings-panel.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-settings-panel.tsx
index f350412bf36..319a87043c6 100644
--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-settings-panel.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-settings-panel.tsx
@@ -35,7 +35,7 @@ type ToolSettingsPanelProps = {
* Renders the settings/params tips section
*/
function ParamsTips() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
return (
<div className="pb-1">
<div className="system-xs-regular text-text-tertiary">
@@ -65,7 +65,7 @@ export function ToolSettingsPanel({
onSettingsFormChange,
onParamsFormChange,
}: ToolSettingsPanelProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
// Check if panel should be shown
const hasSettings = settingsFormSchemas.length > 0
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-trigger.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-trigger.tsx
index 8a3337ee1f5..f2d988aa604 100644
--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-trigger.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/tool-trigger.tsx
@@ -28,7 +28,7 @@ export function ToolTrigger({
className,
...buttonProps
}: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
return (
<Button
{...buttonProps}
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx
index 0497279d997..4f736a4d8b4 100644
--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx
@@ -68,7 +68,7 @@ function ToolSelector({
nodeId = '',
triggerRef,
}: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const {
isShow,
setIsShow,
diff --git a/web/app/components/plugins/plugin-detail-panel/trigger/event-detail-drawer.tsx b/web/app/components/plugins/plugin-detail-panel/trigger/event-detail-drawer.tsx
index c71794b9541..827baa0f8db 100644
--- a/web/app/components/plugins/plugin-detail-panel/trigger/event-detail-drawer.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/trigger/event-detail-drawer.tsx
@@ -1,4 +1,5 @@
'use client'
+
import type { TFunction } from 'i18next'
import type { FC } from 'react'
import type { TriggerEvent } from '@/app/components/plugins/types'
@@ -29,7 +30,7 @@ type EventDetailDrawerProps = {
onClose: () => void
}
-const getType = (type: string, t: TFunction) => {
+const getType = (type: string, t: TFunction<['tools']>) => {
if (type === 'number-input') return t(($) => $['setBuiltInTools.number'], { ns: 'tools' })
if (type === 'text-input') return t(($) => $['setBuiltInTools.string'], { ns: 'tools' })
if (type === 'checkbox') return 'boolean'
@@ -67,7 +68,7 @@ const convertSchemaToField = (schema: any): any => {
export const EventDetailDrawer: FC<EventDetailDrawerProps> = (props) => {
const { eventInfo, providerInfo, onClose } = props
const language = useLanguage()
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools', 'common', 'plugin', 'pluginTrigger'])
const parametersSchemas = triggerEventParametersToFormSchemas(eventInfo.parameters)
// Convert output_schema properties to array for direct rendering
diff --git a/web/app/components/plugins/plugin-detail-panel/trigger/event-list.tsx b/web/app/components/plugins/plugin-detail-panel/trigger/event-list.tsx
index c0de69c8e5e..c868b2787ee 100644
--- a/web/app/components/plugins/plugin-detail-panel/trigger/event-list.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/trigger/event-list.tsx
@@ -42,7 +42,7 @@ const TriggerEventCard = ({ eventInfo, providerInfo }: TriggerEventCardProps) =>
}
export const TriggerEventsList = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['pluginTrigger'])
const detail = usePluginStore((state) => state.detail)
const { data: providerInfo } = useTriggerProviderInfo(detail?.provider || '')
diff --git a/web/app/components/plugins/plugin-item/action.tsx b/web/app/components/plugins/plugin-item/action.tsx
index b825d1fc2b0..f6f97b3366e 100644
--- a/web/app/components/plugins/plugin-item/action.tsx
+++ b/web/app/components/plugins/plugin-item/action.tsx
@@ -51,7 +51,7 @@ const Action: FC<Props> = ({
onDelete,
meta,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const [isShowPluginInfo, { setTrue: showPluginInfo, setFalse: hidePluginInfo }] =
useBoolean(false)
const [deleting, { setTrue: showDeleting, setFalse: hideDeleting }] = useBoolean(false)
diff --git a/web/app/components/plugins/plugin-item/index.tsx b/web/app/components/plugins/plugin-item/index.tsx
index c3e978eb1b9..bb7f62dc609 100644
--- a/web/app/components/plugins/plugin-item/index.tsx
+++ b/web/app/components/plugins/plugin-item/index.tsx
@@ -44,7 +44,7 @@ const PluginItem: FC<Props> = ({
className,
plugin,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const { theme } = useTheme()
const selectedPluginID = usePluginPageContext((v) =>
v.selectedItem?.type === 'plugin' ? v.selectedItem.id : undefined,
diff --git a/web/app/components/plugins/plugin-mutation-model/index.tsx b/web/app/components/plugins/plugin-mutation-model/index.tsx
index f85dd29d613..346a1237bd0 100644
--- a/web/app/components/plugins/plugin-mutation-model/index.tsx
+++ b/web/app/components/plugins/plugin-mutation-model/index.tsx
@@ -34,7 +34,7 @@ const PluginMutationModal: FC<Props> = ({
mutate,
modalBottomLeft,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<Dialog
diff --git a/web/app/components/plugins/plugin-page/category-empty-state.tsx b/web/app/components/plugins/plugin-page/category-empty-state.tsx
index 03e9f587869..c827d0925d0 100644
--- a/web/app/components/plugins/plugin-page/category-empty-state.tsx
+++ b/web/app/components/plugins/plugin-page/category-empty-state.tsx
@@ -33,7 +33,7 @@ const CategoryEmptyState = ({
category: EmbeddedMarketplaceCategory
showMarketplaceLink: boolean
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const config = categoryConfig[category as Category]
if (!config) return null
diff --git a/web/app/components/plugins/plugin-page/category-marketplace-panel.tsx b/web/app/components/plugins/plugin-page/category-marketplace-panel.tsx
index a1c75b91295..2bae9c9d4b4 100644
--- a/web/app/components/plugins/plugin-page/category-marketplace-panel.tsx
+++ b/web/app/components/plugins/plugin-page/category-marketplace-panel.tsx
@@ -31,7 +31,7 @@ const CategoryMarketplacePanel = ({
searchText: string
tags?: string[]
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin', 'workflow'])
const { theme } = useTheme()
const { canInstallPlugin } = usePluginSettingsAccess()
const [collapsed, setCollapsed] = useState(false)
diff --git a/web/app/components/plugins/plugin-page/debug-info.tsx b/web/app/components/plugins/plugin-page/debug-info.tsx
index 47dbdbf1cac..3e80021b74e 100644
--- a/web/app/components/plugins/plugin-page/debug-info.tsx
+++ b/web/app/components/plugins/plugin-page/debug-info.tsx
@@ -26,7 +26,7 @@ function DebugInfo({
triggerContent,
triggerVariant = 'secondary',
}: DebugInfoProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const docLink = useDocLink()
const { data: info, isLoading } = useDebugKey()
const title = t(($) => $[`${i18nPrefix}.title`], { ns: 'plugin' })
diff --git a/web/app/components/plugins/plugin-page/empty/index.tsx b/web/app/components/plugins/plugin-page/empty/index.tsx
index 0527ec6a27a..ce1ed95e414 100644
--- a/web/app/components/plugins/plugin-page/empty/index.tsx
+++ b/web/app/components/plugins/plugin-page/empty/index.tsx
@@ -39,7 +39,7 @@ const Empty = ({
installContextCategory,
onSwitchToMarketplace,
}: EmptyProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const fileInputRef = useRef<HTMLInputElement>(null)
const [selectedAction, setSelectedAction] = useState<string | null>(null)
const [selectedFile, setSelectedFile] = useState<File | null>(null)
diff --git a/web/app/components/plugins/plugin-page/filter-management/category-filter.tsx b/web/app/components/plugins/plugin-page/filter-management/category-filter.tsx
index c0dac5e95e4..c9a415ac8b0 100644
--- a/web/app/components/plugins/plugin-page/filter-management/category-filter.tsx
+++ b/web/app/components/plugins/plugin-page/filter-management/category-filter.tsx
@@ -15,7 +15,7 @@ type CategoriesFilterProps = {
onChange: (categories: string[]) => void
}
const CategoriesFilter = ({ value, onChange }: CategoriesFilterProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const [searchText, setSearchText] = useState('')
const searchLabel = t(($) => $.searchCategories, { ns: 'plugin' })
const { categories: options, categoriesMap } = useCategories()
diff --git a/web/app/components/plugins/plugin-page/filter-management/search-box.tsx b/web/app/components/plugins/plugin-page/filter-management/search-box.tsx
index 17c00b5af68..9c325f1dcea 100644
--- a/web/app/components/plugins/plugin-page/filter-management/search-box.tsx
+++ b/web/app/components/plugins/plugin-page/filter-management/search-box.tsx
@@ -9,7 +9,7 @@ type SearchBoxProps = {
}
const SearchBox: React.FC<SearchBoxProps> = ({ searchQuery, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const searchLabel = t(($) => $.search, { ns: 'plugin' })
return (
diff --git a/web/app/components/plugins/plugin-page/filter-management/tag-filter.tsx b/web/app/components/plugins/plugin-page/filter-management/tag-filter.tsx
index 33e22edc880..899f1377d79 100644
--- a/web/app/components/plugins/plugin-page/filter-management/tag-filter.tsx
+++ b/web/app/components/plugins/plugin-page/filter-management/tag-filter.tsx
@@ -14,7 +14,7 @@ type TagsFilterProps = {
onChange: (tags: string[]) => void
}
const TagsFilter = ({ value, onChange }: TagsFilterProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'pluginTags'])
const [searchText, setSearchText] = useState('')
const { tags: options, getTagLabel } = useTags()
const filteredOptions = options.filter((option) =>
diff --git a/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx b/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx
index 64350631e66..0fbafb3bb65 100644
--- a/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx
+++ b/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx
@@ -56,7 +56,7 @@ const InstallPluginDropdown = ({
installContextCategory,
showTriggerArrow = true,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const fileInputRef = useRef<HTMLInputElement>(null)
const [isMenuOpen, setIsMenuOpen] = useState(false)
const [selectedAction, setSelectedAction] = useState<string | null>(null)
diff --git a/web/app/components/plugins/plugin-page/nav-operations.tsx b/web/app/components/plugins/plugin-page/nav-operations.tsx
index 10f15c7cb97..1e9d7c4f845 100644
--- a/web/app/components/plugins/plugin-page/nav-operations.tsx
+++ b/web/app/components/plugins/plugin-page/nav-operations.tsx
@@ -86,7 +86,7 @@ export function SubmitRequestDropdownMenu({
dividerAfterFirst,
docLink,
}: SubmitRequestDropdownMenuProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const [open, setOpen] = useState(false)
const options = getOptions(docLink)
const guideLabel = t(($) => $['marketplace.home.guide'], { ns: 'plugin' })
diff --git a/web/app/components/plugins/plugin-page/plugin-info.tsx b/web/app/components/plugins/plugin-page/plugin-info.tsx
index 7da1f2eee29..b60bea8e945 100644
--- a/web/app/components/plugins/plugin-page/plugin-info.tsx
+++ b/web/app/components/plugins/plugin-page/plugin-info.tsx
@@ -16,7 +16,7 @@ type Props = Readonly<{
}>
const PlugInfo: FC<Props> = ({ repository, release, packageName, onHide }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const labelWidthClassName = 'w-[96px]'
return (
<Dialog
diff --git a/web/app/components/plugins/plugin-page/plugin-list-skeleton.tsx b/web/app/components/plugins/plugin-page/plugin-list-skeleton.tsx
index 4cbffc3ba68..305e08f9eb3 100644
--- a/web/app/components/plugins/plugin-page/plugin-list-skeleton.tsx
+++ b/web/app/components/plugins/plugin-page/plugin-list-skeleton.tsx
@@ -34,7 +34,7 @@ type PluginListSkeletonProps = {
}
const PluginListSkeleton = ({ contentFrameClassName }: PluginListSkeletonProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div
diff --git a/web/app/components/plugins/plugin-page/plugin-sidecar-panel.tsx b/web/app/components/plugins/plugin-page/plugin-sidecar-panel.tsx
index e37fca5953f..7944cd1c830 100644
--- a/web/app/components/plugins/plugin-page/plugin-sidecar-panel.tsx
+++ b/web/app/components/plugins/plugin-page/plugin-sidecar-panel.tsx
@@ -12,7 +12,7 @@ type PluginSidecarPanelProps = {
}
export function PluginSidecarPanel({ children, footer, title }: PluginSidecarPanelProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className="flex w-90 flex-col items-start overflow-hidden rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-2xl shadow-shadow-shadow-9">
diff --git a/web/app/components/plugins/plugin-page/plugin-tasks/components/error-plugin-item.tsx b/web/app/components/plugins/plugin-page/plugin-tasks/components/error-plugin-item.tsx
index db83102ab1f..2dd9c1565fc 100644
--- a/web/app/components/plugins/plugin-page/plugin-tasks/components/error-plugin-item.tsx
+++ b/web/app/components/plugins/plugin-page/plugin-tasks/components/error-plugin-item.tsx
@@ -19,7 +19,7 @@ type ErrorPluginItemProps = {
}
const ErrorPluginItem: FC<ErrorPluginItemProps> = ({ plugin, getIconUrl, language, onClear }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const source = plugin.source
const [showInstallModal, setShowInstallModal] = useState(false)
const [installPayload, setInstallPayload] = useState<{
diff --git a/web/app/components/plugins/plugin-page/plugin-tasks/components/plugin-task-list.tsx b/web/app/components/plugins/plugin-page/plugin-tasks/components/plugin-task-list.tsx
index 8fc1c16c60d..39ba6071eb4 100644
--- a/web/app/components/plugins/plugin-page/plugin-tasks/components/plugin-task-list.tsx
+++ b/web/app/components/plugins/plugin-page/plugin-tasks/components/plugin-task-list.tsx
@@ -31,7 +31,7 @@ function PluginTaskList({
onClearErrors,
onClearSingle,
}: PluginTaskListProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const language = useGetLanguage()
const runningSectionTitle = t(($) => $['task.runningPlugins'], { ns: 'plugin' })
const successSectionTitle = t(($) => $['task.successPlugins'], { ns: 'plugin' })
diff --git a/web/app/components/plugins/plugin-page/plugin-tasks/index.tsx b/web/app/components/plugins/plugin-page/plugin-tasks/index.tsx
index aeb2803734f..232e59b67e6 100644
--- a/web/app/components/plugins/plugin-page/plugin-tasks/index.tsx
+++ b/web/app/components/plugins/plugin-page/plugin-tasks/index.tsx
@@ -25,7 +25,7 @@ const PluginTasks = ({
dropdownAnchor,
dropdownPlacement = 'bottom',
}: PluginTasksProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const [open, setOpen] = useState(false)
const {
errorPlugins,
diff --git a/web/app/components/plugins/plugin-page/plugins-panel-results.tsx b/web/app/components/plugins/plugin-page/plugins-panel-results.tsx
index bfb81ae3a17..c8da9033855 100644
--- a/web/app/components/plugins/plugin-page/plugins-panel-results.tsx
+++ b/web/app/components/plugins/plugin-page/plugins-panel-results.tsx
@@ -76,7 +76,7 @@ const PluginsPanelResults = ({
showCategoryEmptyState,
tagFilterValue,
}: PluginsPanelResultsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin', 'workflow'])
const loadMoreAnchorRef = useRef<HTMLDivElement>(null)
const loadNextPageRequestedRef = useRef(false)
diff --git a/web/app/components/plugins/plugin-page/plugins-panel.tsx b/web/app/components/plugins/plugin-page/plugins-panel.tsx
index 745f3cb5b69..e1f3e229dcc 100644
--- a/web/app/components/plugins/plugin-page/plugins-panel.tsx
+++ b/web/app/components/plugins/plugin-page/plugins-panel.tsx
@@ -80,7 +80,7 @@ const PluginsPanel = ({
onSwitchToMarketplace,
toolbarAction,
}: PluginsPanelProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const locale = useGetLanguage()
const filters = usePluginPageContext((v) => v.filters) as FilterState
const setFilters = usePluginPageContext((v) => v.setFilters)
diff --git a/web/app/components/plugins/plugin-page/use-reference-setting.ts b/web/app/components/plugins/plugin-page/use-reference-setting.ts
index 28780b232e5..604eabdbca7 100644
--- a/web/app/components/plugins/plugin-page/use-reference-setting.ts
+++ b/web/app/components/plugins/plugin-page/use-reference-setting.ts
@@ -43,7 +43,7 @@ const useCanSetPluginSettings = () => {
}
export const usePluginSettingsAccess = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const isCurrentWorkspaceManager = useAtomValue(isCurrentWorkspaceManagerAtom)
const isCurrentWorkspaceOwner = useAtomValue(isCurrentWorkspaceOwnerAtom)
const isLoadingCurrentWorkspace = useAtomValue(currentWorkspaceLoadingAtom)
@@ -110,7 +110,7 @@ export const usePluginSettingsAccess = () => {
}
const useReferenceSetting = (category: PluginCategoryEnum) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const permissionAccess = usePluginSettingsAccess()
const autoUpgradeQuery = usePluginAutoUpgradeSettings(category)
const data =
diff --git a/web/app/components/plugins/provider-card.tsx b/web/app/components/plugins/provider-card.tsx
index 4052bdb8074..9457d868eeb 100644
--- a/web/app/components/plugins/provider-card.tsx
+++ b/web/app/components/plugins/provider-card.tsx
@@ -27,7 +27,7 @@ type Props = Readonly<{
const ProviderCardComponent: FC<Props> = ({ className, payload }) => {
const getValueFromI18nObject = useRenderI18nObject()
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const { theme } = useTheme()
const [
isShowInstallFromMarketplace,
diff --git a/web/app/components/plugins/readme-panel/content.tsx b/web/app/components/plugins/readme-panel/content.tsx
index fb8277dc6de..05fc5c8f9d5 100644
--- a/web/app/components/plugins/readme-panel/content.tsx
+++ b/web/app/components/plugins/readme-panel/content.tsx
@@ -23,7 +23,7 @@ type ReadmePanelContentProps = {
}
export function ReadmePanelContent({ detail, title, closeButton }: ReadmePanelContentProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const language = useLanguage()
const locale = useGetLanguage()
const pluginUniqueIdentifier = detail.plugin_unique_identifier
diff --git a/web/app/components/plugins/readme-panel/dialog.tsx b/web/app/components/plugins/readme-panel/dialog.tsx
index 6f1ed770336..1215455dd64 100644
--- a/web/app/components/plugins/readme-panel/dialog.tsx
+++ b/web/app/components/plugins/readme-panel/dialog.tsx
@@ -13,7 +13,7 @@ type ReadmeDialogProps = {
}
export function ReadmeDialog({ detail, open, onOpenChange, triggerId }: ReadmeDialogProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
return (
<Dialog open={open} onOpenChange={onOpenChange} triggerId={triggerId}>
diff --git a/web/app/components/plugins/readme-panel/drawer.tsx b/web/app/components/plugins/readme-panel/drawer.tsx
index 410094c9349..732cacb88da 100644
--- a/web/app/components/plugins/readme-panel/drawer.tsx
+++ b/web/app/components/plugins/readme-panel/drawer.tsx
@@ -22,7 +22,7 @@ type ReadmeDrawerProps = {
}
export function ReadmeDrawer({ detail, open, onOpenChange, triggerId }: ReadmeDrawerProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
return (
<Drawer
diff --git a/web/app/components/plugins/readme-panel/entrance.tsx b/web/app/components/plugins/readme-panel/entrance.tsx
index 48e08903f28..f02e6f8a967 100644
--- a/web/app/components/plugins/readme-panel/entrance.tsx
+++ b/web/app/components/plugins/readme-panel/entrance.tsx
@@ -16,7 +16,7 @@ export const ReadmeEntrance = ({
className?: string
showShortTip?: boolean
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const triggerId = useId()
const openReadmePanel = useReadmePanelStore((s) => s.openReadmePanel)
diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/no-data-placeholder.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/no-data-placeholder.tsx
index d09ede407f9..142fb81c429 100644
--- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/no-data-placeholder.tsx
+++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/no-data-placeholder.tsx
@@ -10,7 +10,7 @@ type Props = Readonly<{
}>
const NoDataPlaceholder: FC<Props> = ({ className, noPlugins }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const icon = noPlugins ? (
<span aria-hidden className="i-custom-vender-other-group size-6 text-text-quaternary" />
) : (
diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/no-plugin-selected.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/no-plugin-selected.tsx
index 60b7d7b35fd..94e08b73e0a 100644
--- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/no-plugin-selected.tsx
+++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/no-plugin-selected.tsx
@@ -9,7 +9,7 @@ type Props = Readonly<{
}>
const NoPluginSelected: FC<Props> = ({ updateMode }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const text = `${t(($) => $[`autoUpdate.upgradeModePlaceholder.${updateMode === AUTO_UPDATE_MODE.partial ? 'partial' : 'exclude'}`], { ns: 'plugin' })}`
return <div className="text-center system-xs-regular text-text-tertiary">{text}</div>
}
diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-picker.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-picker.tsx
index 3a03ad166f9..8a64955d134 100644
--- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-picker.tsx
+++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/plugins-picker.tsx
@@ -23,7 +23,7 @@ type Props = Readonly<{
}>
const PluginsPicker: FC<Props> = ({ updateMode, value, onChange, integrationCategory }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const { data } = useInstalledPluginList()
const pluginCategoryById = useMemo(() => {
return new Map(data?.plugins.map((plugin) => [plugin.plugin_id, plugin.declaration.category]))
diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx
index 25d776e4930..d954cd9b8ed 100644
--- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx
+++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/tool-picker.tsx
@@ -32,7 +32,7 @@ const ToolPicker: FC<Props> = ({
onShowChange,
integrationCategory,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const allTabs = [
{ key: PLUGIN_TYPE_SEARCH_MAP.all, name: t(($) => $['category.all'], { ns: 'plugin' }) },
diff --git a/web/app/components/plugins/update-plugin/downgrade-warning.tsx b/web/app/components/plugins/update-plugin/downgrade-warning.tsx
index 255516c86fe..e7fd7cc0a42 100644
--- a/web/app/components/plugins/update-plugin/downgrade-warning.tsx
+++ b/web/app/components/plugins/update-plugin/downgrade-warning.tsx
@@ -9,7 +9,7 @@ type Props = Readonly<{
onExcludeAndDowngrade: () => void
}>
const DowngradeWarningModal = ({ onCancel, onJustDowngrade, onExcludeAndDowngrade }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'plugin'])
return (
<>
diff --git a/web/app/components/plugins/update-plugin/from-market-place.tsx b/web/app/components/plugins/update-plugin/from-market-place.tsx
index 9683e3e0885..a593c4d5443 100644
--- a/web/app/components/plugins/update-plugin/from-market-place.tsx
+++ b/web/app/components/plugins/update-plugin/from-market-place.tsx
@@ -54,7 +54,7 @@ const UpdatePluginModal = ({
isShowDowngradeWarningModal,
}: Props) => {
const { originalPackageInfo, targetPackageInfo } = payload
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const upgradeButtonLabelId = React.useId()
const { getIconUrl } = useGetIcon()
const [icon, setIcon] = useState<string>(originalPackageInfo.payload.icon)
diff --git a/web/app/components/plugins/update-plugin/plugin-version-picker.tsx b/web/app/components/plugins/update-plugin/plugin-version-picker.tsx
index 3bc8dce0d3d..d7eab7dc3ed 100644
--- a/web/app/components/plugins/update-plugin/plugin-version-picker.tsx
+++ b/web/app/components/plugins/update-plugin/plugin-version-picker.tsx
@@ -41,7 +41,7 @@ const PluginVersionPicker: FC<Props> = ({
alignOffset = 0,
onSelect,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common', 'plugin'])
const format = t(($) => $.dateTimeFormat, { ns: 'appLog' }).split(' ')[0]
const { formatDate } = useTimestamp()
diff --git a/web/app/components/rag-pipeline/components/chunk-card-list/chunk-card.tsx b/web/app/components/rag-pipeline/components/chunk-card-list/chunk-card.tsx
index 6e10ffe4978..aa2102699a3 100644
--- a/web/app/components/rag-pipeline/components/chunk-card-list/chunk-card.tsx
+++ b/web/app/components/rag-pipeline/components/chunk-card-list/chunk-card.tsx
@@ -22,7 +22,7 @@ type ChunkCardProps = {
const ChunkCard = (props: ChunkCardProps) => {
const { chunkType, parentMode, content, positionId, wordCount } = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
const isFullDoc = useMemo(() => {
return chunkType === ChunkingMode.parentChild && parentMode === 'full-doc'
diff --git a/web/app/components/rag-pipeline/components/conversion.tsx b/web/app/components/rag-pipeline/components/conversion.tsx
index d5c06b682bc..720f7470292 100644
--- a/web/app/components/rag-pipeline/components/conversion.tsx
+++ b/web/app/components/rag-pipeline/components/conversion.tsx
@@ -25,7 +25,7 @@ import { getDatasetACLCapabilities } from '@/utils/permission'
import PipelineScreenShot from './screenshot'
const Conversion = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetPipeline'])
const { datasetId } = useParams()
const dataset = useDatasetDetailContextWithSelector((state) => state.dataset)
const { data: currentUserId } = useSuspenseQuery({
diff --git a/web/app/components/rag-pipeline/components/panel/input-field/editor/form/__tests__/schema.spec.ts b/web/app/components/rag-pipeline/components/panel/input-field/editor/form/__tests__/schema.spec.ts
index 8a4c1295a21..18c944fa8b4 100644
--- a/web/app/components/rag-pipeline/components/panel/input-field/editor/form/__tests__/schema.spec.ts
+++ b/web/app/components/rag-pipeline/components/panel/input-field/editor/form/__tests__/schema.spec.ts
@@ -7,7 +7,7 @@ vi.mock('@/config', () => ({
MAX_VAR_KEY_LENGTH: 30,
}))
-const t: TFunction = ((key: string) => key) as unknown as TFunction
+const t: TFunction<['appDebug']> = ((key: string) => key) as unknown as TFunction<['appDebug']>
const defaultOptions = { maxFileUploadLimit: 10 }
diff --git a/web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts b/web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts
index bd3450409fb..4e4c5624e58 100644
--- a/web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts
+++ b/web/app/components/rag-pipeline/components/panel/input-field/editor/form/hooks.ts
@@ -12,7 +12,7 @@ import { formatFileSize } from '@/utils/format'
import { TEXT_MAX_LENGTH } from './schema'
export const useHiddenFieldNames = (type: PipelineInputVarType) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const hiddenFieldNames = useMemo(() => {
let fieldNames = []
switch (type) {
@@ -71,7 +71,7 @@ export const useConfigurations = (props: {
setFieldValue: (fieldName: DeepKeys<FormData>, value: any) => void
supportFile: boolean
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const { getFieldValue, setFieldValue, supportFile } = props
const handleTypeChange = useCallback(
@@ -213,7 +213,7 @@ export const useConfigurations = (props: {
}
export const useHiddenConfigurations = (props: { options: string[] | undefined }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const { options } = props
diff --git a/web/app/components/rag-pipeline/components/panel/input-field/editor/form/index.tsx b/web/app/components/rag-pipeline/components/panel/input-field/editor/form/index.tsx
index 44df9a85807..2acce00d697 100644
--- a/web/app/components/rag-pipeline/components/panel/input-field/editor/form/index.tsx
+++ b/web/app/components/rag-pipeline/components/panel/input-field/editor/form/index.tsx
@@ -21,7 +21,7 @@ const InputFieldForm = ({
onSubmit,
isEditMode = true,
}: InputFieldFormProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const { data: fileUploadConfigResponse } = useFileUploadConfig()
const { maxFileUploadLimit } = useFileSizeLimit(fileUploadConfigResponse)
const inputFieldForm = useAppForm({
diff --git a/web/app/components/rag-pipeline/components/panel/input-field/editor/form/schema.ts b/web/app/components/rag-pipeline/components/panel/input-field/editor/form/schema.ts
index ce7da842faa..6f3e0bf4143 100644
--- a/web/app/components/rag-pipeline/components/panel/input-field/editor/form/schema.ts
+++ b/web/app/components/rag-pipeline/components/panel/input-field/editor/form/schema.ts
@@ -13,7 +13,7 @@ const SupportedFileTypes = z.enum(['image', 'document', 'video', 'audio', 'custo
export const createInputFieldSchema = (
type: PipelineInputVarType,
- t: TFunction,
+ t: TFunction<['appDebug']>,
options: SchemaOptions,
) => {
const { maxFileUploadLimit } = options
diff --git a/web/app/components/rag-pipeline/components/panel/input-field/editor/form/show-all-settings.tsx b/web/app/components/rag-pipeline/components/panel/input-field/editor/form/show-all-settings.tsx
index 7597ac33f47..5cc22a24e82 100644
--- a/web/app/components/rag-pipeline/components/panel/input-field/editor/form/show-all-settings.tsx
+++ b/web/app/components/rag-pipeline/components/panel/input-field/editor/form/show-all-settings.tsx
@@ -14,7 +14,7 @@ const ShowAllSettings = ({ initialData, handleShowAllSettings }: ShowAllSettings
withForm({
defaultValues: initialData,
render: function Render({ form }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const type = useStore(form.store, (state) => state.values.type)
const hiddenFieldNames = useHiddenFieldNames(type)
diff --git a/web/app/components/rag-pipeline/components/panel/input-field/editor/index.tsx b/web/app/components/rag-pipeline/components/panel/input-field/editor/index.tsx
index 8456b314b2d..c45ca6b1856 100644
--- a/web/app/components/rag-pipeline/components/panel/input-field/editor/index.tsx
+++ b/web/app/components/rag-pipeline/components/panel/input-field/editor/index.tsx
@@ -16,7 +16,7 @@ export type InputFieldEditorProps = {
}
const InputFieldEditorPanel = ({ onClose, onSubmit, initialData }: InputFieldEditorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetPipeline'])
const { floatingRight, floatingRightWidth } = useFloatingRight(400)
diff --git a/web/app/components/rag-pipeline/components/panel/input-field/field-list/field-item.tsx b/web/app/components/rag-pipeline/components/panel/input-field/field-list/field-item.tsx
index 4c4cad1602a..9c5821f5442 100644
--- a/web/app/components/rag-pipeline/components/panel/input-field/field-list/field-item.tsx
+++ b/web/app/components/rag-pipeline/components/panel/input-field/field-list/field-item.tsx
@@ -38,7 +38,7 @@ const FieldItem = ({
onMoveUp,
onMoveDown,
}: FieldItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const fieldNameId = useId()
diff --git a/web/app/components/rag-pipeline/components/panel/input-field/field-list/hooks.ts b/web/app/components/rag-pipeline/components/panel/input-field/field-list/hooks.ts
index 8ea4d4a0bd1..6f788267249 100644
--- a/web/app/components/rag-pipeline/components/panel/input-field/field-list/hooks.ts
+++ b/web/app/components/rag-pipeline/components/panel/input-field/field-list/hooks.ts
@@ -23,7 +23,7 @@ export const useFieldList = ({
nodeId,
allVariableNames,
}: useFieldListProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const { toggleInputFieldEditPanel } = useInputFieldPanel()
const [inputFields, setInputFields] = useState<InputVar[]>(initialInputFields)
const inputFieldsRef = useRef<InputVar[]>(inputFields)
diff --git a/web/app/components/rag-pipeline/components/panel/input-field/field-list/index.tsx b/web/app/components/rag-pipeline/components/panel/input-field/field-list/index.tsx
index 05ddb08383f..25c1106c61b 100644
--- a/web/app/components/rag-pipeline/components/panel/input-field/field-list/index.tsx
+++ b/web/app/components/rag-pipeline/components/panel/input-field/field-list/index.tsx
@@ -28,7 +28,7 @@ const FieldList = ({
labelClassName,
allVariableNames,
}: FieldListProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const onInputFieldsChange = useCallback(
(value: InputVar[]) => {
handleInputFieldsChange(nodeId, value)
diff --git a/web/app/components/rag-pipeline/components/panel/input-field/index.tsx b/web/app/components/rag-pipeline/components/panel/input-field/index.tsx
index 7ff20503d5d..2820aae7098 100644
--- a/web/app/components/rag-pipeline/components/panel/input-field/index.tsx
+++ b/web/app/components/rag-pipeline/components/panel/input-field/index.tsx
@@ -22,7 +22,7 @@ import GlobalInputs from './label-right-content/global-inputs'
const InputFieldPanel = () => {
const uniqueInputsLabelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetPipeline'])
const nodes = useNodes<DataSourceNodeType>()
const { closeAllInputFieldPanels, toggleInputFieldPreviewPanel, isPreviewing, isEditing } =
useInputFieldPanel()
diff --git a/web/app/components/rag-pipeline/components/panel/input-field/label-right-content/global-inputs.tsx b/web/app/components/rag-pipeline/components/panel/input-field/label-right-content/global-inputs.tsx
index 925d66c1837..a3fe859e83d 100644
--- a/web/app/components/rag-pipeline/components/panel/input-field/label-right-content/global-inputs.tsx
+++ b/web/app/components/rag-pipeline/components/panel/input-field/label-right-content/global-inputs.tsx
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'
const GlobalInputs = () => {
const titleId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
return (
<div className="flex items-center gap-x-1">
diff --git a/web/app/components/rag-pipeline/components/panel/input-field/preview/data-source.tsx b/web/app/components/rag-pipeline/components/panel/input-field/preview/data-source.tsx
index 6f259b59ffa..84bbb983782 100644
--- a/web/app/components/rag-pipeline/components/panel/input-field/preview/data-source.tsx
+++ b/web/app/components/rag-pipeline/components/panel/input-field/preview/data-source.tsx
@@ -12,7 +12,7 @@ type DatasourceProps = {
}
const DataSource = ({ onSelect: setDatasource, dataSourceNodeId }: DatasourceProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const pipelineId = useStore((state) => state.pipelineId)
const { data: paramsConfig } = useDraftPipelinePreProcessingParams(
{
diff --git a/web/app/components/rag-pipeline/components/panel/input-field/preview/index.tsx b/web/app/components/rag-pipeline/components/panel/input-field/preview/index.tsx
index f5bb6a269f3..3181a7bc7a1 100644
--- a/web/app/components/rag-pipeline/components/panel/input-field/preview/index.tsx
+++ b/web/app/components/rag-pipeline/components/panel/input-field/preview/index.tsx
@@ -11,7 +11,7 @@ import DataSource from './data-source'
import ProcessDocuments from './process-documents'
const PreviewPanel = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const [datasource, setDatasource] = useState<Datasource>()
const { toggleInputFieldPreviewPanel } = useInputFieldPanel()
diff --git a/web/app/components/rag-pipeline/components/panel/input-field/preview/process-documents.tsx b/web/app/components/rag-pipeline/components/panel/input-field/preview/process-documents.tsx
index c22db79e1a7..8ac1caed240 100644
--- a/web/app/components/rag-pipeline/components/panel/input-field/preview/process-documents.tsx
+++ b/web/app/components/rag-pipeline/components/panel/input-field/preview/process-documents.tsx
@@ -9,7 +9,7 @@ type ProcessDocumentsProps = {
}
const ProcessDocuments = ({ dataSourceNodeId }: ProcessDocumentsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const pipelineId = useStore((state) => state.pipelineId)
const { data: paramsConfig } = useDraftPipelineProcessingParams(
{
diff --git a/web/app/components/rag-pipeline/components/panel/test-run/header.tsx b/web/app/components/rag-pipeline/components/panel/test-run/header.tsx
index 2d3bfa98a06..4f9ea601b80 100644
--- a/web/app/components/rag-pipeline/components/panel/test-run/header.tsx
+++ b/web/app/components/rag-pipeline/components/panel/test-run/header.tsx
@@ -9,7 +9,7 @@ import { useWorkflowStore } from '@/app/components/workflow/store'
const Header = () => {
const workflowStore = useWorkflowStore()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetPipeline'])
const { handleCancelDebugAndPreviewPanel } = useWorkflowInteractions()
const handleClose = useCallback(() => {
diff --git a/web/app/components/rag-pipeline/components/panel/test-run/preparation/actions/index.tsx b/web/app/components/rag-pipeline/components/panel/test-run/preparation/actions/index.tsx
index cea2b37a886..d7d6b1491b0 100644
--- a/web/app/components/rag-pipeline/components/panel/test-run/preparation/actions/index.tsx
+++ b/web/app/components/rag-pipeline/components/panel/test-run/preparation/actions/index.tsx
@@ -8,7 +8,7 @@ type ActionsProps = {
}
const Actions = ({ disabled, handleNextStep }: ActionsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
return (
<div className="flex justify-end p-4 pt-2">
diff --git a/web/app/components/rag-pipeline/components/panel/test-run/preparation/data-source-options/index.tsx b/web/app/components/rag-pipeline/components/panel/test-run/preparation/data-source-options/index.tsx
index ee8ce98e761..e7996955cd8 100644
--- a/web/app/components/rag-pipeline/components/panel/test-run/preparation/data-source-options/index.tsx
+++ b/web/app/components/rag-pipeline/components/panel/test-run/preparation/data-source-options/index.tsx
@@ -12,7 +12,7 @@ type DataSourceOptionsProps = {
const DataSourceOptions = ({ dataSourceNodeId, onSelect }: DataSourceOptionsProps) => {
const options = useDatasourceOptions()
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const handelSelect = useCallback(
(value: string) => {
diff --git a/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/actions.tsx b/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/actions.tsx
index ee74a748d45..ae739724b8f 100644
--- a/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/actions.tsx
+++ b/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/actions.tsx
@@ -12,7 +12,7 @@ type ActionsProps = {
}
const Actions = ({ formParams, runDisabled, onBack }: ActionsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const { form, isSubmitting, canSubmit } = formParams
const workflowRunningData = useStore((s) => s.workflowRunningData)
const isRunning = workflowRunningData?.result.status === WorkflowRunningStatus.Running
diff --git a/web/app/components/rag-pipeline/components/panel/test-run/preparation/footer-tips.tsx b/web/app/components/rag-pipeline/components/panel/test-run/preparation/footer-tips.tsx
index ff622a31cd4..fb605e4be3f 100644
--- a/web/app/components/rag-pipeline/components/panel/test-run/preparation/footer-tips.tsx
+++ b/web/app/components/rag-pipeline/components/panel/test-run/preparation/footer-tips.tsx
@@ -2,7 +2,7 @@ import * as React from 'react'
import { useTranslation } from 'react-i18next'
const FooterTips = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
return (
<div className="flex grow flex-col justify-end p-4 pt-2 system-xs-regular text-text-tertiary">
diff --git a/web/app/components/rag-pipeline/components/panel/test-run/preparation/hooks.ts b/web/app/components/rag-pipeline/components/panel/test-run/preparation/hooks.ts
index e7a11de79c5..f4bbf57ba51 100644
--- a/web/app/components/rag-pipeline/components/panel/test-run/preparation/hooks.ts
+++ b/web/app/components/rag-pipeline/components/panel/test-run/preparation/hooks.ts
@@ -9,7 +9,7 @@ import { CrawlStep } from '@/models/datasets'
import { TestRunStep } from '../types'
export const useTestRunSteps = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const [currentStep, setCurrentStep] = useState(1)
const handleNextStep = useCallback(() => {
diff --git a/web/app/components/rag-pipeline/components/panel/test-run/result/result-preview/index.tsx b/web/app/components/rag-pipeline/components/panel/test-run/result/result-preview/index.tsx
index 362190468f7..73011bec0c0 100644
--- a/web/app/components/rag-pipeline/components/panel/test-run/result/result-preview/index.tsx
+++ b/web/app/components/rag-pipeline/components/panel/test-run/result/result-preview/index.tsx
@@ -15,7 +15,7 @@ type ResultTextProps = {
}
const ResultPreview = ({ isRunning, outputs, error, onSwitchToDetail }: ResultTextProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['pipeline'])
const previewChunks = useMemo(() => {
return formatPreviewChunks(outputs)
diff --git a/web/app/components/rag-pipeline/components/panel/test-run/result/tabs/index.tsx b/web/app/components/rag-pipeline/components/panel/test-run/result/tabs/index.tsx
index 87b8e611061..53d27a8c863 100644
--- a/web/app/components/rag-pipeline/components/panel/test-run/result/tabs/index.tsx
+++ b/web/app/components/rag-pipeline/components/panel/test-run/result/tabs/index.tsx
@@ -7,7 +7,7 @@ type TabsProps = {
}
const Tabs = ({ workflowRunningData }: TabsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline', 'runLog'])
const tabs = [
{ value: 'RESULT', label: t(($) => $.result, { ns: 'runLog' }) },
{ value: 'DETAIL', label: t(($) => $.detail, { ns: 'runLog' }) },
diff --git a/web/app/components/rag-pipeline/components/publish-as-knowledge-pipeline-modal.tsx b/web/app/components/rag-pipeline/components/publish-as-knowledge-pipeline-modal.tsx
index 4f3f051d6dd..a54ea04537e 100644
--- a/web/app/components/rag-pipeline/components/publish-as-knowledge-pipeline-modal.tsx
+++ b/web/app/components/rag-pipeline/components/publish-as-knowledge-pipeline-modal.tsx
@@ -23,7 +23,7 @@ const PublishAsKnowledgePipelineModal = ({
onCancel,
onConfirm,
}: PublishAsKnowledgePipelineModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'pipeline', 'workflow'])
const workflowStore = useWorkflowStore()
const [pipelineName, setPipelineName] = useState(() => workflowStore.getState().knowledgeName!)
const [pipelineIcon, setPipelineIcon] = useState(() => workflowStore.getState().knowledgeIcon!)
diff --git a/web/app/components/rag-pipeline/components/publish-toast.tsx b/web/app/components/rag-pipeline/components/publish-toast.tsx
index 5d846e3ce25..9f238e35f0a 100644
--- a/web/app/components/rag-pipeline/components/publish-toast.tsx
+++ b/web/app/components/rag-pipeline/components/publish-toast.tsx
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'
import { useStore } from '@/app/components/workflow/store'
const PublishToast = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'pipeline'])
const publishedAt = useStore((s) => s.publishedAt)
const [hideToast, setHideToast] = useState(false)
diff --git a/web/app/components/rag-pipeline/components/rag-pipeline-header/input-field-button.tsx b/web/app/components/rag-pipeline/components/rag-pipeline-header/input-field-button.tsx
index f2ee9687f32..2fd7aafebd9 100644
--- a/web/app/components/rag-pipeline/components/rag-pipeline-header/input-field-button.tsx
+++ b/web/app/components/rag-pipeline/components/rag-pipeline-header/input-field-button.tsx
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'
import { useStore } from '@/app/components/workflow/store'
const InputFieldButton = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline'])
const setShowInputFieldPanel = useStore((state) => state.setShowInputFieldPanel)
const setShowEnvPanel = useStore((state) => state.setShowEnvPanel)
const handleClick = useCallback(() => {
diff --git a/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/index.tsx b/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/index.tsx
index 96e5ba3e363..d97c96fbe32 100644
--- a/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/index.tsx
+++ b/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/index.tsx
@@ -20,7 +20,7 @@ import PublishAsKnowledgePipelineModal from '../../publish-as-knowledge-pipeline
import { Popup } from './popup'
const Publisher = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetPipeline', 'workflow'])
const [open, setOpen] = useState(false)
const [confirmVisible, { setFalse: hideConfirm, setTrue: showConfirm }] = useBoolean(false)
const { handleSyncWorkflowDraft } = useNodesSyncDraft()
diff --git a/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/popup.tsx b/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/popup.tsx
index 9cc3979cc9f..e1ab4f1f75f 100644
--- a/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/popup.tsx
+++ b/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/popup.tsx
@@ -65,7 +65,7 @@ export function Popup({
isPublishingAsCustomizedPipeline = false,
onShowPublishAsKnowledgePipelineModal,
}: PopupProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'common', 'datasetPipeline', 'pipeline', 'workflow'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/rag-pipeline/components/rag-pipeline-header/run-mode.tsx b/web/app/components/rag-pipeline/components/rag-pipeline-header/run-mode.tsx
index 9dfd5f2b32f..8f17a5067ee 100644
--- a/web/app/components/rag-pipeline/components/rag-pipeline-header/run-mode.tsx
+++ b/web/app/components/rag-pipeline/components/rag-pipeline-header/run-mode.tsx
@@ -18,7 +18,7 @@ type RunModeProps = {
}
export function RunMode({ text }: RunModeProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'pipeline', 'workflow'])
const { handleWorkflowStartRunInWorkflow } = useWorkflowStartRun()
const { handleStopRun } = useWorkflowRun()
const workflowStore = useWorkflowStore()
diff --git a/web/app/components/rag-pipeline/components/update-dsl-modal.tsx b/web/app/components/rag-pipeline/components/update-dsl-modal.tsx
index 15597e8267d..861839c37fd 100644
--- a/web/app/components/rag-pipeline/components/update-dsl-modal.tsx
+++ b/web/app/components/rag-pipeline/components/update-dsl-modal.tsx
@@ -16,7 +16,7 @@ type UpdateDSLModalProps = {
}
const UpdateDSLModal = ({ onCancel, onBackup, onImport }: UpdateDSLModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common', 'workflow'])
const {
currentFile,
handleFile,
diff --git a/web/app/components/rag-pipeline/components/version-mismatch-modal.tsx b/web/app/components/rag-pipeline/components/version-mismatch-modal.tsx
index aa30f516017..c9fb8d93dae 100644
--- a/web/app/components/rag-pipeline/components/version-mismatch-modal.tsx
+++ b/web/app/components/rag-pipeline/components/version-mismatch-modal.tsx
@@ -26,7 +26,7 @@ const VersionMismatchModal = ({
onClose,
onConfirm,
}: VersionMismatchModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
return (
<AlertDialog
diff --git a/web/app/components/rag-pipeline/hooks/use-DSL.ts b/web/app/components/rag-pipeline/hooks/use-DSL.ts
index 30db16c2beb..e9f16c59f4f 100644
--- a/web/app/components/rag-pipeline/hooks/use-DSL.ts
+++ b/web/app/components/rag-pipeline/hooks/use-DSL.ts
@@ -13,7 +13,7 @@ import { useNodesSyncDraftByCanEdit } from './use-nodes-sync-draft'
type DoSyncWorkflowDraft = ReturnType<typeof useNodesSyncDraft>['doSyncWorkflowDraft']
const useDSLBase = (doSyncWorkflowDraft: DoSyncWorkflowDraft) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const { eventEmitter } = useEventEmitterContextContext()
const [exporting, setExporting] = useState(false)
const workflowStore = useWorkflowStore()
diff --git a/web/app/components/rag-pipeline/hooks/use-available-nodes-meta-data.ts b/web/app/components/rag-pipeline/hooks/use-available-nodes-meta-data.ts
index 3c7ebfefe34..b2db4a8fcd1 100644
--- a/web/app/components/rag-pipeline/hooks/use-available-nodes-meta-data.ts
+++ b/web/app/components/rag-pipeline/hooks/use-available-nodes-meta-data.ts
@@ -10,7 +10,7 @@ import { useDocLink } from '@/context/i18n'
import { isAgentV2Enabled } from '@/features/agent-v2/feature-flag'
export const useAvailableNodesMetaData = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const docLink = useDocLink()
const agentV2Enabled = isAgentV2Enabled()
diff --git a/web/app/components/rag-pipeline/hooks/use-pipeline-template.ts b/web/app/components/rag-pipeline/hooks/use-pipeline-template.ts
index 20cadef72e6..ad655c1b0db 100644
--- a/web/app/components/rag-pipeline/hooks/use-pipeline-template.ts
+++ b/web/app/components/rag-pipeline/hooks/use-pipeline-template.ts
@@ -5,7 +5,7 @@ import knowledgeBaseDefault from '@/app/components/workflow/nodes/knowledge-base
import { generateNewNode } from '@/app/components/workflow/utils'
export const usePipelineTemplate = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { newNode: knowledgeBaseNode } = generateNewNode({
id: 'knowledgeBase',
diff --git a/web/app/components/rag-pipeline/hooks/use-update-dsl-modal.ts b/web/app/components/rag-pipeline/hooks/use-update-dsl-modal.ts
index c5691fdb755..f601fbe9ae5 100644
--- a/web/app/components/rag-pipeline/hooks/use-update-dsl-modal.ts
+++ b/web/app/components/rag-pipeline/hooks/use-update-dsl-modal.ts
@@ -44,7 +44,7 @@ const getImportErrorMessage = async (error: unknown): Promise<string | undefined
return undefined
}
export const useUpdateDSLModal = ({ onCancel, onImport }: UseUpdateDSLModalParams) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { eventEmitter } = useEventEmitterContextContext()
const workflowStore = useWorkflowStore()
const { handleCheckPluginDependencies } = usePluginDependencies()
diff --git a/web/app/components/share/text-generation/hooks/use-text-generation-app-state.ts b/web/app/components/share/text-generation/hooks/use-text-generation-app-state.ts
index dcda05c3407..b88517eab1d 100644
--- a/web/app/components/share/text-generation/hooks/use-text-generation-app-state.ts
+++ b/web/app/components/share/text-generation/hooks/use-text-generation-app-state.ts
@@ -78,7 +78,7 @@ export const useTextGenerationAppState = ({
isInstalledApp,
isWorkflow,
}: UseTextGenerationAppStateOptions) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'share'])
const appSourceType = isInstalledApp ? AppSourceType.installedApp : AppSourceType.webApp
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const appData = useWebAppStore((s) => s.appInfo)
diff --git a/web/app/components/share/text-generation/index.tsx b/web/app/components/share/text-generation/index.tsx
index 49530a88fb9..840b3c6d599 100644
--- a/web/app/components/share/text-generation/index.tsx
+++ b/web/app/components/share/text-generation/index.tsx
@@ -20,7 +20,7 @@ type IMainProps = {
isWorkflow?: boolean
}
const TextGeneration: FC<IMainProps> = ({ isInstalledApp = false, isWorkflow = false }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share', 'appDebug', 'common'])
const translateBatchKey: TextGenerationTranslate = useCallback(
(selector, options) => {
return t(selector, options)
diff --git a/web/app/components/share/text-generation/info-modal.tsx b/web/app/components/share/text-generation/info-modal.tsx
index 08144666901..214be481d9e 100644
--- a/web/app/components/share/text-generation/info-modal.tsx
+++ b/web/app/components/share/text-generation/info-modal.tsx
@@ -14,7 +14,7 @@ type Props = Readonly<{
}>
const InfoModal = ({ isShow, onClose, data }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [currentYear] = React.useState(() => new Date().getFullYear())
return (
diff --git a/web/app/components/share/text-generation/menu-dropdown.tsx b/web/app/components/share/text-generation/menu-dropdown.tsx
index b4845e63212..ec031d44dc9 100644
--- a/web/app/components/share/text-generation/menu-dropdown.tsx
+++ b/web/app/components/share/text-generation/menu-dropdown.tsx
@@ -33,7 +33,7 @@ const MenuDropdown: FC<Props> = ({ data, placement, hideLogout }) => {
const webAppAccessMode = useWebAppStore((s) => s.webAppAccessMode)
const router = useRouter()
const pathname = usePathname()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'share'])
const handleLogout = async () => {
await webAppLogout(resolveWebAppAddress())
diff --git a/web/app/components/share/text-generation/no-data/index.tsx b/web/app/components/share/text-generation/no-data/index.tsx
index 23505e7f12b..9bb4ec542bd 100644
--- a/web/app/components/share/text-generation/no-data/index.tsx
+++ b/web/app/components/share/text-generation/no-data/index.tsx
@@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'
type INoDataProps = {}
const NoData: FC<INoDataProps> = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
return (
<div className="flex size-full flex-col items-center justify-center">
<RiSparklingFill className="size-12 text-text-empty-state-icon" />
diff --git a/web/app/components/share/text-generation/result/index.tsx b/web/app/components/share/text-generation/result/index.tsx
index c4e10f664e0..6241ee9adec 100644
--- a/web/app/components/share/text-generation/result/index.tsx
+++ b/web/app/components/share/text-generation/result/index.tsx
@@ -73,7 +73,7 @@ const Result: FC<IResultProps> = ({
onRunControlChange,
hideInlineStopButton = false,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'share'])
const translateResultKey = useCallback<TextGenerationTranslate>(
(selector, options) => t(selector, options),
[t],
diff --git a/web/app/components/share/text-generation/run-batch/csv-download/index.tsx b/web/app/components/share/text-generation/run-batch/csv-download/index.tsx
index cb7f2a23d4c..51bcf5ec4c0 100644
--- a/web/app/components/share/text-generation/run-batch/csv-download/index.tsx
+++ b/web/app/components/share/text-generation/run-batch/csv-download/index.tsx
@@ -9,7 +9,7 @@ type ICSVDownloadProps = {
}
const CSVDownload: FC<ICSVDownloadProps> = ({ vars }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
const { CSVDownloader, Type } = useCSVDownloader()
const addQueryContentVars = [...vars]
const template = (() => {
diff --git a/web/app/components/share/text-generation/run-batch/csv-reader/index.tsx b/web/app/components/share/text-generation/run-batch/csv-reader/index.tsx
index 283a542967d..f1b435d94b6 100644
--- a/web/app/components/share/text-generation/run-batch/csv-reader/index.tsx
+++ b/web/app/components/share/text-generation/run-batch/csv-reader/index.tsx
@@ -11,7 +11,7 @@ type Props = Readonly<{
}>
const CSVReader: FC<Props> = ({ onParsed }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
const { CSVReader } = useCSVReader()
const [zoneHover, setZoneHover] = useState(false)
return (
diff --git a/web/app/components/share/text-generation/run-batch/index.tsx b/web/app/components/share/text-generation/run-batch/index.tsx
index 039573ea305..e302bef5eab 100644
--- a/web/app/components/share/text-generation/run-batch/index.tsx
+++ b/web/app/components/share/text-generation/run-batch/index.tsx
@@ -16,7 +16,7 @@ type IRunBatchProps = {
}
const RunBatch: FC<IRunBatchProps> = ({ vars, onSend, isAllFinished }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
const media = useBreakpoints()
const isPC = media === MediaType.pc
diff --git a/web/app/components/share/text-generation/run-batch/res-download/index.tsx b/web/app/components/share/text-generation/run-batch/res-download/index.tsx
index 4235cb4191d..bbfa02da1f0 100644
--- a/web/app/components/share/text-generation/run-batch/res-download/index.tsx
+++ b/web/app/components/share/text-generation/run-batch/res-download/index.tsx
@@ -13,7 +13,7 @@ type IResDownloadProps = {
}
const ResDownload: FC<IResDownloadProps> = ({ isMobile, values }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { CSVDownloader, Type } = useCSVDownloader()
return (
diff --git a/web/app/components/share/text-generation/run-once/index.tsx b/web/app/components/share/text-generation/run-once/index.tsx
index dc5cd06d810..3495d5416ea 100644
--- a/web/app/components/share/text-generation/run-once/index.tsx
+++ b/web/app/components/share/text-generation/run-once/index.tsx
@@ -53,7 +53,7 @@ const RunOnce: FC<IRunOnceProps> = ({
onVisionFilesChange,
runControl,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'share', 'workflow'])
const baseId = useId()
const media = useBreakpoints()
const isPC = media === MediaType.pc
diff --git a/web/app/components/share/text-generation/text-generation-result-panel.tsx b/web/app/components/share/text-generation/text-generation-result-panel.tsx
index 69c378306b4..d612d115c2d 100644
--- a/web/app/components/share/text-generation/text-generation-result-panel.tsx
+++ b/web/app/components/share/text-generation/text-generation-result-panel.tsx
@@ -76,7 +76,7 @@ const TextGenerationResultPanel: FC<TextGenerationResultPanelProps> = ({
textToSpeechEnabled,
visionConfig,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
const renderResult = (task?: Task) => (
<Res
diff --git a/web/app/components/share/text-generation/text-generation-sidebar.tsx b/web/app/components/share/text-generation/text-generation-sidebar.tsx
index d343a327ed4..d963f5a2e7c 100644
--- a/web/app/components/share/text-generation/text-generation-sidebar.tsx
+++ b/web/app/components/share/text-generation/text-generation-sidebar.tsx
@@ -70,7 +70,7 @@ const TextGenerationSidebar: FC<TextGenerationSidebarProps> = ({
textToSpeechConfig,
visionConfig,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
const [descExpanded, setDescExpanded] = useState(false)
const [showDescToggle, setShowDescToggle] = useState(false)
const handleDescRef = useCallback((node: HTMLDivElement | null) => {
diff --git a/web/app/components/share/text-generation/types.ts b/web/app/components/share/text-generation/types.ts
index 17aa43c57a0..3899669a754 100644
--- a/web/app/components/share/text-generation/types.ts
+++ b/web/app/components/share/text-generation/types.ts
@@ -1,7 +1,10 @@
-import type { Namespace, SelectorParam } from 'i18next'
+import type { SelectorParam } from 'i18next'
import type { FileEntity } from '@/app/components/base/file-uploader/types'
-export type TextGenerationTranslate = <Ns extends Namespace, Selector extends SelectorParam<Ns>>(
+export type TextGenerationTranslate = <
+ Ns extends 'appDebug' | 'common' | 'share',
+ Selector extends SelectorParam<Ns>,
+>(
selector: Selector,
options: { ns: Ns } & Record<string, unknown>,
) => string
diff --git a/web/app/components/signin/countdown.tsx b/web/app/components/signin/countdown.tsx
index a987b6acae6..f913f8e3938 100644
--- a/web/app/components/signin/countdown.tsx
+++ b/web/app/components/signin/countdown.tsx
@@ -28,7 +28,7 @@ export default function Countdown({
}
function CountdownFallback() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
return (
<p className="system-xs-regular text-text-tertiary">
@@ -40,7 +40,7 @@ function CountdownFallback() {
function CountdownContent({ onResend, resendDisabled, restartOnResend }: CountdownProps) {
use(browser())
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const storedLeftTime = useCountdownLeftTimeValue()
const setStoredLeftTime = useSetCountdownLeftTime()
const [leftTime, setLeftTime] = useState(() => Number(storedLeftTime || COUNT_DOWN_TIME_MS))
diff --git a/web/app/components/snippet-list/components/snippet-card.tsx b/web/app/components/snippet-list/components/snippet-card.tsx
index c267d65a471..6ed874d41dc 100644
--- a/web/app/components/snippet-list/components/snippet-card.tsx
+++ b/web/app/components/snippet-list/components/snippet-card.tsx
@@ -52,8 +52,8 @@ const SnippetCard = ({
onRefresh,
onTagsChange,
}: Props) => {
- const { t } = useTranslation('snippet')
- const { t: tCommon } = useTranslation()
+ const { t } = useTranslation(['snippet', 'datasetDocuments'])
+ const { t: tCommon } = useTranslation(['common'])
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
const { data: membersData } = useMembers()
const [isOperationsMenuOpen, setIsOperationsMenuOpen] = useState(false)
diff --git a/web/app/components/snippet-list/components/snippet-create-button.tsx b/web/app/components/snippet-list/components/snippet-create-button.tsx
index 39f539d961b..97b351df208 100644
--- a/web/app/components/snippet-list/components/snippet-create-button.tsx
+++ b/web/app/components/snippet-list/components/snippet-create-button.tsx
@@ -9,7 +9,7 @@ import { useCreateSnippet } from '@/app/components/snippets/hooks/use-create-sni
import ImportSnippetDSLDialog from '@/app/components/snippets/import-snippet-dsl-dialog'
const SnippetCreateButton = () => {
- const { t } = useTranslation('snippet')
+ const { t } = useTranslation(['snippet'])
const {
canCreateAndModifySnippet,
createSnippetMutation,
diff --git a/web/app/components/snippet-list/components/snippet-publish-status-filter.tsx b/web/app/components/snippet-list/components/snippet-publish-status-filter.tsx
index 5b825c9eeea..adcc2a6691b 100644
--- a/web/app/components/snippet-list/components/snippet-publish-status-filter.tsx
+++ b/web/app/components/snippet-list/components/snippet-publish-status-filter.tsx
@@ -23,7 +23,7 @@ const chipClassName =
'flex h-8 items-center rounded-lg border-[0.5px] px-2 text-[13px] leading-4 outline-hidden transition-colors focus-visible:ring-2 focus-visible:ring-state-accent-solid'
const SnippetPublishStatusFilter = ({ value, onChange }: SnippetPublishStatusFilterProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'snippet', 'workflow'])
const options = useMemo(
() =>
diff --git a/web/app/components/snippet-list/index.tsx b/web/app/components/snippet-list/index.tsx
index 3525e97f5d6..914d469bf7b 100644
--- a/web/app/components/snippet-list/index.tsx
+++ b/web/app/components/snippet-list/index.tsx
@@ -70,7 +70,7 @@ const SnippetCardSkeleton = ({ count }: SnippetCardSkeletonProps) => {
}
const SnippetList = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const isLoadingCurrentWorkspace = useAtomValue(currentWorkspaceLoadingAtom)
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
// oxlint-disable-next-line eslint-react/use-state -- custom URL query hook, not React.useState
diff --git a/web/app/components/snippets/components/hooks/use-snippet-dsl.ts b/web/app/components/snippets/components/hooks/use-snippet-dsl.ts
index d1fffa7f1e7..ba376b6de4d 100644
--- a/web/app/components/snippets/components/hooks/use-snippet-dsl.ts
+++ b/web/app/components/snippets/components/hooks/use-snippet-dsl.ts
@@ -10,7 +10,7 @@ type UseSnippetDSLOptions = {
}
export const useSnippetDSL = ({ snippetId, snippetName }: UseSnippetDSLOptions) => {
- const { t } = useTranslation('snippet')
+ const { t } = useTranslation(['snippet'])
const exportSnippetMutation = useExportSnippetMutation()
const handleExportDSL = useCallback(
diff --git a/web/app/components/snippets/components/hooks/use-snippet-publish.ts b/web/app/components/snippets/components/hooks/use-snippet-publish.ts
index c7f15fdb04c..7d5be9f1861 100644
--- a/web/app/components/snippets/components/hooks/use-snippet-publish.ts
+++ b/web/app/components/snippets/components/hooks/use-snippet-publish.ts
@@ -14,7 +14,7 @@ type UseSnippetPublishOptions = {
}
export const useSnippetPublish = ({ snippetId }: UseSnippetPublishOptions) => {
- const { t } = useTranslation('snippet')
+ const { t } = useTranslation(['snippet'])
const workflowStore = useWorkflowStore()
const queryClient = useQueryClient()
const publishSnippetMutation = usePublishSnippetWorkflowMutation(snippetId)
diff --git a/web/app/components/snippets/components/snippet-collapsed-preview.tsx b/web/app/components/snippets/components/snippet-collapsed-preview.tsx
index af82d2ffd43..4003da095c5 100644
--- a/web/app/components/snippets/components/snippet-collapsed-preview.tsx
+++ b/web/app/components/snippets/components/snippet-collapsed-preview.tsx
@@ -12,7 +12,7 @@ export function SnippetCollapsedPreview({
inputFieldCount: number
snippetId?: string
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['snippet'])
const sectionLabel = t(($) => $.sectionOrchestrate, { ns: 'snippet' })
return (
diff --git a/web/app/components/snippets/components/snippet-detail-top.tsx b/web/app/components/snippets/components/snippet-detail-top.tsx
index a31e304b4b2..8064b778392 100644
--- a/web/app/components/snippets/components/snippet-detail-top.tsx
+++ b/web/app/components/snippets/components/snippet-detail-top.tsx
@@ -25,7 +25,7 @@ type SnippetDetailTopProps = {
}
export function SnippetDetailTop({ expand = true, onToggle }: SnippetDetailTopProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common', 'workflow'])
const router = useRouter()
if (!expand) {
diff --git a/web/app/components/snippets/components/snippet-header/index.tsx b/web/app/components/snippets/components/snippet-header/index.tsx
index 47b2dcf8385..978ff390b4f 100644
--- a/web/app/components/snippets/components/snippet-header/index.tsx
+++ b/web/app/components/snippets/components/snippet-header/index.tsx
@@ -20,7 +20,7 @@ const PublishAction = ({
isPublishing,
onPublish,
}: Pick<SnippetHeaderProps, 'canSave' | 'isPublishing' | 'onPublish'>) => {
- const { t } = useTranslation('snippet')
+ const { t } = useTranslation(['snippet'])
return (
<Button variant="primary" loading={isPublishing} disabled={!canSave} onClick={onPublish}>
@@ -36,7 +36,7 @@ const SnippetHeader = ({
isPublishing,
onPublish,
}: SnippetHeaderProps) => {
- const { t } = useTranslation('snippet')
+ const { t } = useTranslation(['snippet'])
const viewHistoryProps = useMemo(() => {
return {
historyUrl: `/snippets/${snippetId}/workflow-runs`,
diff --git a/web/app/components/snippets/components/snippet-header/run-mode.tsx b/web/app/components/snippets/components/snippet-header/run-mode.tsx
index 756b50e50be..fb72079a209 100644
--- a/web/app/components/snippets/components/snippet-header/run-mode.tsx
+++ b/web/app/components/snippets/components/snippet-header/run-mode.tsx
@@ -18,7 +18,7 @@ type RunModeProps = {
}
const RunMode = ({ text }: RunModeProps) => {
- const { t } = useTranslation('snippet')
+ const { t } = useTranslation(['snippet', 'workflow'])
const { handleWorkflowStartRunInWorkflow } = useWorkflowStartRun()
const { handleStopRun } = useWorkflowRun()
const workflowRunningData = useStore((s) => s.workflowRunningData)
diff --git a/web/app/components/snippets/components/snippet-layout.tsx b/web/app/components/snippets/components/snippet-layout.tsx
index d6a6faf9249..4bccb2f8852 100644
--- a/web/app/components/snippets/components/snippet-layout.tsx
+++ b/web/app/components/snippets/components/snippet-layout.tsx
@@ -13,7 +13,7 @@ type SnippetLayoutProps = {
}
const SnippetLayout = ({ children, snippet }: SnippetLayoutProps) => {
- const { t } = useTranslation('snippet')
+ const { t } = useTranslation(['snippet'])
useDocumentTitle(snippet?.name || t(($) => $.typeLabel))
diff --git a/web/app/components/snippets/components/snippet-main.tsx b/web/app/components/snippets/components/snippet-main.tsx
index 37c2946ed4e..7d3495fde9c 100644
--- a/web/app/components/snippets/components/snippet-main.tsx
+++ b/web/app/components/snippets/components/snippet-main.tsx
@@ -81,7 +81,7 @@ const SnippetMainContent = ({
onBeforePublish,
onSaved,
}: SnippetMainContentProps) => {
- const { t } = useTranslation('snippet')
+ const { t } = useTranslation(['snippet'])
const { handlePublish, isPublishing } = useSnippetPublish({
snippetId,
})
diff --git a/web/app/components/snippets/components/snippet-run-panel.tsx b/web/app/components/snippets/components/snippet-run-panel.tsx
index 46d08e7ee14..9adf780bddb 100644
--- a/web/app/components/snippets/components/snippet-run-panel.tsx
+++ b/web/app/components/snippets/components/snippet-run-panel.tsx
@@ -68,7 +68,7 @@ const buildInitialInputs = (fields: SnippetRunField[]) => {
}
const SnippetRunPanel = ({ fields }: SnippetRunPanelProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'runLog', 'workflow'])
const panelId = useId()
const { handleCancelDebugAndPreviewPanel } = useWorkflowInteractions()
const { handleRun } = useWorkflowRun()
diff --git a/web/app/components/snippets/components/snippet-sidebar.tsx b/web/app/components/snippets/components/snippet-sidebar.tsx
index 15abe36339e..207badc1591 100644
--- a/web/app/components/snippets/components/snippet-sidebar.tsx
+++ b/web/app/components/snippets/components/snippet-sidebar.tsx
@@ -44,7 +44,7 @@ export const SnippetSidebarContent = ({
onFieldsChange,
className,
}: SnippetSidebarContentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'snippet'])
const [isShowAddVarModal, setIsShowAddVarModal] = useState(false)
const workflowInputVars = useMemo(() => fields.map(toWorkflowInputVar), [fields])
diff --git a/web/app/components/snippets/create-snippet-dialog.tsx b/web/app/components/snippets/create-snippet-dialog.tsx
index bceabe361bd..d9bcc877c2e 100644
--- a/web/app/components/snippets/create-snippet-dialog.tsx
+++ b/web/app/components/snippets/create-snippet-dialog.tsx
@@ -62,7 +62,7 @@ export function CreateSnippetDialog({
}: CreateSnippetDialogProps) {
const nameInputId = useId()
const descriptionInputId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const popupRef = useRef<HTMLDivElement>(null)
const nameInputRef = useRef<HTMLInputElement>(null)
const [name, setName] = useState(initialValue?.name ?? '')
diff --git a/web/app/components/snippets/hooks/use-create-snippet-from-selection.tsx b/web/app/components/snippets/hooks/use-create-snippet-from-selection.tsx
index cbdcaf2a49d..5a87906e7dc 100644
--- a/web/app/components/snippets/hooks/use-create-snippet-from-selection.tsx
+++ b/web/app/components/snippets/hooks/use-create-snippet-from-selection.tsx
@@ -282,7 +282,7 @@ export const useCreateSnippetFromSelection = ({
selectedNodes,
onClose,
}: UseCreateSnippetFromSelectionParams) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [selectedSnippetGraph, setSelectedSnippetGraph] = useState<SnippetCanvasData>()
const [selectedSnippetInputFields, setSelectedSnippetInputFields] = useState<SnippetInputField[]>(
[],
diff --git a/web/app/components/snippets/hooks/use-create-snippet.ts b/web/app/components/snippets/hooks/use-create-snippet.ts
index 40e52393d00..c179fb7fb38 100644
--- a/web/app/components/snippets/hooks/use-create-snippet.ts
+++ b/web/app/components/snippets/hooks/use-create-snippet.ts
@@ -10,7 +10,7 @@ import { useCreateSnippetMutation } from '@/service/use-snippets'
import { canCreateAndModifySnippets } from '../utils/permission'
export const useCreateSnippet = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { push } = useRouter()
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
const createSnippetMutation = useCreateSnippetMutation()
diff --git a/web/app/components/snippets/import-snippet-dsl-dialog.tsx b/web/app/components/snippets/import-snippet-dsl-dialog.tsx
index 6b113aed6d9..4fa303f9bd5 100644
--- a/web/app/components/snippets/import-snippet-dsl-dialog.tsx
+++ b/web/app/components/snippets/import-snippet-dsl-dialog.tsx
@@ -61,7 +61,7 @@ function SnippetDSLConfirmDialog({
onCancel: () => void
onConfirm: MouseEventHandler
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'snippet'])
return (
<AlertDialog
@@ -107,7 +107,7 @@ function SnippetDSLConfirmDialog({
function ImportSnippetDSLDialog({ isOpen, onClose }: ImportSnippetDSLDialogProps) {
const dslUrlInputId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'snippet'])
const { push } = useRouter()
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
const canCreateAndModifySnippet = canCreateAndModifySnippets(workspacePermissionKeys)
diff --git a/web/app/components/step-by-step-tour/mount.tsx b/web/app/components/step-by-step-tour/mount.tsx
index 15c652c0865..b2ddc634c76 100644
--- a/web/app/components/step-by-step-tour/mount.tsx
+++ b/web/app/components/step-by-step-tour/mount.tsx
@@ -151,7 +151,7 @@ export default function StepByStepTourMount({
const router = useRouter()
const pathname = usePathname()
const docLink = useDocLink()
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const currentWorkspace = useAtomValue(currentWorkspaceAtom)
const isCurrentWorkspaceManager = useAtomValue(isCurrentWorkspaceManagerAtom)
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
diff --git a/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx b/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx
index c1bbcf0650e..a7ac36b3e68 100644
--- a/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx
+++ b/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx
@@ -63,7 +63,7 @@ export default function ConfigCredential({ positionCenter, credential, onChange,
const queryLabelId = useId()
const headerLabelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
const apiKeyHeaderInputId = useId()
const apiKeyHeaderValueInputId = useId()
const apiKeyQueryInputId = useId()
diff --git a/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx b/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx
index f168896963e..998d68bca75 100644
--- a/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx
+++ b/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx
@@ -21,7 +21,7 @@ type Props = Readonly<{
}>
const GetSchema: FC<Props> = ({ onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
const [showImportFromUrl, setShowImportFromUrl] = useState(false)
const [importUrl, setImportUrl] = useState('')
const [isParsing, setIsParsing] = useState(false)
diff --git a/web/app/components/tools/edit-custom-collection-modal/index.tsx b/web/app/components/tools/edit-custom-collection-modal/index.tsx
index 285d499115b..14105342212 100644
--- a/web/app/components/tools/edit-custom-collection-modal/index.tsx
+++ b/web/app/components/tools/edit-custom-collection-modal/index.tsx
@@ -52,7 +52,7 @@ const EditCustomCollectionModal: FC<Props> = ({
const providerNameInputId = React.useId()
const privacyPolicyInputId = React.useId()
const customDisclaimerInputId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
const isAdd = !payload
const isEdit = !!payload
diff --git a/web/app/components/tools/edit-custom-collection-modal/test-api.tsx b/web/app/components/tools/edit-custom-collection-modal/test-api.tsx
index d32d6a315d6..0a573af2600 100644
--- a/web/app/components/tools/edit-custom-collection-modal/test-api.tsx
+++ b/web/app/components/tools/edit-custom-collection-modal/test-api.tsx
@@ -36,7 +36,7 @@ type Props = Readonly<{
}>
const TestApi: FC<Props> = ({ positionCenter, customCollection, tool, onHide }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
const parameterId = useId()
const locale = useLocale()
const language = getPluginLanguage(locale)
diff --git a/web/app/components/tools/labels/filter.tsx b/web/app/components/tools/labels/filter.tsx
index 59d9e90d622..b464132c24f 100644
--- a/web/app/components/tools/labels/filter.tsx
+++ b/web/app/components/tools/labels/filter.tsx
@@ -13,7 +13,7 @@ type LabelFilterProps = {
onChange: (v: string[]) => void
}
const LabelFilter: FC<LabelFilterProps> = ({ value, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { tags: labelList } = useTags()
const [keywords, setKeywords] = useState('')
diff --git a/web/app/components/tools/labels/selector.tsx b/web/app/components/tools/labels/selector.tsx
index 8fed00dce63..dca40b5c8cc 100644
--- a/web/app/components/tools/labels/selector.tsx
+++ b/web/app/components/tools/labels/selector.tsx
@@ -14,7 +14,7 @@ type LabelSelectorProps = {
}
function LabelSelector({ value, onChange }: LabelSelectorProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
const { tags: labelList } = useTags()
const [keywords, setKeywords] = useState('')
const debouncedKeywords = useDebouncedValue(keywords, 500)
diff --git a/web/app/components/tools/marketplace/index.tsx b/web/app/components/tools/marketplace/index.tsx
index 64c9747e9a7..79d4a200db7 100644
--- a/web/app/components/tools/marketplace/index.tsx
+++ b/web/app/components/tools/marketplace/index.tsx
@@ -30,7 +30,7 @@ const Marketplace = ({
contentInset = 'default',
}: MarketplaceProps) => {
const locale = useLocale()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const { theme } = useTheme()
const router = useRouter()
const { canInstallPlugin } = usePluginSettingsAccess()
diff --git a/web/app/components/tools/mcp/create-card.tsx b/web/app/components/tools/mcp/create-card.tsx
index 978177d705f..03b9477f0af 100644
--- a/web/app/components/tools/mcp/create-card.tsx
+++ b/web/app/components/tools/mcp/create-card.tsx
@@ -35,7 +35,7 @@ function useMCPCreateAction({ handleCreate }: Props) {
}
export function NewMCPButton({ handleCreate }: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
const addMCPServerLabel = t(($) => $['mcp.create.cardTitle'], { ns: 'tools' })
const { canManageMCP, create, setShowModal, showModal } = useMCPCreateAction({ handleCreate })
@@ -61,7 +61,7 @@ export function NewMCPButton({ handleCreate }: Props) {
}
const NewMCPCard = ({ handleCreate }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
const docLink = useDocLink()
const { canManageMCP, create, setShowModal, showModal } = useMCPCreateAction({ handleCreate })
diff --git a/web/app/components/tools/mcp/detail/content.tsx b/web/app/components/tools/mcp/detail/content.tsx
index 447deb7bb9f..eebb4f1ce53 100644
--- a/web/app/components/tools/mcp/detail/content.tsx
+++ b/web/app/components/tools/mcp/detail/content.tsx
@@ -53,7 +53,7 @@ const MCPDetailContent: FC<Props> = ({
isTriggerAuthorize,
onFirstCreate,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
const canManageMCP = useCanManageMCP()
const { data, isFetching: isGettingTools } = useMCPTools(
diff --git a/web/app/components/tools/mcp/detail/operation-dropdown.tsx b/web/app/components/tools/mcp/detail/operation-dropdown.tsx
index 11ab36fcc74..c825b60e403 100644
--- a/web/app/components/tools/mcp/detail/operation-dropdown.tsx
+++ b/web/app/components/tools/mcp/detail/operation-dropdown.tsx
@@ -19,7 +19,7 @@ type Props = Readonly<{
}>
const OperationDropdown: FC<Props> = ({ inCard, onOpenChange, onEdit, onRemove }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
return (
<DropdownMenu onOpenChange={onOpenChange}>
diff --git a/web/app/components/tools/mcp/detail/tool-item.tsx b/web/app/components/tools/mcp/detail/tool-item.tsx
index b0878587baa..5233430d91a 100644
--- a/web/app/components/tools/mcp/detail/tool-item.tsx
+++ b/web/app/components/tools/mcp/detail/tool-item.tsx
@@ -14,7 +14,7 @@ type Props = Readonly<{
const MCPToolItem = ({ tool }: Props) => {
const locale = useLocale()
const language = getPluginLanguage(locale)
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
const renderParameters = () => {
const parameters = tool.parameters
diff --git a/web/app/components/tools/mcp/headers-input.tsx b/web/app/components/tools/mcp/headers-input.tsx
index a1e102a69f2..1d63df70832 100644
--- a/web/app/components/tools/mcp/headers-input.tsx
+++ b/web/app/components/tools/mcp/headers-input.tsx
@@ -22,7 +22,7 @@ type Props = Readonly<{
}>
const HeadersInput = ({ headersItems, onChange, readonly = false, isMasked = false }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
const handleItemChange = (index: number, field: 'key' | 'value', value: string) => {
const newItems = [...headersItems]
diff --git a/web/app/components/tools/mcp/index.tsx b/web/app/components/tools/mcp/index.tsx
index c8c03e9f47c..e7a1c23a60e 100644
--- a/web/app/components/tools/mcp/index.tsx
+++ b/web/app/components/tools/mcp/index.tsx
@@ -52,7 +52,7 @@ const MCPList = ({
onCreatedProviderHandled,
showCreateCard = true,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
const canManageMCP = useCanManageMCP()
const fallbackMCPToolsQuery = useAllMCPTools(providers === undefined)
const list = providers ?? fallbackMCPToolsQuery.data ?? EMPTY_MCP_TOOLS
diff --git a/web/app/components/tools/mcp/mcp-server-modal.tsx b/web/app/components/tools/mcp/mcp-server-modal.tsx
index 2758e35af7b..6673108f797 100644
--- a/web/app/components/tools/mcp/mcp-server-modal.tsx
+++ b/web/app/components/tools/mcp/mcp-server-modal.tsx
@@ -32,7 +32,7 @@ type MCPServerParam = {
}
const MCPServerModal = ({ appID, latestParams = [], data, show, onHide, appInfo }: ModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
const { mutateAsync: createMCPServer, isPending: creating } = useCreateMCPServer()
const { mutateAsync: updateMCPServer, isPending: updating } = useUpdateMCPServer()
const invalidateMCPServerDetail = useInvalidateMCPServerDetail()
diff --git a/web/app/components/tools/mcp/mcp-server-param-item.tsx b/web/app/components/tools/mcp/mcp-server-param-item.tsx
index 50cb8a58499..bc47bcef51f 100644
--- a/web/app/components/tools/mcp/mcp-server-param-item.tsx
+++ b/web/app/components/tools/mcp/mcp-server-param-item.tsx
@@ -10,7 +10,7 @@ type Props = Readonly<{
}>
const MCPServerParamItem = ({ data, value, onChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
return (
<div className="min-w-0 space-y-0.5">
diff --git a/web/app/components/tools/mcp/modal.tsx b/web/app/components/tools/mcp/modal.tsx
index 73d2f84a318..0eb987a9bf3 100644
--- a/web/app/components/tools/mcp/modal.tsx
+++ b/web/app/components/tools/mcp/modal.tsx
@@ -63,7 +63,7 @@ type MCPModalContentProps = {
}
const MCPModalContent: FC<MCPModalContentProps> = ({ data, onConfirm, onHide }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
const serverUrlInputId = useId()
const nameInputId = useId()
const serverIdentifierInputId = useId()
diff --git a/web/app/components/tools/mcp/provider-card.tsx b/web/app/components/tools/mcp/provider-card.tsx
index 724a56211b0..830bb7d884e 100644
--- a/web/app/components/tools/mcp/provider-card.tsx
+++ b/web/app/components/tools/mcp/provider-card.tsx
@@ -18,7 +18,7 @@ type Props = Readonly<{
}>
const MCPCard = ({ currentProvider, data, onEdit, onDelete, handleSelect }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
const { formatTimeFromNow } = useFormatTimeFromNow()
const canManageMCP = useCanManageMCP()
const isConfigured = data.is_team_authorization && data.tools.length > 0
diff --git a/web/app/components/tools/mcp/sections/authentication-section.tsx b/web/app/components/tools/mcp/sections/authentication-section.tsx
index ed8424378c8..bda6dd4f2ba 100644
--- a/web/app/components/tools/mcp/sections/authentication-section.tsx
+++ b/web/app/components/tools/mcp/sections/authentication-section.tsx
@@ -24,7 +24,7 @@ const AuthenticationSection: FC<AuthenticationSectionProps> = ({
credentials,
onCredentialsChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
const dynamicRegistrationLabelId = useId()
const clientIdInputId = useId()
const clientSecretInputId = useId()
diff --git a/web/app/components/tools/mcp/sections/configurations-section.tsx b/web/app/components/tools/mcp/sections/configurations-section.tsx
index 75a410ac041..94ad07fe477 100644
--- a/web/app/components/tools/mcp/sections/configurations-section.tsx
+++ b/web/app/components/tools/mcp/sections/configurations-section.tsx
@@ -17,7 +17,7 @@ const ConfigurationsSection: FC<ConfigurationsSectionProps> = ({
sseReadTimeout,
onSseReadTimeoutChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
const timeoutInputId = useId()
const sseReadTimeoutInputId = useId()
diff --git a/web/app/components/tools/mcp/sections/headers-section.tsx b/web/app/components/tools/mcp/sections/headers-section.tsx
index a95e3c762b7..4717641f812 100644
--- a/web/app/components/tools/mcp/sections/headers-section.tsx
+++ b/web/app/components/tools/mcp/sections/headers-section.tsx
@@ -11,7 +11,7 @@ type HeadersSectionProps = {
}
const HeadersSection: FC<HeadersSectionProps> = ({ headers, onHeadersChange, isCreate }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
return (
<div>
diff --git a/web/app/components/tools/provider/custom-create-card.tsx b/web/app/components/tools/provider/custom-create-card.tsx
index a5df58614c5..49c65cfd5be 100644
--- a/web/app/components/tools/provider/custom-create-card.tsx
+++ b/web/app/components/tools/provider/custom-create-card.tsx
@@ -16,7 +16,7 @@ type Props = Readonly<{
}>
function useCustomToolCreateAction({ onRefreshData }: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const canManageTools = useCanManageTools()
const [isShowEditCustomCollectionModal, setIsShowEditCustomCollectionModal] = useState(false)
@@ -38,7 +38,7 @@ function useCustomToolCreateAction({ onRefreshData }: Props) {
}
export const NewCustomToolButton = ({ onRefreshData }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
const addSwaggerAPIAsToolLabel = t(($) => $.addSwaggerAPIAsTool, { ns: 'tools' })
const {
canManageTools,
@@ -72,7 +72,7 @@ export const NewCustomToolButton = ({ onRefreshData }: Props) => {
}
const Contribute = ({ onRefreshData, stepByStepTourTarget }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
const docLink = useDocLink()
const {
canManageTools,
diff --git a/web/app/components/tools/provider/detail.tsx b/web/app/components/tools/provider/detail.tsx
index fc3affa0b6b..da6f68da746 100644
--- a/web/app/components/tools/provider/detail.tsx
+++ b/web/app/components/tools/provider/detail.tsx
@@ -75,7 +75,7 @@ type Props = Readonly<{
}>
const ProviderDetail = ({ collection, onHide, onRefreshData }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin', 'tools'])
const locale = useLocale()
const language = getPluginLanguage(locale)
diff --git a/web/app/components/tools/provider/empty.tsx b/web/app/components/tools/provider/empty.tsx
index d2093558992..be54020f852 100644
--- a/web/app/components/tools/provider/empty.tsx
+++ b/web/app/components/tools/provider/empty.tsx
@@ -30,7 +30,7 @@ const getLink = (type?: ToolType) => {
}
}
const Empty = ({ type, isAgent }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
const docLink = useDocLink()
const { theme } = useTheme()
diff --git a/web/app/components/tools/setting/build-in/config-credentials.tsx b/web/app/components/tools/setting/build-in/config-credentials.tsx
index d452112ad22..bc16c4db37e 100644
--- a/web/app/components/tools/setting/build-in/config-credentials.tsx
+++ b/web/app/components/tools/setting/build-in/config-credentials.tsx
@@ -44,7 +44,7 @@ const ConfigCredential: FC<Props> = ({
isSaving,
readonly,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
const language = useLanguage()
const [credentialSchema, setCredentialSchema] = useState<any>(null)
const { name: collectionName } = collection
diff --git a/web/app/components/tools/workflow-tool/__tests__/helpers.spec.ts b/web/app/components/tools/workflow-tool/__tests__/helpers.spec.ts
index 9c27381b915..1f0de63642b 100644
--- a/web/app/components/tools/workflow-tool/__tests__/helpers.spec.ts
+++ b/web/app/components/tools/workflow-tool/__tests__/helpers.spec.ts
@@ -22,7 +22,7 @@ describe('workflow-tool helpers', () => {
it('builds translated reserved workflow outputs', () => {
const t = withSelectorKey(
(key: string, options?: { ns?: string }) => `${options?.ns}:${key}`,
- ) as TFunction
+ ) as TFunction<['workflow']>
expect(getReservedWorkflowOutputParameters(t)).toEqual([
{
diff --git a/web/app/components/tools/workflow-tool/confirm-modal/index.tsx b/web/app/components/tools/workflow-tool/confirm-modal/index.tsx
index 5187958df4a..27b0e6b0cbe 100644
--- a/web/app/components/tools/workflow-tool/confirm-modal/index.tsx
+++ b/web/app/components/tools/workflow-tool/confirm-modal/index.tsx
@@ -12,7 +12,7 @@ type ConfirmModalProps = {
}
const ConfirmModal = ({ show, onConfirm, onClose }: ConfirmModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools'])
return (
<Dialog open={show} disablePointerDismissal>
diff --git a/web/app/components/tools/workflow-tool/helpers.ts b/web/app/components/tools/workflow-tool/helpers.ts
index 02057150686..65998b9f76e 100644
--- a/web/app/components/tools/workflow-tool/helpers.ts
+++ b/web/app/components/tools/workflow-tool/helpers.ts
@@ -36,7 +36,7 @@ export const isWorkflowToolNameValid = (name: string) => {
return /^\w+$/.test(name)
}
-export const getReservedWorkflowOutputParameters = (t: TFunction) => {
+export const getReservedWorkflowOutputParameters = (t: TFunction<['workflow']>) => {
return RESERVED_WORKFLOW_OUTPUTS.map((output) => ({
...output,
description:
diff --git a/web/app/components/tools/workflow-tool/hooks/use-configure-button.ts b/web/app/components/tools/workflow-tool/hooks/use-configure-button.ts
index 46d78699ec9..44e9f6f96e9 100644
--- a/web/app/components/tools/workflow-tool/hooks/use-configure-button.ts
+++ b/web/app/components/tools/workflow-tool/hooks/use-configure-button.ts
@@ -126,7 +126,7 @@ export function useConfigureButton(options: UseConfigureButtonOptions) {
onRefreshData,
onConfigured,
} = options
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
// Data fetching via React Query
const { data: detail, isLoading } = useWorkflowToolDetailByAppID(
diff --git a/web/app/components/tools/workflow-tool/index.tsx b/web/app/components/tools/workflow-tool/index.tsx
index 7c967d285de..6211bacd0ca 100644
--- a/web/app/components/tools/workflow-tool/index.tsx
+++ b/web/app/components/tools/workflow-tool/index.tsx
@@ -146,7 +146,7 @@ const WorkflowToolOutputName = React.memo(
}) => {
const outputNameId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools', 'workflow'])
const reservedOutputDuplicateTip = t(
($) => $['createTool.toolOutput.reservedParameterDuplicateTip'],
{ ns: 'tools' },
@@ -228,7 +228,7 @@ export function WorkflowToolDrawer({
onSave,
onCreate,
}: WorkflowToolDrawerProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow', 'common', 'tools'])
const parameterId = React.useId()
const toolNameLabelId = React.useId()
diff --git a/web/app/components/tools/workflow-tool/method-selector.tsx b/web/app/components/tools/workflow-tool/method-selector.tsx
index 40099cc83bc..5edfc4a236e 100644
--- a/web/app/components/tools/workflow-tool/method-selector.tsx
+++ b/web/app/components/tools/workflow-tool/method-selector.tsx
@@ -10,7 +10,7 @@ type MethodSelectorProps = {
onChange: (v: string) => void
}
const MethodSelector: FC<MethodSelectorProps> = ({ value, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
const [open, setOpen] = useState(false)
const handleSelect = (value: string) => {
onChange(value)
diff --git a/web/app/components/workflow-app/components/workflow-header/features-trigger.tsx b/web/app/components/workflow-app/components/workflow-header/features-trigger.tsx
index 4215944d38d..fa1bd68e3a7 100644
--- a/web/app/components/workflow-app/components/workflow-header/features-trigger.tsx
+++ b/web/app/components/workflow-app/components/workflow-header/features-trigger.tsx
@@ -40,7 +40,7 @@ import {
} from '@/service/use-workflow'
const FeaturesTrigger = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const { theme } = useTheme()
const isChatMode = useIsChatMode()
const workflowStore = useWorkflowStore()
diff --git a/web/app/components/workflow-app/components/workflow-main.tsx b/web/app/components/workflow-app/components/workflow-main.tsx
index dfa7666aef6..f147ed155bd 100644
--- a/web/app/components/workflow-app/components/workflow-main.tsx
+++ b/web/app/components/workflow-app/components/workflow-main.tsx
@@ -50,7 +50,7 @@ const GRAPH_RELOAD_RETRY_BASE_DELAY = 1000
const GRAPH_RELOAD_RETRY_MAX_DELAY = 30_000
const WorkflowMain = ({ nodes, edges, viewport }: WorkflowMainProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const featuresStore = useFeaturesStore()
const workflowStore = useWorkflowStore()
const appId = useStore((s) => s.appId)
diff --git a/web/app/components/workflow-app/components/workflow-onboarding-modal/index.tsx b/web/app/components/workflow-app/components/workflow-onboarding-modal/index.tsx
index cb0f19150fa..0c508f2940d 100644
--- a/web/app/components/workflow-app/components/workflow-onboarding-modal/index.tsx
+++ b/web/app/components/workflow-app/components/workflow-onboarding-modal/index.tsx
@@ -24,7 +24,7 @@ const WorkflowOnboardingModal: FC<WorkflowOnboardingModalProps> = ({
onClose,
onSelectStartNode,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
return (
<Dialog open={isShow} onOpenChange={onClose} disablePointerDismissal>
diff --git a/web/app/components/workflow-app/components/workflow-onboarding-modal/start-node-selection-panel.tsx b/web/app/components/workflow-app/components/workflow-onboarding-modal/start-node-selection-panel.tsx
index f8d1280eef5..2b0df6a3f82 100644
--- a/web/app/components/workflow-app/components/workflow-onboarding-modal/start-node-selection-panel.tsx
+++ b/web/app/components/workflow-app/components/workflow-onboarding-modal/start-node-selection-panel.tsx
@@ -17,7 +17,7 @@ const StartNodeSelectionPanel: FC<StartNodeSelectionPanelProps> = ({
onSelectUserInput,
onSelectTrigger,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [showTriggerSelector, setShowTriggerSelector] = useState(false)
const handleTriggerSelect = useCallback(
diff --git a/web/app/components/workflow-app/hooks/use-DSL.ts b/web/app/components/workflow-app/hooks/use-DSL.ts
index 74130912f17..31db995c75a 100644
--- a/web/app/components/workflow-app/hooks/use-DSL.ts
+++ b/web/app/components/workflow-app/hooks/use-DSL.ts
@@ -12,7 +12,7 @@ import { useNodesSyncDraftByCanEdit } from './use-nodes-sync-draft'
type DoSyncWorkflowDraft = ReturnType<typeof useNodesSyncDraft>['doSyncWorkflowDraft']
const useDSLBase = (doSyncWorkflowDraft: DoSyncWorkflowDraft) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const { eventEmitter } = useEventEmitterContextContext()
const [exporting, setExporting] = useState(false)
diff --git a/web/app/components/workflow-app/hooks/use-available-nodes-meta-data.ts b/web/app/components/workflow-app/hooks/use-available-nodes-meta-data.ts
index be0815e22a9..09b8a2fc4ff 100644
--- a/web/app/components/workflow-app/hooks/use-available-nodes-meta-data.ts
+++ b/web/app/components/workflow-app/hooks/use-available-nodes-meta-data.ts
@@ -24,7 +24,7 @@ const getNodeHelpLinkPath = (helpLinkUri?: string): DocPathWithoutLang | undefin
}
export const useAvailableNodesMetaData = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const isChatMode = useIsChatMode()
const docLink = useDocLink()
const agentV2Enabled = isAgentV2Enabled()
diff --git a/web/app/components/workflow-app/hooks/use-workflow-draft-graph-for-canvas.ts b/web/app/components/workflow-app/hooks/use-workflow-draft-graph-for-canvas.ts
index 5f75d348875..c3e539cda5d 100644
--- a/web/app/components/workflow-app/hooks/use-workflow-draft-graph-for-canvas.ts
+++ b/web/app/components/workflow-app/hooks/use-workflow-draft-graph-for-canvas.ts
@@ -26,7 +26,7 @@ const hasStartPlaceholderNode = (nodes: Node[] = []): boolean => {
}
export const useWorkflowDraftGraphForCanvas = (appMode?: AppModeEnum | string) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const getNodesWithLocalStartPlaceholder = useCallback(
(nodes: Node[] = [], localStartPlaceholderNodes?: Node[]) => {
diff --git a/web/app/components/workflow-app/hooks/use-workflow-template.ts b/web/app/components/workflow-app/hooks/use-workflow-template.ts
index be735503128..03c07502e96 100644
--- a/web/app/components/workflow-app/hooks/use-workflow-template.ts
+++ b/web/app/components/workflow-app/hooks/use-workflow-template.ts
@@ -13,7 +13,7 @@ import { useIsChatMode } from './use-is-chat-mode'
export const useWorkflowTemplate = () => {
const isChatMode = useIsChatMode()
const appDetail = useAppStore((s) => s.appDetail)
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const createStartNode = () => {
const { newNode: startNode } = generateNewNode({
diff --git a/web/app/components/workflow/block-selector/all-start-blocks.tsx b/web/app/components/workflow/block-selector/all-start-blocks.tsx
index 4fc2105976d..3dfb8be0346 100644
--- a/web/app/components/workflow/block-selector/all-start-blocks.tsx
+++ b/web/app/components/workflow/block-selector/all-start-blocks.tsx
@@ -64,7 +64,7 @@ function AllStartBlocks({
hasTriggerNode = false,
variant = 'popover',
}: AllStartBlocksProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin', 'workflow'])
const [hasStartBlocksContent, setHasStartBlocksContent] = useState(false)
const [hasPluginContent, setHasPluginContent] = useState(false)
const { data: enable_marketplace } = useSuspenseQuery({
diff --git a/web/app/components/workflow/block-selector/blocks.tsx b/web/app/components/workflow/block-selector/blocks.tsx
index a36fde13c81..ad32bb3d7d7 100644
--- a/web/app/components/workflow/block-selector/blocks.tsx
+++ b/web/app/components/workflow/block-selector/blocks.tsx
@@ -33,7 +33,7 @@ const Blocks = ({
availableBlocksTypes = [],
blocks: blocksFromProps,
}: BlocksProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const store = useStoreApi()
const blocksFromHooks = useBlocks()
const [previewCardHandle] = useState(() => createPreviewCardHandle<BlockPreviewPayload>())
diff --git a/web/app/components/workflow/block-selector/featured-tools.tsx b/web/app/components/workflow/block-selector/featured-tools.tsx
index fa96c308dfe..e773c600404 100644
--- a/web/app/components/workflow/block-selector/featured-tools.tsx
+++ b/web/app/components/workflow/block-selector/featured-tools.tsx
@@ -1,4 +1,5 @@
'use client'
+
import type { PreviewCardHandle } from '@langgenius/dify-ui/preview-card'
import type { TFunction } from 'i18next'
import type { ToolWithProvider } from '../types'
@@ -58,7 +59,7 @@ const FeaturedTools = ({
isLoading = false,
onInstallSuccess,
}: FeaturedToolsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin', 'workflow'])
const language = useGetLanguage()
const [previewCardHandle] = useState(() => createPreviewCardHandle<FeaturedToolPreviewPayload>())
const [visibleCount, setVisibleCount] = useState(INITIAL_VISIBLE_COUNT)
@@ -239,7 +240,7 @@ type FeaturedToolUninstalledItemProps = {
language: PluginLanguage
previewCardHandle: PreviewCardHandle<FeaturedToolPreviewPayload>
onInstallSuccess?: () => Promise<void> | void
- t: TFunction
+ t: TFunction<['plugin', 'workflow']>
}
function FeaturedToolUninstalledItem({
diff --git a/web/app/components/workflow/block-selector/featured-triggers.tsx b/web/app/components/workflow/block-selector/featured-triggers.tsx
index dde08397a54..0f732aa3453 100644
--- a/web/app/components/workflow/block-selector/featured-triggers.tsx
+++ b/web/app/components/workflow/block-selector/featured-triggers.tsx
@@ -1,4 +1,5 @@
'use client'
+
import type { PreviewCardHandle } from '@langgenius/dify-ui/preview-card'
import type { TFunction } from 'i18next'
import type { TriggerPluginActionPreviewPayload } from './trigger-plugin/action-item'
@@ -56,7 +57,7 @@ const FeaturedTriggers = ({
isLoading = false,
onInstallSuccess,
}: FeaturedTriggersProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin', 'workflow'])
const language = useGetLanguage()
const [previewCardHandle] = useState(() =>
createPreviewCardHandle<FeaturedTriggerPreviewPayload>(),
@@ -240,7 +241,7 @@ type FeaturedTriggerUninstalledItemProps = {
language: PluginLanguage
previewCardHandle: PreviewCardHandle<FeaturedTriggerPreviewPayload>
onInstallSuccess?: () => Promise<void> | void
- t: TFunction
+ t: TFunction<['plugin', 'workflow']>
}
function FeaturedTriggerUninstalledItem({
diff --git a/web/app/components/workflow/block-selector/hooks.ts b/web/app/components/workflow/block-selector/hooks.ts
index 7a1c51cea13..a9f814f755d 100644
--- a/web/app/components/workflow/block-selector/hooks.ts
+++ b/web/app/components/workflow/block-selector/hooks.ts
@@ -5,7 +5,7 @@ import { BLOCKS } from './constants'
import { TabType, ToolType } from './types'
export const useBlocks = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return BLOCKS.map((block) => {
return {
@@ -36,7 +36,7 @@ export const useTabs = ({
disableStartTab?: boolean
forceEnableStartTab?: boolean
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const shouldShowStartTab = !noStart
const shouldDisableStartTab = disableStartTab || (!forceEnableStartTab && hasStartPlaceholderNode)
const startDisabledTip: ReactNode = disableStartTab
@@ -107,7 +107,7 @@ export const useTabs = ({
}
export const useToolTabs = (isHideMCPTools?: boolean) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const tabs: Array<{ key: ToolType; name: string }> = [
{
key: ToolType.All,
diff --git a/web/app/components/workflow/block-selector/index.tsx b/web/app/components/workflow/block-selector/index.tsx
index a717e3c1e7e..95204386c1b 100644
--- a/web/app/components/workflow/block-selector/index.tsx
+++ b/web/app/components/workflow/block-selector/index.tsx
@@ -93,7 +93,7 @@ function BlockSelector({
snippetInsertPayload,
isolateKeyboardEvents = false,
}: BlockSelectorProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const [localOpen, setLocalOpen] = useState(false)
const searchInputRef = useRef<HTMLInputElement>(null)
const open = openFromProps === undefined ? localOpen : openFromProps
diff --git a/web/app/components/workflow/block-selector/marketplace-plugin/__tests__/item-list.spec.tsx b/web/app/components/workflow/block-selector/marketplace-plugin/__tests__/item-list.spec.tsx
index c8134b9ecf1..d1ab7844654 100644
--- a/web/app/components/workflow/block-selector/marketplace-plugin/__tests__/item-list.spec.tsx
+++ b/web/app/components/workflow/block-selector/marketplace-plugin/__tests__/item-list.spec.tsx
@@ -66,7 +66,7 @@ describe('Marketplace plugin selector components', () => {
beforeEach(() => {
vi.clearAllMocks()
- i18n = renderHook(() => useTranslation()).result.current.i18n
+ i18n = renderHook(() => useTranslation(['plugin'])).result.current.i18n
i18n.language = 'en-US'
vi.mocked(useStickyScroll).mockReturnValue({
handleScroll: vi.fn(),
diff --git a/web/app/components/workflow/block-selector/marketplace-plugin/action.tsx b/web/app/components/workflow/block-selector/marketplace-plugin/action.tsx
index 850780d2cb9..cc446816e38 100644
--- a/web/app/components/workflow/block-selector/marketplace-plugin/action.tsx
+++ b/web/app/components/workflow/block-selector/marketplace-plugin/action.tsx
@@ -24,7 +24,7 @@ type Props = Readonly<{
}>
function OperationDropdown({ open, onOpenChange, author, name, version }: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { theme } = useTheme()
const downloadMutation = useMutation(
diff --git a/web/app/components/workflow/block-selector/marketplace-plugin/item.tsx b/web/app/components/workflow/block-selector/marketplace-plugin/item.tsx
index 29f26d4025b..79cab32dd45 100644
--- a/web/app/components/workflow/block-selector/marketplace-plugin/item.tsx
+++ b/web/app/components/workflow/block-selector/marketplace-plugin/item.tsx
@@ -17,7 +17,7 @@ type Props = Readonly<{
}>
function Item({ payload }: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const [open, setOpen] = useState(false)
const language = useGetLanguage()
const getLocalizedText = (obj: Record<string, string> | undefined) =>
diff --git a/web/app/components/workflow/block-selector/marketplace-plugin/list.tsx b/web/app/components/workflow/block-selector/marketplace-plugin/list.tsx
index 50bf74e513d..73137444d2c 100644
--- a/web/app/components/workflow/block-selector/marketplace-plugin/list.tsx
+++ b/web/app/components/workflow/block-selector/marketplace-plugin/list.tsx
@@ -34,7 +34,7 @@ function List({
hideFindMoreFooter = false,
ref,
}: ListProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const noFilter = !searchText && tags.length === 0
const hasRes = list.length > 0
const urlWithSearchText = getMarketplaceCategoryUrl(category, {
diff --git a/web/app/components/workflow/block-selector/rag-tool-recommendations/index.tsx b/web/app/components/workflow/block-selector/rag-tool-recommendations/index.tsx
index 93ac005d6e6..a775e06c8f3 100644
--- a/web/app/components/workflow/block-selector/rag-tool-recommendations/index.tsx
+++ b/web/app/components/workflow/block-selector/rag-tool-recommendations/index.tsx
@@ -24,7 +24,7 @@ export function RAGToolRecommendations({
onSelect,
onLoadMore,
}: RAGToolRecommendationsProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'pipeline'])
const [isCollapsed, setIsCollapsed] = useRAGRecommendationsCollapsed()
const {
diff --git a/web/app/components/workflow/block-selector/rag-tool-recommendations/uninstalled-item.tsx b/web/app/components/workflow/block-selector/rag-tool-recommendations/uninstalled-item.tsx
index d36763aafbc..c9a6c6d522c 100644
--- a/web/app/components/workflow/block-selector/rag-tool-recommendations/uninstalled-item.tsx
+++ b/web/app/components/workflow/block-selector/rag-tool-recommendations/uninstalled-item.tsx
@@ -16,7 +16,7 @@ type UninstalledItemProps = {
}
function UninstalledItem({ payload }: UninstalledItemProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const locale = useLocale()
const getLocalizedText = (obj: Record<string, string> | undefined) =>
diff --git a/web/app/components/workflow/block-selector/snippets/index.tsx b/web/app/components/workflow/block-selector/snippets/index.tsx
index ec1d7431d71..62d4c3fea17 100644
--- a/web/app/components/workflow/block-selector/snippets/index.tsx
+++ b/web/app/components/workflow/block-selector/snippets/index.tsx
@@ -34,7 +34,7 @@ type SnippetsProps = {
}
const LoadingSkeleton = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div
@@ -63,7 +63,7 @@ const LoadingSkeleton = () => {
}
const Snippets = ({ searchText, onSearchTextChange, insertPayload, onInserted }: SnippetsProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { handleInsertSnippet } = useInsertSnippet()
const deferredSearchText = useDeferredValue(searchText)
const viewportRef = useRef<HTMLDivElement>(null)
diff --git a/web/app/components/workflow/block-selector/snippets/snippet-detail-card.tsx b/web/app/components/workflow/block-selector/snippets/snippet-detail-card.tsx
index 9751cbd23e8..e516e5f53f6 100644
--- a/web/app/components/workflow/block-selector/snippets/snippet-detail-card.tsx
+++ b/web/app/components/workflow/block-selector/snippets/snippet-detail-card.tsx
@@ -11,7 +11,7 @@ type SnippetDetailCardProps = {
function SnippetDetailCard({ snippet }: SnippetDetailCardProps) {
const { author_name, description, name } = snippet
- const { t } = useTranslation('snippet')
+ const { t } = useTranslation(['snippet'])
const { data: workflow } = useSnippetPublishedWorkflow(snippet.id)
const creatorName = author_name || t(($) => $.unknownUser)
diff --git a/web/app/components/workflow/block-selector/snippets/snippet-empty-state.tsx b/web/app/components/workflow/block-selector/snippets/snippet-empty-state.tsx
index 9e8397ac36c..b4e4c0b3044 100644
--- a/web/app/components/workflow/block-selector/snippets/snippet-empty-state.tsx
+++ b/web/app/components/workflow/block-selector/snippets/snippet-empty-state.tsx
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next'
const SnippetEmptyState = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="flex min-h-120 flex-col items-center justify-center gap-2 px-4">
diff --git a/web/app/components/workflow/block-selector/snippets/snippet-tags-filter.tsx b/web/app/components/workflow/block-selector/snippets/snippet-tags-filter.tsx
index 7c409e54d5c..192fef0aa9f 100644
--- a/web/app/components/workflow/block-selector/snippets/snippet-tags-filter.tsx
+++ b/web/app/components/workflow/block-selector/snippets/snippet-tags-filter.tsx
@@ -16,7 +16,7 @@ type SnippetTagsFilterProps = {
}
const SnippetTagsFilter = ({ embedded = false, value, onChange }: SnippetTagsFilterProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'pluginTags'])
const [searchText, setSearchText] = useState('')
const { data: tagList = [] } = useQuery(
diff --git a/web/app/components/workflow/block-selector/snippets/use-insert-snippet.ts b/web/app/components/workflow/block-selector/snippets/use-insert-snippet.ts
index 4a4905bd88f..81f3994e078 100644
--- a/web/app/components/workflow/block-selector/snippets/use-insert-snippet.ts
+++ b/web/app/components/workflow/block-selector/snippets/use-insert-snippet.ts
@@ -403,7 +403,7 @@ const createBoundaryEdges = ({
}
export const useInsertSnippet = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['snippet'])
const queryClient = useQueryClient()
const store = useStoreApi()
const { handleSyncWorkflowDraft } = useNodesSyncDraft()
diff --git a/web/app/components/workflow/block-selector/start-blocks.tsx b/web/app/components/workflow/block-selector/start-blocks.tsx
index e26ed58a915..ff298db2103 100644
--- a/web/app/components/workflow/block-selector/start-blocks.tsx
+++ b/web/app/components/workflow/block-selector/start-blocks.tsx
@@ -44,7 +44,7 @@ const StartBlocks = ({
showUserInputDisabled = false,
disabled = false,
}: StartBlocksProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'tools', 'workflow'])
const nodes = useNodes()
const [previewCardHandle] = useState(() => createPreviewCardHandle<StartBlockPreviewPayload>())
const previewDescriptionBaseId = useId()
diff --git a/web/app/components/workflow/block-selector/tabs.tsx b/web/app/components/workflow/block-selector/tabs.tsx
index fbc24007a84..4a207005796 100644
--- a/web/app/components/workflow/block-selector/tabs.tsx
+++ b/web/app/components/workflow/block-selector/tabs.tsx
@@ -102,7 +102,7 @@ function BlockSelectorPanels({
hasTriggerNode = false,
snippetInsertPayload,
}: BlockSelectorPanelsProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin', 'workflow'])
const [filters, setFilters] = useState(createTabFilterState)
const fallbackDisabledTip = t(($) => $['tabs.startDisabledTip'], { ns: 'workflow' })
diff --git a/web/app/components/workflow/block-selector/tool-browser.tsx b/web/app/components/workflow/block-selector/tool-browser.tsx
index c6681b97ccd..227b797fbf1 100644
--- a/web/app/components/workflow/block-selector/tool-browser.tsx
+++ b/web/app/components/workflow/block-selector/tool-browser.tsx
@@ -47,7 +47,7 @@ function ToolsEmptyState({ title, action }: { title: string; action?: ReactNode
}
function ToolCategoryEmptyState({ type }: { type: ToolType }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
const title = t(($) => $[`addToolModal.${type}.title`], { ns: 'tools' })
const tip = t(($) => $[`addToolModal.${type}.tip`], { ns: 'tools' })
const href = (() => {
@@ -123,7 +123,7 @@ function ToolBrowser({
showFeatured = false,
onFeaturedInstallSuccess,
}: ToolBrowserProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin', 'tools', 'workflow'])
const language = useGetLanguage()
const tabs = useToolTabs()
const [activeTab, setActiveTab] = useState<ToolType>(ToolType.All)
diff --git a/web/app/components/workflow/block-selector/tool-picker.tsx b/web/app/components/workflow/block-selector/tool-picker.tsx
index fad33acdb8a..75cb2fc5e54 100644
--- a/web/app/components/workflow/block-selector/tool-picker.tsx
+++ b/web/app/components/workflow/block-selector/tool-picker.tsx
@@ -60,7 +60,7 @@ export function ToolPickerContent({
selectedTools,
panelClassName,
}: ToolPickerContentProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'plugin'])
const [searchText, setSearchText] = useState('')
const [tags, setTags] = useState<string[]>([])
const canManageTools = useCanManageTools()
@@ -209,7 +209,7 @@ function ToolPicker({
onShowChange,
...contentProps
}: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const handleOpenChange = (nextOpen: boolean) => {
if (nextOpen && disabled) return
onShowChange(nextOpen)
diff --git a/web/app/components/workflow/block-selector/tool/action-item.tsx b/web/app/components/workflow/block-selector/tool/action-item.tsx
index 7636da5617a..e4e16317bac 100644
--- a/web/app/components/workflow/block-selector/tool/action-item.tsx
+++ b/web/app/components/workflow/block-selector/tool/action-item.tsx
@@ -57,7 +57,7 @@ const ToolItem: FC<Props> = ({
disabled,
isAdded,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
const language = useGetLanguage()
const previewDescriptionId = React.useId()
diff --git a/web/app/components/workflow/block-selector/tool/tool-list-tree-view/list.tsx b/web/app/components/workflow/block-selector/tool/tool-list-tree-view/list.tsx
index 13565649deb..eb38d4649f3 100644
--- a/web/app/components/workflow/block-selector/tool/tool-list-tree-view/list.tsx
+++ b/web/app/components/workflow/block-selector/tool/tool-list-tree-view/list.tsx
@@ -27,7 +27,7 @@ export const ToolListTreeView = memo(
onSelectMultiple,
selectedTools,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const getGroupName = (group: ToolGroup) => {
if (group.kind === 'author') return group.author
diff --git a/web/app/components/workflow/block-selector/tool/tool.tsx b/web/app/components/workflow/block-selector/tool/tool.tsx
index fc271cc9a2e..a68f049d204 100644
--- a/web/app/components/workflow/block-selector/tool/tool.tsx
+++ b/web/app/components/workflow/block-selector/tool/tool.tsx
@@ -58,7 +58,7 @@ function Tool({
onSelectMultiple,
selectedTools,
}: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools', 'workflow'])
const { allowed: isMCPToolAllowed } = useMCPToolAvailability()
const language = useGetLanguage()
const isFlatView = viewType === ViewType.flat
diff --git a/web/app/components/workflow/block-selector/trigger-plugin/action-item.tsx b/web/app/components/workflow/block-selector/trigger-plugin/action-item.tsx
index e871318b716..5dbf49d8da7 100644
--- a/web/app/components/workflow/block-selector/trigger-plugin/action-item.tsx
+++ b/web/app/components/workflow/block-selector/trigger-plugin/action-item.tsx
@@ -38,7 +38,7 @@ const TriggerPluginActionItem: FC<Props> = ({
disabled,
isAdded,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
const language = useGetLanguage()
const previewDescriptionId = React.useId()
const previewDescription = payload.description[language]
diff --git a/web/app/components/workflow/block-selector/trigger-plugin/item.tsx b/web/app/components/workflow/block-selector/trigger-plugin/item.tsx
index 3d729c3e99c..2a477d23e52 100644
--- a/web/app/components/workflow/block-selector/trigger-plugin/item.tsx
+++ b/web/app/components/workflow/block-selector/trigger-plugin/item.tsx
@@ -56,7 +56,7 @@ const TriggerPluginItem: FC<Props> = ({
onSelect,
disabled = false,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const language = useGetLanguage()
const { theme } = useTheme()
const notShowProvider = payload.type === CollectionType.workflow
diff --git a/web/app/components/workflow/block-selector/view-type-select.tsx b/web/app/components/workflow/block-selector/view-type-select.tsx
index 901b9511251..0ca3835b092 100644
--- a/web/app/components/workflow/block-selector/view-type-select.tsx
+++ b/web/app/components/workflow/block-selector/view-type-select.tsx
@@ -10,7 +10,7 @@ type Props = Readonly<{
}>
function ViewTypeSelect({ viewType, onChange }: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
return (
<SegmentedControl<ViewType>
diff --git a/web/app/components/workflow/comment/comment-icon.tsx b/web/app/components/workflow/comment/comment-icon.tsx
index c8e8fccdf28..6e3126daf6a 100644
--- a/web/app/components/workflow/comment/comment-icon.tsx
+++ b/web/app/components/workflow/comment/comment-icon.tsx
@@ -21,7 +21,7 @@ type CommentIconProps = {
export const CommentIcon: FC<CommentIconProps> = memo(
({ comment, onClick, isActive = false, onPositionUpdate }) => {
- const { t } = useTranslation('workflow')
+ const { t } = useTranslation(['workflow'])
const descriptionId = useId()
const { flowToScreenPosition, screenToFlowPosition } = useReactFlow()
const viewport = useViewport()
diff --git a/web/app/components/workflow/comment/comment-input.tsx b/web/app/components/workflow/comment/comment-input.tsx
index 9cb30925d1f..30acdc2fd62 100644
--- a/web/app/components/workflow/comment/comment-input.tsx
+++ b/web/app/components/workflow/comment/comment-input.tsx
@@ -28,7 +28,7 @@ export const CommentInput: FC<CommentInputProps> = memo(
const [content, setContent] = useState('')
const [keyboardMoving, setKeyboardMoving] = useState(false)
const moveDescriptionId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { data: userProfile } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile,
diff --git a/web/app/components/workflow/comment/mention-input.tsx b/web/app/components/workflow/comment/mention-input.tsx
index 8e60767aab5..790c0b06607 100644
--- a/web/app/components/workflow/comment/mention-input.tsx
+++ b/web/app/components/workflow/comment/mention-input.tsx
@@ -56,7 +56,7 @@ const MentionInputInner = forwardRef<HTMLTextAreaElement, MentionInputProps>(
forwardedRef,
) => {
const params = useParams()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const appId = params.appId as string
const textareaRef = useRef<HTMLTextAreaElement>(null)
const highlightContentRef = useRef<HTMLDivElement>(null)
diff --git a/web/app/components/workflow/comment/thread.tsx b/web/app/components/workflow/comment/thread.tsx
index 8173385e467..71492977e0f 100644
--- a/web/app/components/workflow/comment/thread.tsx
+++ b/web/app/components/workflow/comment/thread.tsx
@@ -187,7 +187,7 @@ export const CommentThread: FC<CommentThreadProps> = memo(
select: (data) => data.profile,
})
const currentUserId = userProfile.id
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const [replyContent, setReplyContent] = useState('')
const [editingCommentContent, setEditingCommentContent] = useState('')
const [activeReplyMenuId, setActiveReplyMenuId] = useState<string | null>(null)
diff --git a/web/app/components/workflow/dsl-export-confirm-modal.tsx b/web/app/components/workflow/dsl-export-confirm-modal.tsx
index c1debee9988..6be79c6b75b 100644
--- a/web/app/components/workflow/dsl-export-confirm-modal.tsx
+++ b/web/app/components/workflow/dsl-export-confirm-modal.tsx
@@ -29,7 +29,7 @@ export const DSLExportConfirmContent = ({
onClose,
onExportingChange,
}: DSLExportConfirmContentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const [exportSecrets, setExportSecrets] = useState<boolean>(false)
const [isExporting, setIsExporting] = useState(false)
diff --git a/web/app/components/workflow/edge-contextmenu.tsx b/web/app/components/workflow/edge-contextmenu.tsx
index dd047db0a91..87d7378fe4f 100644
--- a/web/app/components/workflow/edge-contextmenu.tsx
+++ b/web/app/components/workflow/edge-contextmenu.tsx
@@ -6,7 +6,7 @@ import { ShortcutKbd } from './shortcuts/shortcut-kbd'
import { useStore } from './store'
export function EdgeContextmenu({ onClose }: { onClose: () => void }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const contextMenuTarget = useStore((s) => s.contextMenuTarget)
const edgeId = contextMenuTarget?.type === 'edge' ? contextMenuTarget.edgeId : undefined
const { handleEdgeDeleteById } = useEdgesInteractions()
diff --git a/web/app/components/workflow/header/chat-variable-button.tsx b/web/app/components/workflow/header/chat-variable-button.tsx
index 6b532172b46..b242496d8be 100644
--- a/web/app/components/workflow/header/chat-variable-button.tsx
+++ b/web/app/components/workflow/header/chat-variable-button.tsx
@@ -8,7 +8,7 @@ import useTheme from '@/hooks/use-theme'
const ChatVariableButton = ({ disabled }: { disabled: boolean }) => {
const { theme } = useTheme()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const showChatVariablePanel = useStore((s) => s.showChatVariablePanel)
const setShowChatVariablePanel = useStore((s) => s.setShowChatVariablePanel)
const setShowEnvPanel = useStore((s) => s.setShowEnvPanel)
diff --git a/web/app/components/workflow/header/checklist/index.tsx b/web/app/components/workflow/header/checklist/index.tsx
index 6981e8562a0..fe2b0cc5316 100644
--- a/web/app/components/workflow/header/checklist/index.tsx
+++ b/web/app/components/workflow/header/checklist/index.tsx
@@ -28,7 +28,7 @@ type WorkflowChecklistProps = {
}
const WorkflowChecklist = ({ disabled, showGoTo = true, onItemClick }: WorkflowChecklistProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const [open, setOpen] = useState(false)
const edges = useEdges<CommonEdgeType>()
const nodes = useNodes()
diff --git a/web/app/components/workflow/header/checklist/node-group.tsx b/web/app/components/workflow/header/checklist/node-group.tsx
index 1006ab6887e..5e5c620e136 100644
--- a/web/app/components/workflow/header/checklist/node-group.tsx
+++ b/web/app/components/workflow/header/checklist/node-group.tsx
@@ -21,7 +21,7 @@ export const ChecklistNodeGroup = memo(
showGoTo: boolean
onItemClick: (item: ChecklistItem) => void
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const goToEnabled = showGoTo && item.canNavigate && !item.disableGoTo
const subItems = useMemo(() => {
diff --git a/web/app/components/workflow/header/checklist/plugin-group.tsx b/web/app/components/workflow/header/checklist/plugin-group.tsx
index 64ea8a22d76..71e10e64396 100644
--- a/web/app/components/workflow/header/checklist/plugin-group.tsx
+++ b/web/app/components/workflow/header/checklist/plugin-group.tsx
@@ -16,7 +16,7 @@ function getVersionFromMarketplaceIdentifier(identifier: string): string | undef
}
export const ChecklistPluginGroup = memo(({ items }: { items: ChecklistItem[] }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const identifiers = useMemo(
() =>
diff --git a/web/app/components/workflow/header/editing-title.tsx b/web/app/components/workflow/header/editing-title.tsx
index 389f1ffeb6d..3c1672b5948 100644
--- a/web/app/components/workflow/header/editing-title.tsx
+++ b/web/app/components/workflow/header/editing-title.tsx
@@ -5,7 +5,7 @@ import { useFormatTimeFromNow } from '@/hooks/use-format-time-from-now'
import useTimestamp from '@/hooks/use-timestamp'
function EditingTitle() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { formatTime } = useTimestamp()
const { formatTimeFromNow } = useFormatTimeFromNow()
const draftUpdatedAt = useStore((state) => state.draftUpdatedAt)
diff --git a/web/app/components/workflow/header/env-button.tsx b/web/app/components/workflow/header/env-button.tsx
index 247a1a0ddf1..6d9d179e23e 100644
--- a/web/app/components/workflow/header/env-button.tsx
+++ b/web/app/components/workflow/header/env-button.tsx
@@ -9,7 +9,7 @@ import useTheme from '@/hooks/use-theme'
const EnvButton = ({ disabled }: { disabled: boolean }) => {
const { theme } = useTheme()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const setShowChatVariablePanel = useStore((s) => s.setShowChatVariablePanel)
const showEnvPanel = useStore((s) => s.showEnvPanel)
const setShowEnvPanel = useStore((s) => s.setShowEnvPanel)
diff --git a/web/app/components/workflow/header/global-variable-button.tsx b/web/app/components/workflow/header/global-variable-button.tsx
index 6388d472aa0..4f4893602ae 100644
--- a/web/app/components/workflow/header/global-variable-button.tsx
+++ b/web/app/components/workflow/header/global-variable-button.tsx
@@ -9,7 +9,7 @@ import useTheme from '@/hooks/use-theme'
const GlobalVariableButton = ({ disabled }: { disabled: boolean }) => {
const { theme } = useTheme()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const showGlobalVariablePanel = useStore((s) => s.showGlobalVariablePanel)
const setShowGlobalVariablePanel = useStore((s) => s.setShowGlobalVariablePanel)
const setShowEnvPanel = useStore((s) => s.setShowEnvPanel)
diff --git a/web/app/components/workflow/header/header-in-restoring.tsx b/web/app/components/workflow/header/header-in-restoring.tsx
index 22f52134284..81fab37575c 100644
--- a/web/app/components/workflow/header/header-in-restoring.tsx
+++ b/web/app/components/workflow/header/header-in-restoring.tsx
@@ -29,7 +29,7 @@ export type HeaderInRestoringProps = {
onRestoreSettled?: () => void
}
const HeaderInRestoring = ({ onRestoreSettled }: HeaderInRestoringProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'workflow'])
const { theme } = useTheme()
const [isRestorePlanUpgradeModalOpen, setIsRestorePlanUpgradeModalOpen] = useState(false)
const deploymentEdition = useAtomValue(deploymentEditionAtom)
diff --git a/web/app/components/workflow/header/header-in-view-history.tsx b/web/app/components/workflow/header/header-in-view-history.tsx
index c1f06914197..ee3a58343dc 100644
--- a/web/app/components/workflow/header/header-in-view-history.tsx
+++ b/web/app/components/workflow/header/header-in-view-history.tsx
@@ -12,7 +12,7 @@ export type HeaderInHistoryProps = {
viewHistoryProps?: ViewHistoryProps
}
const HeaderInHistory = ({ viewHistoryProps }: HeaderInHistoryProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const workflowStore = useWorkflowStore()
const { handleLoadBackupDraft } = useWorkflowRun()
diff --git a/web/app/components/workflow/header/online-users.tsx b/web/app/components/workflow/header/online-users.tsx
index fea0dcaafef..b4ba4caf1d6 100644
--- a/web/app/components/workflow/header/online-users.tsx
+++ b/web/app/components/workflow/header/online-users.tsx
@@ -48,7 +48,7 @@ const useAvatarUrls = (users: OnlineUser[]) => {
}
const OnlineUsers = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const appId = useStore((s) => s.appId)
const canEdit = useHooksStore((s) => s.accessControl.canEdit)
const {
diff --git a/web/app/components/workflow/header/restoring-title.tsx b/web/app/components/workflow/header/restoring-title.tsx
index 3ead6d63016..0f9c247bfea 100644
--- a/web/app/components/workflow/header/restoring-title.tsx
+++ b/web/app/components/workflow/header/restoring-title.tsx
@@ -7,7 +7,7 @@ import { useStore } from '../store'
import { WorkflowVersion } from '../types'
const RestoringTitle = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { formatTimeFromNow } = useFormatTimeFromNow()
const { formatTime } = useTimestamp()
const currentVersion = useStore((state) => state.currentVersion)
diff --git a/web/app/components/workflow/header/run-and-history.tsx b/web/app/components/workflow/header/run-and-history.tsx
index 6f330ef8eca..9e81deb7b28 100644
--- a/web/app/components/workflow/header/run-and-history.tsx
+++ b/web/app/components/workflow/header/run-and-history.tsx
@@ -10,7 +10,7 @@ import RunMode from './run-mode'
import ViewHistory from './view-history'
const PreviewMode = memo(({ disabled = false }: { disabled?: boolean }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { handleWorkflowStartRunInChatflow } = useWorkflowStartRun()
const canRun = useHooksStore((s) => s.accessControl.canRun)
const isDisabled = disabled || !canRun
diff --git a/web/app/components/workflow/header/run-mode.tsx b/web/app/components/workflow/header/run-mode.tsx
index aacd0011d65..dbd0b1400b1 100644
--- a/web/app/components/workflow/header/run-mode.tsx
+++ b/web/app/components/workflow/header/run-mode.tsx
@@ -29,7 +29,7 @@ const isWorkflowStopEvent = (value: EventEmitterValue) =>
typeof value !== 'string' && value.type === EVENT_WORKFLOW_STOP
const RunMode = ({ text, disabled = false }: RunModeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const {
handleWorkflowStartRunInWorkflow,
handleWorkflowTriggerScheduleRunInWorkflow,
diff --git a/web/app/components/workflow/header/running-title.tsx b/web/app/components/workflow/header/running-title.tsx
index 857e37dad28..6ce99e1b2b5 100644
--- a/web/app/components/workflow/header/running-title.tsx
+++ b/web/app/components/workflow/header/running-title.tsx
@@ -5,7 +5,7 @@ import { useStore } from '../store'
import { formatWorkflowRunIdentifier } from '../utils'
const RunningTitle = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const isChatMode = useIsChatMode()
const historyWorkflowData = useStore((s) => s.historyWorkflowData)
diff --git a/web/app/components/workflow/header/scroll-to-selected-node-button.tsx b/web/app/components/workflow/header/scroll-to-selected-node-button.tsx
index 04779379519..b378a7211ce 100644
--- a/web/app/components/workflow/header/scroll-to-selected-node-button.tsx
+++ b/web/app/components/workflow/header/scroll-to-selected-node-button.tsx
@@ -6,7 +6,7 @@ import { useNodes } from 'reactflow'
import { scrollToWorkflowNode } from '../utils/node-navigation'
const ScrollToSelectedNodeButton: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const nodes = useNodes<CommonNodeType>()
const selectedNode = nodes.find((node) => node.data.selected)
diff --git a/web/app/components/workflow/header/test-run-menu.tsx b/web/app/components/workflow/header/test-run-menu.tsx
index 67f43661350..b931bd8abe0 100644
--- a/web/app/components/workflow/header/test-run-menu.tsx
+++ b/web/app/components/workflow/header/test-run-menu.tsx
@@ -94,7 +94,7 @@ const buildShortcutMappings = (options: TestRunOptions): ShortcutMapping[] => {
// oxlint-disable-next-line eslint-react/no-forward-ref
const TestRunMenu = forwardRef<TestRunMenuRef, TestRunMenuProps>(
({ options, onSelect, children }, ref) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const shortcutMappings = useMemo(() => buildShortcutMappings(options), [options])
const shortcutKeyById = useMemo(() => {
diff --git a/web/app/components/workflow/header/undo-redo.tsx b/web/app/components/workflow/header/undo-redo.tsx
index cefdae714d5..ea5e5046d1d 100644
--- a/web/app/components/workflow/header/undo-redo.tsx
+++ b/web/app/components/workflow/header/undo-redo.tsx
@@ -9,7 +9,7 @@ import TipPopup from '../operator/tip-popup'
type UndoRedoProps = { handleUndo: () => void; handleRedo: () => void }
function UndoRedo({ handleUndo, handleRedo }: UndoRedoProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { store } = useWorkflowHistoryStore()
const [buttonsDisabled, setButtonsDisabled] = useState({ undo: true, redo: true })
diff --git a/web/app/components/workflow/header/version-history-button.tsx b/web/app/components/workflow/header/version-history-button.tsx
index a31409fd329..0d2de1059d1 100644
--- a/web/app/components/workflow/header/version-history-button.tsx
+++ b/web/app/components/workflow/header/version-history-button.tsx
@@ -13,7 +13,7 @@ type VersionHistoryButtonProps = {
export function VersionHistoryButton({ onClick }: VersionHistoryButtonProps) {
const { theme } = useTheme()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const label = t(($) => $['common.versionHistory'], { ns: 'workflow' })
useHotkey(
diff --git a/web/app/components/workflow/header/view-history.tsx b/web/app/components/workflow/header/view-history.tsx
index 21b1adbc7fd..26527f982dd 100644
--- a/web/app/components/workflow/header/view-history.tsx
+++ b/web/app/components/workflow/header/view-history.tsx
@@ -21,7 +21,7 @@ export type ViewHistoryProps = {
historyUrl?: string
}
const ViewHistory = ({ withText, onClearLogAndMessageModal, historyUrl }: ViewHistoryProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const isChatMode = useIsChatMode()
const [open, setOpen] = useState(false)
const { formatTimeFromNow } = useFormatTimeFromNow()
diff --git a/web/app/components/workflow/header/view-workflow-history.tsx b/web/app/components/workflow/header/view-workflow-history.tsx
index 14c4cc8a23e..cf887314e9c 100644
--- a/web/app/components/workflow/header/view-workflow-history.tsx
+++ b/web/app/components/workflow/header/view-workflow-history.tsx
@@ -26,7 +26,7 @@ type ChangeHistoryList = {
}
const ViewWorkflowHistory = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const [open, setOpen] = useState(false)
const { nodesReadOnly } = useNodesReadOnly()
diff --git a/web/app/components/workflow/hooks/use-checklist.ts b/web/app/components/workflow/hooks/use-checklist.ts
index 1456a198eb1..805a26b6777 100644
--- a/web/app/components/workflow/hooks/use-checklist.ts
+++ b/web/app/components/workflow/hooks/use-checklist.ts
@@ -163,7 +163,7 @@ const getDuplicateEndOutputMessages = (
}
export const useChecklist = (nodes: Node[], edges: Edge[], options?: { flowType?: FlowType }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['agentV2', 'common', 'workflow'])
const language = useGetLanguage()
const { nodesMap: nodesExtraData } = useNodesMetaData()
const { data: buildInTools } = useAllBuiltInTools()
@@ -618,7 +618,7 @@ export const useChecklist = (nodes: Node[], edges: Edge[], options?: { flowType?
}
export const useChecklistBeforePublish = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const language = useGetLanguage()
const queryClient = useQueryClient()
const store = useStoreApi()
@@ -942,7 +942,7 @@ export const useChecklistBeforePublish = () => {
}
export const useWorkflowRunValidation = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const nodes = useNodes()
const edges = useEdges<CommonEdgeType>()
const flowType = useHooksStore((s) => s.configsMap?.flowType)
diff --git a/web/app/components/workflow/hooks/use-dynamic-test-run-options.tsx b/web/app/components/workflow/hooks/use-dynamic-test-run-options.tsx
index 05ecba0bc71..b30ced67503 100644
--- a/web/app/components/workflow/hooks/use-dynamic-test-run-options.tsx
+++ b/web/app/components/workflow/hooks/use-dynamic-test-run-options.tsx
@@ -11,7 +11,7 @@ import { BlockEnum } from '../types'
import { getWorkflowEntryNode } from '../utils/workflow-entry'
export const useDynamicTestRunOptions = (): TestRunOptions => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const nodes = useNodes()
const buildInTools = useStore((s) => s.buildInTools)
const customTools = useStore((s) => s.customTools)
diff --git a/web/app/components/workflow/hooks/use-edge-accessible-label.ts b/web/app/components/workflow/hooks/use-edge-accessible-label.ts
index 95711614396..80ec70b3b27 100644
--- a/web/app/components/workflow/hooks/use-edge-accessible-label.ts
+++ b/web/app/components/workflow/hooks/use-edge-accessible-label.ts
@@ -12,7 +12,7 @@ export const useEdgeAccessibleLabel = (
target: string,
sourceHandleId?: string | null,
) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const edgeRef = useRef<SVGGElement>(null)
const label = useStore((state) => {
// React Flow's node map keeps this subscription local to the two endpoints.
diff --git a/web/app/components/workflow/hooks/use-locate-node.ts b/web/app/components/workflow/hooks/use-locate-node.ts
index 4c501af7525..30fea4a34e5 100644
--- a/web/app/components/workflow/hooks/use-locate-node.ts
+++ b/web/app/components/workflow/hooks/use-locate-node.ts
@@ -20,7 +20,7 @@ import { useNodesInteractions } from './use-nodes-interactions'
* A toast message is shown to indicate success or failure.
*/
export const useLocateNode = (nodes: Node[]) => {
- const { t } = useTranslation('workflow')
+ const { t } = useTranslation(['workflow'])
const searchParams = useSearchParams()
const nodeIdFromUrl = searchParams.get('node_id')
const { handleNodeSelect } = useNodesInteractions()
diff --git a/web/app/components/workflow/hooks/use-node-keyboard-interactions.ts b/web/app/components/workflow/hooks/use-node-keyboard-interactions.ts
index e7cd5815688..c48f9852814 100644
--- a/web/app/components/workflow/hooks/use-node-keyboard-interactions.ts
+++ b/web/app/components/workflow/hooks/use-node-keyboard-interactions.ts
@@ -21,7 +21,7 @@ export function useNodeKeyboardInteractions(onSelect: (id: string, cancel?: bool
const { getNodesReadOnly } = useNodesReadOnly()
const { handleSyncWorkflowDraft } = useNodesSyncDraft()
const { saveStateToHistory } = useWorkflowHistory()
- const { t } = useTranslation('workflow')
+ const { t } = useTranslation(['workflow'])
return (event: KeyboardEvent<HTMLDivElement>) => {
const target = event.target
diff --git a/web/app/components/workflow/hooks/use-nodes-available-var-list.ts b/web/app/components/workflow/hooks/use-nodes-available-var-list.ts
index 6ea5e52a315..5250ef950a9 100644
--- a/web/app/components/workflow/hooks/use-nodes-available-var-list.ts
+++ b/web/app/components/workflow/hooks/use-nodes-available-var-list.ts
@@ -50,7 +50,7 @@ const useNodesAvailableVarList = (
filterVar: () => true,
},
) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['snippet'])
const snippetInputFields = useSnippetDraftStore((s) => s.inputFields)
const { getTreeLeafNodes, getBeforeNodesInSameBranchIncludeParent } = useWorkflow()
const { getNodeAvailableVars } = useWorkflowVariables()
@@ -101,7 +101,7 @@ const useNodesAvailableVarList = (
}
export const useGetNodesAvailableVarList = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['snippet'])
const snippetInputFields = useSnippetDraftStore((s) => s.inputFields)
const { getTreeLeafNodes, getBeforeNodesInSameBranchIncludeParent } = useWorkflow()
const { getNodeAvailableVars } = useWorkflowVariables()
diff --git a/web/app/components/workflow/hooks/use-nodes-interactions.ts b/web/app/components/workflow/hooks/use-nodes-interactions.ts
index 0099f3cf8ed..59e4784e108 100644
--- a/web/app/components/workflow/hooks/use-nodes-interactions.ts
+++ b/web/app/components/workflow/hooks/use-nodes-interactions.ts
@@ -163,7 +163,7 @@ const isNoteLinkClickTarget = (target: EventTarget | null, node: Node) => {
}
export const useNodesInteractions = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { data: appDslVersion = '' } = useQuery(
consoleQuery.appDslVersion.get.queryOptions({
staleTime: Infinity,
diff --git a/web/app/components/workflow/hooks/use-workflow-history.ts b/web/app/components/workflow/hooks/use-workflow-history.ts
index 35c97e9c172..011f4dfb0ee 100644
--- a/web/app/components/workflow/hooks/use-workflow-history.ts
+++ b/web/app/components/workflow/hooks/use-workflow-history.ts
@@ -36,7 +36,7 @@ export type WorkflowHistoryEventT = keyof typeof WorkflowHistoryEvent
export const useWorkflowHistory = () => {
const store = useStoreApi()
const { store: workflowHistoryStore } = useWorkflowHistoryStore()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [undoCallbacks, setUndoCallbacks] = useState<(() => void)[]>([])
const [redoCallbacks, setRedoCallbacks] = useState<(() => void)[]>([])
diff --git a/web/app/components/workflow/hooks/use-workflow-variables.ts b/web/app/components/workflow/hooks/use-workflow-variables.ts
index 3b68e44f7b8..2d722372518 100644
--- a/web/app/components/workflow/hooks/use-workflow-variables.ts
+++ b/web/app/components/workflow/hooks/use-workflow-variables.ts
@@ -18,7 +18,7 @@ import { useWorkflowStore } from '../store'
import { useIsChatMode } from './use-workflow'
export const useWorkflowVariables = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const workflowStore = useWorkflowStore()
const { schemaTypeDefinitions } = useMatchSchemaType()
diff --git a/web/app/components/workflow/index.tsx b/web/app/components/workflow/index.tsx
index 7371fd07bd1..11e7fdef49f 100644
--- a/web/app/components/workflow/index.tsx
+++ b/web/app/components/workflow/index.tsx
@@ -185,7 +185,7 @@ export const Workflow: FC<WorkflowProps> = memo(
myUserId,
onlineUsers,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const workflowContainerRef = useRef<HTMLDivElement>(null)
useWorkflowControlScale(workflowContainerRef)
const workflowStore = useWorkflowStore()
diff --git a/web/app/components/workflow/llm-environment-variable-value-field.tsx b/web/app/components/workflow/llm-environment-variable-value-field.tsx
index 26f4b52338d..acdb4a86c72 100644
--- a/web/app/components/workflow/llm-environment-variable-value-field.tsx
+++ b/web/app/components/workflow/llm-environment-variable-value-field.tsx
@@ -23,7 +23,7 @@ export function LLMEnvironmentVariableValueField({
value?: LLMEnvironmentVariableValue
onChange: (value: LLMEnvironmentVariableValue) => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { activeTextGenerationModelList } = useTextGenerationCurrentProviderAndModelAndModelList()
const selectableModelList = requiredMode
? activeTextGenerationModelList
diff --git a/web/app/components/workflow/node-actions-menu/change-block-popup.tsx b/web/app/components/workflow/node-actions-menu/change-block-popup.tsx
index c911cbdc98b..196df998bf1 100644
--- a/web/app/components/workflow/node-actions-menu/change-block-popup.tsx
+++ b/web/app/components/workflow/node-actions-menu/change-block-popup.tsx
@@ -26,7 +26,7 @@ export function ChangeBlockPopup({
sourceHandle,
onComplete,
}: ChangeBlockPopupProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const searchInputRef = useRef<HTMLInputElement>(null)
const completedRef = useRef(false)
const { handleNodeChange } = useNodesInteractions()
diff --git a/web/app/components/workflow/node-actions-menu/context-menu-content.tsx b/web/app/components/workflow/node-actions-menu/context-menu-content.tsx
index 7c44fbf8fa5..926d39bc0f7 100644
--- a/web/app/components/workflow/node-actions-menu/context-menu-content.tsx
+++ b/web/app/components/workflow/node-actions-menu/context-menu-content.tsx
@@ -23,7 +23,7 @@ import {
import { useNodeActionsMenuModel } from './use-node-actions-menu-model'
export function NodeActionsContextMenuContent(props: NodeActionsMenuProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const model = useNodeActionsMenuModel(props)
const hasRunGroup = model.canRun || model.canChangeBlock
const hasEditGroup = !model.nodesReadOnly && !model.isSingleton
diff --git a/web/app/components/workflow/node-actions-menu/dropdown-content.tsx b/web/app/components/workflow/node-actions-menu/dropdown-content.tsx
index 25805dc3ce4..947d4d45771 100644
--- a/web/app/components/workflow/node-actions-menu/dropdown-content.tsx
+++ b/web/app/components/workflow/node-actions-menu/dropdown-content.tsx
@@ -23,7 +23,7 @@ import {
import { useNodeActionsMenuModel } from './use-node-actions-menu-model'
export function NodeActionsDropdownContent(props: NodeActionsMenuProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const model = useNodeActionsMenuModel(props)
const hasRunGroup = model.canRun || model.canChangeBlock
const hasEditGroup = !model.nodesReadOnly && !model.isSingleton
diff --git a/web/app/components/workflow/node-actions-menu/index.tsx b/web/app/components/workflow/node-actions-menu/index.tsx
index 2d6791e35db..0a3d6d898ef 100644
--- a/web/app/components/workflow/node-actions-menu/index.tsx
+++ b/web/app/components/workflow/node-actions-menu/index.tsx
@@ -26,7 +26,7 @@ export function NodeActionsDropdown({
onOpenChange,
showHelpLink = true,
}: NodeActionsDropdownProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [open, setOpen] = useState(false)
const handleOpenChange = useCallback(
diff --git a/web/app/components/workflow/nodes/_base/components/add-variable-popup.tsx b/web/app/components/workflow/nodes/_base/components/add-variable-popup.tsx
index 27670efd15b..2743415386c 100644
--- a/web/app/components/workflow/nodes/_base/components/add-variable-popup.tsx
+++ b/web/app/components/workflow/nodes/_base/components/add-variable-popup.tsx
@@ -8,7 +8,7 @@ type AddVariablePopupProps = {
onSelect: (value: ValueSelector, item: Var) => void
}
const AddVariablePopup = ({ availableVars, onSelect }: AddVariablePopupProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="w-60 rounded-lg border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-lg">
diff --git a/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx b/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx
index 10102103dd7..a8c1ec732b6 100644
--- a/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx
+++ b/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx
@@ -31,7 +31,7 @@ const DEFAULT_TAGS: ListProps['tags'] = []
const NotFoundWarn = (props: { title: string; description: ReactNode }) => {
const { title, description } = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<Infotip>
<InfotipTrigger
@@ -107,7 +107,7 @@ export const AgentStrategySelector = memo((props: AgentStrategySelectorProps) =>
const icon = selectedProvider?.declaration.identity.icon
? getIconUrl(selectedProvider.declaration.identity.icon)
: undefined
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const wrapElemRef = useRef<HTMLDivElement>(null)
diff --git a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx
index de07e16b0e8..92c8b4d6d60 100644
--- a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx
+++ b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx
@@ -89,7 +89,7 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => {
availableNodes,
nodeId,
} = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const docLink = useDocLink()
const defaultModel = useDefaultModel(ModelTypeEnum.textGeneration)
const renderI18nObject = useRenderI18nObject()
diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/bool-input.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/bool-input.tsx
index 9828027c175..a0642f87800 100644
--- a/web/app/components/workflow/nodes/_base/components/before-run-form/bool-input.tsx
+++ b/web/app/components/workflow/nodes/_base/components/before-run-form/bool-input.tsx
@@ -14,7 +14,7 @@ type Props = Readonly<{
}>
const BoolInput: FC<Props> = ({ value, onChange, name, required, readonly }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const handleChange = useCallback(
(checked: boolean) => {
onChange(checked)
diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx
index 875adf8cd21..e90f4292cc2 100644
--- a/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx
+++ b/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx
@@ -54,7 +54,7 @@ const FormItem: FC<Props> = ({
InputVarType.iterator,
]
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'workflow'])
const labelId = React.useId()
const { type } = payload
const fileSettings = useHooksStore((s) => s.configsMap?.fileSettings)
diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/form.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/form.tsx
index b6e74dc0ae0..83cddc40cea 100644
--- a/web/app/components/workflow/nodes/_base/components/before-run-form/form.tsx
+++ b/web/app/components/workflow/nodes/_base/components/before-run-form/form.tsx
@@ -24,7 +24,7 @@ const Form: FC<Props> = ({ className, label, inputs, values, onChange }) => {
InputVarType.iterator,
]
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const mapKeysWithSameValueSelector = useMemo(() => {
const keysWithSameValueSelector = (key: string) => {
const targetValueSelector = inputs.find((item) => item.variable === key)?.value_selector
diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx
index fe961a5c8fd..9d8b60ab04b 100644
--- a/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx
+++ b/web/app/components/workflow/nodes/_base/components/before-run-form/index.tsx
@@ -62,7 +62,7 @@ const BeforeRunForm: FC<BeforeRunFormProps> = ({
handleSubmitHumanInputForm,
handleAfterHumanInputStepRun,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'workflow'])
const translateFormError: BeforeRunFormTranslator = (selector, options) => t(selector, options)
const isHumanInput = nodeType === BlockEnum.HumanInput
diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/panel-wrap.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/panel-wrap.tsx
index 9c45c68112f..1c09660eb9f 100644
--- a/web/app/components/workflow/nodes/_base/components/before-run-form/panel-wrap.tsx
+++ b/web/app/components/workflow/nodes/_base/components/before-run-form/panel-wrap.tsx
@@ -13,7 +13,7 @@ type Props = Readonly<{
}>
const PanelWrap: FC<Props> = ({ nodeName, onHide, children }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="absolute inset-0 z-10 rounded-2xl bg-background-overlay-alt">
<div className="flex h-full flex-col rounded-2xl bg-components-panel-bg">
diff --git a/web/app/components/workflow/nodes/_base/components/branch-list/class-item.tsx b/web/app/components/workflow/nodes/_base/components/branch-list/class-item.tsx
index 807f35333ba..22e39dfec53 100644
--- a/web/app/components/workflow/nodes/_base/components/branch-list/class-item.tsx
+++ b/web/app/components/workflow/nodes/_base/components/branch-list/class-item.tsx
@@ -43,7 +43,7 @@ const ClassItem: FC<Props> = ({
placeholder,
defaultLabel,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const reactId = useId()
const [isEditingLabel, setIsEditingLabel] = useState(false)
const [draftLabel, setDraftLabel] = useState('')
diff --git a/web/app/components/workflow/nodes/_base/components/branch-list/class-label-utils.ts b/web/app/components/workflow/nodes/_base/components/branch-list/class-label-utils.ts
index 80add5b6f5e..1b4042b8158 100644
--- a/web/app/components/workflow/nodes/_base/components/branch-list/class-label-utils.ts
+++ b/web/app/components/workflow/nodes/_base/components/branch-list/class-label-utils.ts
@@ -1,4 +1,5 @@
'use client'
+
import type { TFunction } from 'i18next'
const i18nPrefix = 'nodes.questionClassifiers'
@@ -7,7 +8,7 @@ const DEFAULT_EQUIVALENT_PREFIXES = ['CLASS', '分类', '分類', 'クラス']
const getCanonicalDefaultClassLabel = (index: number) => `${LEGACY_DEFAULT_LABEL_PREFIX} ${index}`
-const getTranslatedDefaultClassLabel = (t: TFunction, index: number) => {
+const getTranslatedDefaultClassLabel = (t: TFunction<['workflow']>, index: number) => {
const translated = t(($) => $[`${i18nPrefix}.defaultLabel`], { ns: 'workflow', index })
if (typeof translated !== 'string') return undefined
@@ -28,13 +29,13 @@ const getTranslatedDefaultClassLabel = (t: TFunction, index: number) => {
const normalizeClassLabel = (label?: string | null) => label?.trim() ?? ''
-export const getDefaultClassLabel = (_t: TFunction, index: number) =>
+export const getDefaultClassLabel = (_t: TFunction<['workflow']>, index: number) =>
getCanonicalDefaultClassLabel(index)
export const getDisplayClassLabel = (
label: string | null | undefined,
index: number,
- t: TFunction,
+ t: TFunction<['workflow']>,
) =>
normalizeClassLabel(label) ||
getTranslatedDefaultClassLabel(t, index) ||
@@ -43,7 +44,7 @@ export const getDisplayClassLabel = (
export const isDefaultClassLabel = (
label: string | null | undefined,
index: number,
- t: TFunction,
+ t: TFunction<['workflow']>,
) => {
const normalizedLabel = normalizeClassLabel(label)
if (!normalizedLabel) return true
@@ -57,7 +58,7 @@ export const isDefaultClassLabel = (
export const getCanonicalClassLabel = (
label: string | null | undefined,
index: number,
- t: TFunction,
+ t: TFunction<['workflow']>,
) => {
const normalizedLabel = normalizeClassLabel(label)
if (!normalizedLabel) return getCanonicalDefaultClassLabel(index)
diff --git a/web/app/components/workflow/nodes/_base/components/branch-list/class-list.tsx b/web/app/components/workflow/nodes/_base/components/branch-list/class-list.tsx
index d8202044388..dfec37804dc 100644
--- a/web/app/components/workflow/nodes/_base/components/branch-list/class-list.tsx
+++ b/web/app/components/workflow/nodes/_base/components/branch-list/class-list.tsx
@@ -61,7 +61,7 @@ const ClassList: FC<Props> = ({
labels,
handleSortTopic = noop,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { handleEdgeDeleteByDeleteBranch } = useEdgesInteractions()
const [collapsed, setCollapsed] = useState(false)
const [storedRenameHintDismissed, setIsRenameHintDismissed] = useInlineLabelHintDismissed()
diff --git a/web/app/components/workflow/nodes/_base/components/branch-list/node-branches.tsx b/web/app/components/workflow/nodes/_base/components/branch-list/node-branches.tsx
index 7d5328e3f86..bac3dd39dd1 100644
--- a/web/app/components/workflow/nodes/_base/components/branch-list/node-branches.tsx
+++ b/web/app/components/workflow/nodes/_base/components/branch-list/node-branches.tsx
@@ -14,7 +14,7 @@ type TruncatedClassItemProps = {
topic: { id: string; name: string; label?: string | null }
index: number
nodeId: string
- t: TFunction
+ t: TFunction<['workflow']>
defaultLabel?: string
}
@@ -72,7 +72,7 @@ export function NodeBranches({
branches: Topic[]
defaultLabel?: (index: number) => string
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="mt-2 space-y-0.5">
{branches.map((topic, index) => (
diff --git a/web/app/components/workflow/nodes/_base/components/code-generator-button.tsx b/web/app/components/workflow/nodes/_base/components/code-generator-button.tsx
index cdf8e753bc8..f58943c21f1 100644
--- a/web/app/components/workflow/nodes/_base/components/code-generator-button.tsx
+++ b/web/app/components/workflow/nodes/_base/components/code-generator-button.tsx
@@ -26,7 +26,7 @@ const CodeGenerateBtn: FC<Props> = ({
codeLanguages,
onGenerated,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const [showAutomatic, setShowAutomatic] = useState(false)
const handleAutomaticRes = useCallback(
(res: GenRes) => {
diff --git a/web/app/components/workflow/nodes/_base/components/config-vision.tsx b/web/app/components/workflow/nodes/_base/components/config-vision.tsx
index 0dc2c4d395a..6a954ffab3d 100644
--- a/web/app/components/workflow/nodes/_base/components/config-vision.tsx
+++ b/web/app/components/workflow/nodes/_base/components/config-vision.tsx
@@ -37,7 +37,7 @@ const ConfigVision: FC<Props> = ({
},
onConfigChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'workflow'])
const filterVar = useCallback((payload: Var) => {
const fileVariableTypes: readonly VarType[] = [VarType.file, VarType.arrayFile]
diff --git a/web/app/components/workflow/nodes/_base/components/editor/base.tsx b/web/app/components/workflow/nodes/_base/components/editor/base.tsx
index 915f9386850..eca085392ac 100644
--- a/web/app/components/workflow/nodes/_base/components/editor/base.tsx
+++ b/web/app/components/workflow/nodes/_base/components/editor/base.tsx
@@ -58,7 +58,7 @@ const Base: FC<Props> = ({
tip,
footer,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const ref = useRef<HTMLDivElement>(null)
const { wrapClassName, wrapStyle, isExpand, setIsExpand, editorExpandHeight } = useToggleExpend({
ref,
diff --git a/web/app/components/workflow/nodes/_base/components/editor/code-editor/editor-support-vars.tsx b/web/app/components/workflow/nodes/_base/components/editor/code-editor/editor-support-vars.tsx
index 5df460f25d0..18c5d703645 100644
--- a/web/app/components/workflow/nodes/_base/components/editor/code-editor/editor-support-vars.tsx
+++ b/web/app/components/workflow/nodes/_base/components/editor/code-editor/editor-support-vars.tsx
@@ -20,7 +20,7 @@ type Props = Readonly<{
EditorProps
const CodeEditor: FC<Props> = ({ availableVars, varList, onAddVar, ...editorProps }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const isLeftBraceRef = useRef(false)
diff --git a/web/app/components/workflow/nodes/_base/components/entry-node-container.tsx b/web/app/components/workflow/nodes/_base/components/entry-node-container.tsx
index cd38785bca4..a7ec4ada178 100644
--- a/web/app/components/workflow/nodes/_base/components/entry-node-container.tsx
+++ b/web/app/components/workflow/nodes/_base/components/entry-node-container.tsx
@@ -20,7 +20,7 @@ const EntryNodeContainer: FC<EntryNodeContainerProps> = ({
customLabel,
nodeType = StartNodeTypeEnum.Trigger,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const label = useMemo(() => {
const translationKey =
diff --git a/web/app/components/workflow/nodes/_base/components/error-handle/default-value.tsx b/web/app/components/workflow/nodes/_base/components/error-handle/default-value.tsx
index ab8c5102fed..a2d6df7d4c2 100644
--- a/web/app/components/workflow/nodes/_base/components/error-handle/default-value.tsx
+++ b/web/app/components/workflow/nodes/_base/components/error-handle/default-value.tsx
@@ -11,7 +11,7 @@ type DefaultValueProps = {
onFormChange: (form: DefaultValueForm) => void
}
const DefaultValue = ({ forms, onFormChange }: DefaultValueProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const id = useId()
return (
diff --git a/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-on-node.tsx b/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-on-node.tsx
index 833ef3a6900..b4cc53be542 100644
--- a/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-on-node.tsx
+++ b/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-on-node.tsx
@@ -9,7 +9,7 @@ import { ErrorHandleTypeEnum } from './types'
type ErrorHandleOnNodeProps = Pick<Node, 'id' | 'data'>
const ErrorHandleOnNode = ({ id, data }: ErrorHandleOnNodeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { error_strategy } = data
const updateNodeInternals = useUpdateNodeInternals()
diff --git a/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-on-panel.tsx b/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-on-panel.tsx
index 2e1173ec1c2..a261983659c 100644
--- a/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-on-panel.tsx
+++ b/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-on-panel.tsx
@@ -24,7 +24,7 @@ type ErrorHandleProps = Pick<Node, 'id' | 'data'>
const ErrorHandle = ({ id, data }: ErrorHandleProps) => {
const titleId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { error_strategy, default_value } = data
const { collapsed, setCollapsed, handleErrorHandleTypeChange } = useErrorHandle(id, data)
const { handleFormChange } = useDefaultValue(id)
diff --git a/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-tip.tsx b/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-tip.tsx
index bcaf2922cb4..3f0b9962d78 100644
--- a/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-tip.tsx
+++ b/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-tip.tsx
@@ -7,7 +7,7 @@ type ErrorHandleTipProps = {
type?: ErrorHandleTypeEnum
}
const ErrorHandleTip = ({ type }: ErrorHandleTipProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const text = useMemo(() => {
if (type === ErrorHandleTypeEnum.failBranch)
diff --git a/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-type-selector.tsx b/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-type-selector.tsx
index 68319404b9c..5222a94f2c8 100644
--- a/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-type-selector.tsx
+++ b/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-type-selector.tsx
@@ -20,7 +20,7 @@ const ErrorHandleTypeSelector = ({
onSelected,
allowDefaultValue = true,
}: ErrorHandleTypeSelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const options = [
{
value: ErrorHandleTypeEnum.none,
diff --git a/web/app/components/workflow/nodes/_base/components/error-handle/fail-branch-card.tsx b/web/app/components/workflow/nodes/_base/components/error-handle/fail-branch-card.tsx
index 91a26216699..c8cab8aab5e 100644
--- a/web/app/components/workflow/nodes/_base/components/error-handle/fail-branch-card.tsx
+++ b/web/app/components/workflow/nodes/_base/components/error-handle/fail-branch-card.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
import { useDocLink } from '@/context/i18n'
const FailBranchCard = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const docLink = useDocLink()
return (
diff --git a/web/app/components/workflow/nodes/_base/components/file-type-item.tsx b/web/app/components/workflow/nodes/_base/components/file-type-item.tsx
index 890e0376ccc..29c5083b0b2 100644
--- a/web/app/components/workflow/nodes/_base/components/file-type-item.tsx
+++ b/web/app/components/workflow/nodes/_base/components/file-type-item.tsx
@@ -35,7 +35,7 @@ const FileTypeItem: FC<Props> = ({
typeErrorId,
customFileTypesErrorId,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const handleOnSelect = useCallback(() => {
onToggle(type)
diff --git a/web/app/components/workflow/nodes/_base/components/file-upload-setting.tsx b/web/app/components/workflow/nodes/_base/components/file-upload-setting.tsx
index edd8dc71600..aa02e7413bb 100644
--- a/web/app/components/workflow/nodes/_base/components/file-upload-setting.tsx
+++ b/web/app/components/workflow/nodes/_base/components/file-upload-setting.tsx
@@ -38,7 +38,7 @@ const FileUploadSetting: FC<Props> = ({
validationError,
onChange,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const errorId = useId()
const typeErrorId = validationError?.field === 'allowed_file_types' ? errorId : undefined
const customFileTypesErrorId =
diff --git a/web/app/components/workflow/nodes/_base/components/form-input-type-switch.tsx b/web/app/components/workflow/nodes/_base/components/form-input-type-switch.tsx
index 37834102bd8..61a71a53151 100644
--- a/web/app/components/workflow/nodes/_base/components/form-input-type-switch.tsx
+++ b/web/app/components/workflow/nodes/_base/components/form-input-type-switch.tsx
@@ -39,7 +39,7 @@ function TypeOption({ children, label, selected, value }: TypeOptionProps) {
}
const FormInputTypeSwitch: FC<Props> = ({ value, onChange, readonly = false }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const variableLabel = t(($) => $['nodes.common.typeSwitch.variable'], { ns: 'workflow' })
const inputLabel = t(($) => $['nodes.common.typeSwitch.input'], { ns: 'workflow' })
diff --git a/web/app/components/workflow/nodes/_base/components/help-link.tsx b/web/app/components/workflow/nodes/_base/components/help-link.tsx
index 84a319771bd..33ea66813d8 100644
--- a/web/app/components/workflow/nodes/_base/components/help-link.tsx
+++ b/web/app/components/workflow/nodes/_base/components/help-link.tsx
@@ -10,7 +10,7 @@ type HelpLinkProps = {
nodeType: BlockEnum
}
const HelpLink = ({ nodeType }: HelpLinkProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const link = useNodeHelpLink(nodeType)
if (!link) return null
diff --git a/web/app/components/workflow/nodes/_base/components/input-support-select-var.tsx b/web/app/components/workflow/nodes/_base/components/input-support-select-var.tsx
index ac6a8944ae4..5b59ed2eec5 100644
--- a/web/app/components/workflow/nodes/_base/components/input-support-select-var.tsx
+++ b/web/app/components/workflow/nodes/_base/components/input-support-select-var.tsx
@@ -42,7 +42,7 @@ const Editor: FC<Props> = ({
availableNodes = [],
insertVarTipToLeft,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [isFocus, { setTrue: setFocus, setFalse: setBlur }] = useBoolean(false)
diff --git a/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx b/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx
index e7fe61bf045..f2764a15635 100644
--- a/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx
+++ b/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx
@@ -17,7 +17,7 @@ type InstallPluginButtonProps = Omit<ButtonProps, 'children' | 'loading'> & {
export const InstallPluginButton = (props: InstallPluginButtonProps) => {
const { className, uniqueIdentifier, extraIdentifiers = [], onSuccess, ...rest } = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { canInstallPlugin } = useWorkspacePluginInstallPermission()
const identifiers = Array.from(
new Set(
diff --git a/web/app/components/workflow/nodes/_base/components/mcp-tool-not-support-tooltip.tsx b/web/app/components/workflow/nodes/_base/components/mcp-tool-not-support-tooltip.tsx
index 5617c5c4514..8251a312820 100644
--- a/web/app/components/workflow/nodes/_base/components/mcp-tool-not-support-tooltip.tsx
+++ b/web/app/components/workflow/nodes/_base/components/mcp-tool-not-support-tooltip.tsx
@@ -6,7 +6,7 @@ import * as React from 'react'
import { useTranslation } from 'react-i18next'
const McpToolNotSupportTooltip: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
const tip = t(($) => $['detailPanel.toolSelector.unsupportedMCPTool'], { ns: 'plugin' })
return (
diff --git a/web/app/components/workflow/nodes/_base/components/memory-config.tsx b/web/app/components/workflow/nodes/_base/components/memory-config.tsx
index 25f5ac26420..6f253df085a 100644
--- a/web/app/components/workflow/nodes/_base/components/memory-config.tsx
+++ b/web/app/components/workflow/nodes/_base/components/memory-config.tsx
@@ -74,7 +74,7 @@ const MemoryConfig: FC<Props> = ({
canSetRoleName = false,
defaultMemory = MEMORY_DEFAULT,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const payload = config.data
const windowInputId = useId()
const windowSize = payload?.window?.size ?? WINDOW_SIZE_DEFAULT
diff --git a/web/app/components/workflow/nodes/_base/components/next-step/add.tsx b/web/app/components/workflow/nodes/_base/components/next-step/add.tsx
index 4c189e580c2..66d1b612abc 100644
--- a/web/app/components/workflow/nodes/_base/components/next-step/add.tsx
+++ b/web/app/components/workflow/nodes/_base/components/next-step/add.tsx
@@ -17,7 +17,7 @@ type AddProps = {
isFailBranch?: boolean
}
const Add = ({ nodeId, nodeData, sourceHandle, isParallel, isFailBranch }: AddProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const { handleNodeAdd } = useNodesInteractions()
const { nodesReadOnly } = useNodesReadOnly()
diff --git a/web/app/components/workflow/nodes/_base/components/next-step/index.tsx b/web/app/components/workflow/nodes/_base/components/next-step/index.tsx
index 13211a38d5b..df80ba801cf 100644
--- a/web/app/components/workflow/nodes/_base/components/next-step/index.tsx
+++ b/web/app/components/workflow/nodes/_base/components/next-step/index.tsx
@@ -16,7 +16,7 @@ type NextStepProps = {
selectedNode: Node
}
const NextStep = ({ selectedNode }: NextStepProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const data = selectedNode.data
const toolIcon = useToolIcon(data)
const branches = useMemo(() => {
diff --git a/web/app/components/workflow/nodes/_base/components/next-step/item.tsx b/web/app/components/workflow/nodes/_base/components/next-step/item.tsx
index ea3975da27a..bfb65be862d 100644
--- a/web/app/components/workflow/nodes/_base/components/next-step/item.tsx
+++ b/web/app/components/workflow/nodes/_base/components/next-step/item.tsx
@@ -15,7 +15,7 @@ type ItemProps = {
data: CommonNodeType
}
const Item = ({ nodeId, sourceHandle, data }: ItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const { nodesReadOnly } = useNodesReadOnly()
const { handleNodeSelect } = useNodesInteractions()
diff --git a/web/app/components/workflow/nodes/_base/components/next-step/operator.tsx b/web/app/components/workflow/nodes/_base/components/next-step/operator.tsx
index 69a124f3d11..10674691650 100644
--- a/web/app/components/workflow/nodes/_base/components/next-step/operator.tsx
+++ b/web/app/components/workflow/nodes/_base/components/next-step/operator.tsx
@@ -23,7 +23,7 @@ type ChangeItemProps = {
sourceHandle: string
}
const ChangeItem = ({ data, nodeId, sourceHandle }: ChangeItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { handleNodeChange } = useNodesInteractions()
const nodeCatalogType = getNodeCatalogType(data)
@@ -78,7 +78,7 @@ type OperatorProps = {
sourceHandle: string
}
const Operator = ({ open, onOpenChange, data, nodeId, sourceHandle }: OperatorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const { handleNodeDelete, handleNodeDisconnect } = useNodesInteractions()
return (
diff --git a/web/app/components/workflow/nodes/_base/components/node-control.tsx b/web/app/components/workflow/nodes/_base/components/node-control.tsx
index 856d9c11c4b..a862c684506 100644
--- a/web/app/components/workflow/nodes/_base/components/node-control.tsx
+++ b/web/app/components/workflow/nodes/_base/components/node-control.tsx
@@ -16,7 +16,7 @@ type NodeControlProps = Pick<Node, 'id' | 'data'> & {
pluginInstallLocked?: boolean
}
const NodeControl: FC<NodeControlProps> = ({ id, data, pluginInstallLocked }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { handleNodeSelect } = useNodesInteractions()
const nodesReadOnly = useNodesReadOnly()
const workflowStore = useWorkflowStore()
diff --git a/web/app/components/workflow/nodes/_base/components/node-handle.tsx b/web/app/components/workflow/nodes/_base/components/node-handle.tsx
index 647aa322da0..4ea57ec9268 100644
--- a/web/app/components/workflow/nodes/_base/components/node-handle.tsx
+++ b/web/app/components/workflow/nodes/_base/components/node-handle.tsx
@@ -150,7 +150,7 @@ export const NodeSourceHandle = memo(
nodeSelectorClassName,
showExceptionStatus,
}: NodeHandleProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const shouldAutoOpenStartNodeSelector = useStore((s) => s.shouldAutoOpenStartNodeSelector)
const setShouldAutoOpenStartNodeSelector = useStore((s) => s.setShouldAutoOpenStartNodeSelector)
const setHasSelectedStartNode = useStore((s) => s.setHasSelectedStartNode)
diff --git a/web/app/components/workflow/nodes/_base/components/node-resizer.tsx b/web/app/components/workflow/nodes/_base/components/node-resizer.tsx
index dcaa1800342..57e40e99882 100644
--- a/web/app/components/workflow/nodes/_base/components/node-resizer.tsx
+++ b/web/app/components/workflow/nodes/_base/components/node-resizer.tsx
@@ -41,7 +41,7 @@ const NodeResizer = ({
minHeight = 152,
maxWidth,
}: NodeResizerProps) => {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const descriptionId = useId()
const didDragRef = useRef(false)
const { getNode, getNodes } = useReactFlow<CommonNodeType>()
diff --git a/web/app/components/workflow/nodes/_base/components/output-vars.tsx b/web/app/components/workflow/nodes/_base/components/output-vars.tsx
index a08d6d6a458..046ff909c80 100644
--- a/web/app/components/workflow/nodes/_base/components/output-vars.tsx
+++ b/web/app/components/workflow/nodes/_base/components/output-vars.tsx
@@ -16,7 +16,7 @@ type Props = Readonly<{
}>
const OutputVars: FC<Props> = ({ title, children, operations, collapsed, onCollapse }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<FieldCollapse
title={title || t(($) => $['nodes.common.outputVars'], { ns: 'workflow' })}
diff --git a/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx b/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx
index 298dff6f107..b905e13db12 100644
--- a/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx
+++ b/web/app/components/workflow/nodes/_base/components/prompt/editor.tsx
@@ -107,7 +107,7 @@ const Editor: FC<Props> = ({
editorContainerClassName,
required,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const { eventEmitter } = useEventEmitterContextContext()
const controlPromptEditorRerenderKey = useStore((s) => s.controlPromptEditorRerenderKey)
diff --git a/web/app/components/workflow/nodes/_base/components/remove-button.tsx b/web/app/components/workflow/nodes/_base/components/remove-button.tsx
index cb80ee6dec0..8ed116609a2 100644
--- a/web/app/components/workflow/nodes/_base/components/remove-button.tsx
+++ b/web/app/components/workflow/nodes/_base/components/remove-button.tsx
@@ -10,7 +10,7 @@ type Props = Readonly<{
}>
const Remove: FC<Props> = ({ onClick }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<IconButton
aria-label={t(($) => $['operation.remove'], { ns: 'common' })}
diff --git a/web/app/components/workflow/nodes/_base/components/remove-effect-var-confirm.tsx b/web/app/components/workflow/nodes/_base/components/remove-effect-var-confirm.tsx
index 4560813f628..608cbbe31cf 100644
--- a/web/app/components/workflow/nodes/_base/components/remove-effect-var-confirm.tsx
+++ b/web/app/components/workflow/nodes/_base/components/remove-effect-var-confirm.tsx
@@ -20,7 +20,7 @@ type Props = Readonly<{
const i18nPrefix = 'common.effectVarConfirm'
const RemoveVarConfirm: FC<Props> = ({ isShow, onConfirm, onCancel }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const title = t(($) => $[`${i18nPrefix}.title`], { ns: 'workflow' })
const content = t(($) => $[`${i18nPrefix}.content`], { ns: 'workflow' })
diff --git a/web/app/components/workflow/nodes/_base/components/retry/retry-on-node.tsx b/web/app/components/workflow/nodes/_base/components/retry/retry-on-node.tsx
index 5b83883562f..e30c7a7e35f 100644
--- a/web/app/components/workflow/nodes/_base/components/retry/retry-on-node.tsx
+++ b/web/app/components/workflow/nodes/_base/components/retry/retry-on-node.tsx
@@ -7,7 +7,7 @@ import { NodeRunningStatus } from '@/app/components/workflow/types'
type RetryOnNodeProps = Pick<Node, 'id' | 'data'>
const RetryOnNode = ({ data }: RetryOnNodeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { retry_config } = data
const showSelectedBorder = data.selected || data._isBundled || data._isEntering
const { isRunning, isSuccessful, isException, isFailed } = useMemo(() => {
diff --git a/web/app/components/workflow/nodes/_base/components/retry/retry-on-panel.tsx b/web/app/components/workflow/nodes/_base/components/retry/retry-on-panel.tsx
index 8bffcf30545..48105db4978 100644
--- a/web/app/components/workflow/nodes/_base/components/retry/retry-on-panel.tsx
+++ b/web/app/components/workflow/nodes/_base/components/retry/retry-on-panel.tsx
@@ -22,7 +22,7 @@ import { useRetryConfig } from './hooks'
type RetryOnPanelProps = Pick<Node, 'id' | 'data'>
const RetryOnPanel = ({ id, data }: RetryOnPanelProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { handleRetryConfigChange } = useRetryConfig(id)
const { retry_config } = data
const retryEnabledId = useId()
diff --git a/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx b/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx
index 8715b6030a1..0a36357749e 100644
--- a/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx
+++ b/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx
@@ -63,7 +63,7 @@ export const SwitchPluginVersion: FC<SwitchPluginVersionProps> = (props) => {
},
)
}
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
// Guard against null/undefined uniqueIdentifier to prevent app crash
if (!uniqueIdentifier || !pluginId || !canUpdatePlugin) return null
diff --git a/web/app/components/workflow/nodes/_base/components/title-description-input.tsx b/web/app/components/workflow/nodes/_base/components/title-description-input.tsx
index 33c58c99138..d48f692ea2d 100644
--- a/web/app/components/workflow/nodes/_base/components/title-description-input.tsx
+++ b/web/app/components/workflow/nodes/_base/components/title-description-input.tsx
@@ -8,7 +8,7 @@ type TitleInputProps = {
}
export const TitleInput = memo(({ value, onBlur }: TitleInputProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const inputId = useId()
const [localValue, setLocalValue] = useState(value)
@@ -64,7 +64,7 @@ type DescriptionInputProps = {
onChange: (value: string) => void
}
export const DescriptionInput = memo(({ value, onChange }: DescriptionInputProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const inputId = useId()
const [focus, setFocus] = useState(false)
const handleFocus = useCallback(() => {
diff --git a/web/app/components/workflow/nodes/_base/components/toggle-expand-btn.tsx b/web/app/components/workflow/nodes/_base/components/toggle-expand-btn.tsx
index 1f1779a54eb..4ea0d0e677c 100644
--- a/web/app/components/workflow/nodes/_base/components/toggle-expand-btn.tsx
+++ b/web/app/components/workflow/nodes/_base/components/toggle-expand-btn.tsx
@@ -12,7 +12,7 @@ type Props = Readonly<{
}>
const ExpandBtn: FC<Props> = ({ isExpand, onExpandChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['share'])
const handleToggle = useCallback(() => {
onExpandChange(!isExpand)
}, [isExpand, onExpandChange])
diff --git a/web/app/components/workflow/nodes/_base/components/variable-tag.tsx b/web/app/components/workflow/nodes/_base/components/variable-tag.tsx
index 413fd456532..4ee9c04c270 100644
--- a/web/app/components/workflow/nodes/_base/components/variable-tag.tsx
+++ b/web/app/components/workflow/nodes/_base/components/variable-tag.tsx
@@ -62,7 +62,7 @@ const VariableTag = ({ valueSelector, varType, isShort, availableNodes }: Variab
})
}, [node, reactflow, store])
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<VariableLabelInSelect
variables={valueSelector}
diff --git a/web/app/components/workflow/nodes/_base/components/variable/manage-input-field.tsx b/web/app/components/workflow/nodes/_base/components/variable/manage-input-field.tsx
index e5d732f08ba..6f5d7c2e3f9 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/manage-input-field.tsx
+++ b/web/app/components/workflow/nodes/_base/components/variable/manage-input-field.tsx
@@ -6,7 +6,7 @@ type ManageInputFieldProps = {
}
const ManageInputField = ({ onManage }: ManageInputFieldProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['pipeline'])
return (
<div className="flex items-center border-t border-divider-subtle pt-1">
diff --git a/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/picker/field.tsx b/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/picker/field.tsx
index 6788f1de775..8fa91d914f8 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/picker/field.tsx
+++ b/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/picker/field.tsx
@@ -23,7 +23,7 @@ type Props = Readonly<{
}>
const Field: FC<Props> = ({ valueSelector, name, payload, depth = 1, readonly, onSelect }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const isLastFieldHighlight = readonly
const hasChildren = payload.type === Type.object && payload.properties
const isHighlight = isLastFieldHighlight && !hasChildren
diff --git a/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/show/field.tsx b/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/show/field.tsx
index 607997f11ff..f358b300167 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/show/field.tsx
+++ b/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/show/field.tsx
@@ -17,7 +17,7 @@ type Props = Readonly<{
}>
const Field: FC<Props> = ({ name, payload, depth = 1, required, rootClassName }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const isRoot = depth === 1
const schema = payload && typeof payload === 'object' && !Array.isArray(payload) ? payload : {}
const type =
diff --git a/web/app/components/workflow/nodes/_base/components/variable/output-var-list.tsx b/web/app/components/workflow/nodes/_base/components/variable/output-var-list.tsx
index d018e9a967f..70b584abb84 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/output-var-list.tsx
+++ b/web/app/components/workflow/nodes/_base/components/variable/output-var-list.tsx
@@ -22,7 +22,7 @@ type Props = Readonly<{
}>
const OutputVarList: FC<Props> = ({ readonly, outputs, outputKeyOrders, onChange, onRemove }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'workflow'])
const list = outputKeyOrders.map((key) => {
return {
diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts
index 809421ae7dd..3afc68b546a 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts
+++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts
@@ -71,7 +71,7 @@ import { Type } from '../../../llm/types'
type WorkflowTranslate = <const Selector extends SelectorParam<'workflow'>>(
selector: Selector,
options: { ns: 'workflow' } & Record<string, unknown>,
-) => ReturnType<TFunction>
+) => ReturnType<TFunction<['workflow']>>
const translateWorkflowString = <const Selector extends SelectorParam<'workflow'>>(
t: WorkflowTranslate,
diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-list.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-list.tsx
index 909ab31815c..75310b137ef 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/var-list.tsx
+++ b/web/app/components/workflow/nodes/_base/components/variable/var-list.tsx
@@ -40,7 +40,7 @@ const VarList: FC<Props> = ({
filterVar,
isSupportFileVar = true,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'workflow'])
const variableNameLabel = t(($) => $['common.variableNamePlaceholder'], { ns: 'workflow' })
const keyboardSort = useKeyboardSortable({
diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.trigger.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.trigger.tsx
index 764fa716f6d..3c514584822 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.trigger.tsx
+++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.trigger.tsx
@@ -126,7 +126,7 @@ const VarReferencePickerTrigger: FC<Props> = ({
varName,
variableCategory,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const handleTriggerReadonlyClick = (e: React.MouseEvent<HTMLElement>) => {
if (!readonly) return
e.preventDefault()
diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx
index a26580c003b..452a5fca058 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx
+++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx
@@ -122,7 +122,7 @@ const VarReferencePicker: FC<Props> = ({
currentProvider,
preferSchemaType,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const store = useStoreApi()
const nodes = useNodes<CommonNodeType>()
const isChatMode = useIsChatMode()
diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-popup.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-popup.tsx
index d60427d5d14..27aaacc4c8f 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-popup.tsx
+++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-popup.tsx
@@ -26,7 +26,7 @@ const VarReferencePopup: FC<Props> = ({
isSupportFileVar = true,
preferSchemaType,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const pipelineId = useStore((s) => s.pipelineId)
const showManageRagInputFields = useMemo(() => !!pipelineId, [pipelineId])
const setShowInputFieldPanel = useStore((s) => s.setShowInputFieldPanel)
diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx
index b922c828883..2ebe64fb818 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx
+++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.tsx
@@ -356,7 +356,7 @@ const VarReferenceVars: FC<Props> = ({
searchInputRef: externalSearchInputRef,
preferSchemaType,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const [internalSearchValue, setInternalSearchValue] = useState('')
const listRef = useRef<HTMLDivElement>(null)
const internalSearchInputRef = useRef<HTMLInputElement>(null)
diff --git a/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx b/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx
index c5be59c9f37..e87c296f909 100644
--- a/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx
+++ b/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx
@@ -94,7 +94,7 @@ type BasePanelProps = {
}
const BasePanel: FC<BasePanelProps> = ({ id, data, children }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const panelId = useId()
const language = useLanguage()
const appId = useStore((s) => s.appId)
diff --git a/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/no-data.tsx b/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/no-data.tsx
index 4a1308449a2..586a0712959 100644
--- a/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/no-data.tsx
+++ b/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/no-data.tsx
@@ -11,7 +11,7 @@ type Props = Readonly<{
}>
const NoData: FC<Props> = ({ canSingleRun, onSingleRun }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="flex h-0 grow flex-col items-center justify-center">
<span
diff --git a/web/app/components/workflow/nodes/_base/components/workflow-panel/start-placeholder-panel.tsx b/web/app/components/workflow/nodes/_base/components/workflow-panel/start-placeholder-panel.tsx
index 67416144904..26f77bbb8d3 100644
--- a/web/app/components/workflow/nodes/_base/components/workflow-panel/start-placeholder-panel.tsx
+++ b/web/app/components/workflow/nodes/_base/components/workflow-panel/start-placeholder-panel.tsx
@@ -2,7 +2,7 @@ import type { ReactNode } from 'react'
import { useTranslation } from 'react-i18next'
export function StartPlaceholderPanelTitle() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="mr-2 min-w-0 grow system-xl-semibold text-text-primary">
@@ -12,7 +12,7 @@ export function StartPlaceholderPanelTitle() {
}
export function StartPlaceholderPanelDescription() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="px-4 pb-3 system-xs-regular text-text-tertiary">
diff --git a/web/app/components/workflow/nodes/_base/hooks/use-available-var-list.ts b/web/app/components/workflow/nodes/_base/hooks/use-available-var-list.ts
index bdd628d7459..44eaf4470cb 100644
--- a/web/app/components/workflow/nodes/_base/hooks/use-available-var-list.ts
+++ b/web/app/components/workflow/nodes/_base/hooks/use-available-var-list.ts
@@ -31,7 +31,7 @@ const useAvailableVarList = (
filterVar: () => true,
},
) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['snippet'])
const snippetInputFields = useSnippetDraftStore((s) => s.inputFields)
const { getTreeLeafNodes, getNodeById, getBeforeNodesInSameBranchIncludeParent } = useWorkflow()
const { getNodeAvailableVars } = useWorkflowVariables()
diff --git a/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts b/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts
index 46ddadc6547..ddee45df591 100644
--- a/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts
+++ b/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts
@@ -162,7 +162,7 @@ const useOneStepRun = <T>({
isRunAfterSingleRun,
isPaused,
}: Params<T>) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const { getBeforeNodesInSameBranch, getBeforeNodesInSameBranchIncludeParent } =
useWorkflow() as any
const conversationVariables = useStore((s) => s.conversationVariables)
diff --git a/web/app/components/workflow/nodes/_base/node.tsx b/web/app/components/workflow/nodes/_base/node.tsx
index 421d394c30d..1aa937eee22 100644
--- a/web/app/components/workflow/nodes/_base/node.tsx
+++ b/web/app/components/workflow/nodes/_base/node.tsx
@@ -50,7 +50,7 @@ type BaseNodeProps = {
}
const BaseNode: FC<BaseNodeProps> = ({ id, data, children }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin', 'workflow'])
const translateWorkflow: WorkflowTranslator = (selector, options) => t(selector, options)
const nodeRef = useRef<HTMLDivElement>(null)
const { nodesReadOnly } = useNodesReadOnly()
diff --git a/web/app/components/workflow/nodes/agent-v2/components/agent-orchestrate-panel-content.tsx b/web/app/components/workflow/nodes/agent-v2/components/agent-orchestrate-panel-content.tsx
index 77762391130..6da308865f9 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/agent-orchestrate-panel-content.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/agent-orchestrate-panel-content.tsx
@@ -291,8 +291,8 @@ function WorkflowInlineAgentConfigureWorkspaceContent({
agentSoulConfig: AgentSoulConfig
buildDraft: ReturnType<typeof useAgentConfigureBuildDraftData>
}) {
- const { t } = useTranslation('common')
- const { t: tAgent } = useTranslation('agentV2')
+ const { t } = useTranslation(['common'])
+ const { t: tAgent } = useTranslation(['agentV2'])
const agentScope = useInlineAgentScope()
const queryClient = useQueryClient()
const jotaiStore = useJotaiStore()
@@ -815,7 +815,7 @@ function WorkflowInlineAgentConfigureMoreAction({
}: {
onSaveInlineToRoster: () => void
}) {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common', 'agentV2'])
const canCreateAgents = useCanCreateAgents()
if (!canCreateAgents) return null
diff --git a/web/app/components/workflow/nodes/agent-v2/components/agent-output-routes.tsx b/web/app/components/workflow/nodes/agent-v2/components/agent-output-routes.tsx
index 72813810d11..7dcfe837997 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/agent-output-routes.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/agent-output-routes.tsx
@@ -19,7 +19,7 @@ const filterVar = (variable: Var) =>
variable.type === VarType.string || variable.type === VarType.number
export function AgentOutputRoutes({ id, data }: NodeProps<AgentV2NodeType>) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { nodesReadOnly, getNodesReadOnly } = useNodesReadOnly()
const { removeBranchEdges } = useEdgesInteractions()
const { handleNodeDataUpdate } = useNodeDataUpdate()
diff --git a/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/edit-card.tsx b/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/edit-card.tsx
index 950922ec7dc..657af3e6d99 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/edit-card.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/edit-card.tsx
@@ -56,7 +56,7 @@ export function OutputEditCard({
onCancel: () => void
onConfirm: (output: DeclaredOutputConfig, state: EditingState) => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const nameErrorId = useId()
const editorRef = useRef<HTMLDivElement>(null)
const [draft, setDraft] = useState(state.draft)
diff --git a/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/index.tsx b/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/index.tsx
index 98aa9614e46..4d7600b108c 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/index.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/index.tsx
@@ -41,7 +41,7 @@ function OutputRow({
onDelete: () => void
onEdit: () => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow', 'common'])
const description = getOutputDescription(output, t)
return (
<div className="group flex min-h-12 flex-col rounded-lg py-0.5 focus-within:bg-state-base-hover hover:bg-state-base-hover">
@@ -124,7 +124,7 @@ export function AgentOutputVariables({
collapsed,
onCollapse,
}: AgentOutputVariablesProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [editingState, setEditingState] = useState<EditingState | null>(null)
const [internalCollapsed, setInternalCollapsed] = useState(true)
const isCollapsed = collapsed ?? internalCollapsed
diff --git a/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/type-select.tsx b/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/type-select.tsx
index 1b1761e0775..a23107ba4ac 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/type-select.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/type-select.tsx
@@ -18,7 +18,7 @@ export function OutputTypeSelect({
value: OutputTypeOptionValue
onChange: (value: OutputTypeOptionValue) => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const selected = getOutputTypeOption(value)
return (
diff --git a/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/utils.ts b/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/utils.ts
index 6febe500c8f..a9739a7d5c1 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/utils.ts
+++ b/web/app/components/workflow/nodes/agent-v2/components/agent-output-variables/utils.ts
@@ -282,7 +282,7 @@ export function isDefaultOutput(output: DeclaredOutputConfig) {
return AGENT_V2_RESERVED_OUTPUT_NAMES.has(output.name)
}
-export function getOutputDescription(output: EditableOutputConfig, t: TFunction) {
+export function getOutputDescription(output: EditableOutputConfig, t: TFunction<['workflow']>) {
if (output.name === 'text') return t(($) => $['nodes.agent.outputVars.text'], { ns: 'workflow' })
if (output.name === 'switch')
return t(($) => $['nodes.agent.outputVars.switch'], { ns: 'workflow' })
diff --git a/web/app/components/workflow/nodes/agent-v2/components/agent-roster-field.tsx b/web/app/components/workflow/nodes/agent-v2/components/agent-roster-field.tsx
index 5e8a20d0814..5e41ac676f4 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/agent-roster-field.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/agent-roster-field.tsx
@@ -123,7 +123,7 @@ function AgentRosterDrawer({
onSaveInlineToRoster?: () => void
onClose: () => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['agentV2', 'common', 'workflow'])
const canCreateAgents = useCanCreateAgents()
const isSetup = mode === 'setup'
const title = isInlineSetup
@@ -303,7 +303,7 @@ function AgentRosterInlineConfigureDialog({
trigger: ReactElement
onOpenChange: (open: boolean) => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<Dialog open={open} onOpenChange={onOpenChange} disablePointerDismissal>
@@ -362,7 +362,7 @@ export function AgentRosterField({
onSaveInlineToRoster?: () => void
onStartFromScratch?: () => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['agentV2', 'common', 'workflow'])
const [localPanelOpen, setLocalPanelOpen] = useState(false)
const [isSelectorOpen, setIsSelectorOpen] = useState(false)
const panelOpen = isPanelOpen ?? localPanelOpen
diff --git a/web/app/components/workflow/nodes/agent-v2/components/agent-task-field.tsx b/web/app/components/workflow/nodes/agent-v2/components/agent-task-field.tsx
index 137c46cca45..bb430bdaf5d 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/agent-task-field.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/agent-task-field.tsx
@@ -20,7 +20,7 @@ import useAvailableVarList from '../../_base/hooks/use-available-var-list'
const i18nPrefix = 'nodes.agent'
function AgentTaskToolbar({ taskLength, onInsert }: { taskLength: number; onInsert: () => void }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [editor] = useLexicalComposerContext()
const handleInsert = useCallback(() => {
@@ -70,7 +70,7 @@ export function AgentTaskField({
}) {
const taskLabelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const docLink = useDocLink()
const getVarType = useWorkflowVariableType()
const { availableVars, availableNodesWithParent } = useAvailableVarList(id)
diff --git a/web/app/components/workflow/nodes/agent-v2/components/edit-in-console-link.tsx b/web/app/components/workflow/nodes/agent-v2/components/edit-in-console-link.tsx
index f7a1b07b719..6f5a83c7ab5 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/edit-in-console-link.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/edit-in-console-link.tsx
@@ -7,7 +7,7 @@ import Link from '@/next/link'
const layoutClassName = 'min-w-0 flex-1 px-3'
export function EditInConsoleLink({ agentId }: { agentId: string }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const label = t(($) => $['nodes.agent.roster.editInConsole'], { ns: 'workflow' })
return (
diff --git a/web/app/components/workflow/nodes/agent-v2/components/save-inline-agent-to-roster-dialog.tsx b/web/app/components/workflow/nodes/agent-v2/components/save-inline-agent-to-roster-dialog.tsx
index d86fbc8cf02..eeab5488a84 100644
--- a/web/app/components/workflow/nodes/agent-v2/components/save-inline-agent-to-roster-dialog.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/components/save-inline-agent-to-roster-dialog.tsx
@@ -52,8 +52,8 @@ function SaveInlineAgentToRosterFormSession({
onCancel,
onSubmit,
}: SaveInlineAgentToRosterFormSessionProps) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const [initialValues] = useState(() => ({
fields: {
description: initialAgent.description ?? '',
@@ -118,7 +118,7 @@ export function SaveInlineAgentToRosterDialog({
onOpenChange,
onSaved,
}: SaveInlineAgentToRosterDialogProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2', 'common'])
const nameInputRef = useRef<HTMLInputElement>(null)
const appSaveToRosterMutation = useMutation(
consoleQuery.apps.byAppId.workflows.draft.nodes.byNodeId.agentComposer.saveToRoster.post.mutationOptions(),
diff --git a/web/app/components/workflow/nodes/agent-v2/default.ts b/web/app/components/workflow/nodes/agent-v2/default.ts
index 8e695de336e..8cf6176d2b3 100644
--- a/web/app/components/workflow/nodes/agent-v2/default.ts
+++ b/web/app/components/workflow/nodes/agent-v2/default.ts
@@ -20,7 +20,7 @@ const nodeDefault: NodeDefault<AgentV2NodeType> = {
agent_node_kind: 'dify_agent',
version: '2',
},
- checkValid(payload, t: TFunction<'workflow'>) {
+ checkValid(payload, t: TFunction<['workflow']>) {
if (!hasValidAgentBinding(payload)) {
return {
isValid: false,
diff --git a/web/app/components/workflow/nodes/agent-v2/hooks.ts b/web/app/components/workflow/nodes/agent-v2/hooks.ts
index 9af87c29ae8..fa77a0ced10 100644
--- a/web/app/components/workflow/nodes/agent-v2/hooks.ts
+++ b/web/app/components/workflow/nodes/agent-v2/hooks.ts
@@ -99,7 +99,7 @@ export function useWorkflowInlineAgentDetail(
}
export function useCreateInlineAgentBinding() {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const configsMap = useHooksStore((state) => state.configsMap)
const agentScope = useInlineAgentScope()
const { data: defaultModel } = useDefaultModel(ModelTypeEnum.textGeneration)
diff --git a/web/app/components/workflow/nodes/agent-v2/node.tsx b/web/app/components/workflow/nodes/agent-v2/node.tsx
index ecaf2c5ba9f..a95b86e5a90 100644
--- a/web/app/components/workflow/nodes/agent-v2/node.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/node.tsx
@@ -58,7 +58,7 @@ function AgentNodeModel({
agent?: ReturnType<typeof useAgentRosterDetail>['data']
isLoading: boolean
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const isInlineAgent = hasInlineAgentBinding(data)
const name = isInlineAgent
? t(($) => $['nodes.agent.roster.inlineSetup.name'], { ns: 'workflow' })
@@ -105,7 +105,7 @@ export function AgentV2Node(props: NodeProps<AgentV2NodeType>) {
useEffect(() => {
updateNodeInternals(id)
}, [id, data.agent_output_routes, updateNodeInternals])
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const hasValidAgent = hasValidRosterAgentBinding(data)
const isInlineAgent = hasInlineAgentBinding(data)
const rosterAgentId =
diff --git a/web/app/components/workflow/nodes/agent-v2/panel.tsx b/web/app/components/workflow/nodes/agent-v2/panel.tsx
index fe149b2cd64..3ae8775205a 100644
--- a/web/app/components/workflow/nodes/agent-v2/panel.tsx
+++ b/web/app/components/workflow/nodes/agent-v2/panel.tsx
@@ -118,7 +118,7 @@ function FloatingOutputEditor({
}
export function AgentV2Panel({ id, data }: NodePanelProps<AgentV2NodeType>) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['agentV2', 'workflow'])
const { inputs, setInputs } = useNodeCrud<AgentV2NodeType>(id, data)
const inputsRef = useRef(inputs)
const promptOutputNamesRef = useRefWithInit(extractAgentOutputNames, inputs.agent_task || '')
diff --git a/web/app/components/workflow/nodes/agent/components/model-bar.tsx b/web/app/components/workflow/nodes/agent/components/model-bar.tsx
index 5e2d9c8d553..4b4bbf8850c 100644
--- a/web/app/components/workflow/nodes/agent/components/model-bar.tsx
+++ b/web/app/components/workflow/nodes/agent/components/model-bar.tsx
@@ -69,7 +69,7 @@ const useAllModel = () => {
}
export const ModelBar: FC<ModelBarProps> = (props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const modelList = useAllModel()
if (props.provider === undefined) {
const tooltip = t(($) => $['nodes.agent.modelNotSelected'], { ns: 'workflow' })
diff --git a/web/app/components/workflow/nodes/agent/components/tool-icon.tsx b/web/app/components/workflow/nodes/agent/components/tool-icon.tsx
index 1298a683169..e919e421084 100644
--- a/web/app/components/workflow/nodes/agent/components/tool-icon.tsx
+++ b/web/app/components/workflow/nodes/agent/components/tool-icon.tsx
@@ -61,7 +61,7 @@ export const ToolIcon = memo(({ providerName }: ToolIconProps) => {
const indicator =
status === 'not-installed' ? 'error' : status === 'not-authorized' ? 'warning' : undefined
const notSuccess = (['not-installed', 'not-authorized'] as Array<Status>).includes(status)
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const tooltip = useMemo(() => {
if (!notSuccess) return undefined
if (status === 'not-installed')
diff --git a/web/app/components/workflow/nodes/agent/default.ts b/web/app/components/workflow/nodes/agent/default.ts
index ccb4a0af8a7..07d63b5f1f3 100644
--- a/web/app/components/workflow/nodes/agent/default.ts
+++ b/web/app/components/workflow/nodes/agent/default.ts
@@ -23,7 +23,7 @@ const nodeDefault: NodeDefault<AgentNodeType> = {
},
checkValid(
payload,
- t: TFunction<'workflow'>,
+ t: TFunction<['workflow']>,
moreDataForCheckValid: {
strategyProvider?: AgentProviderResponse
strategy?: AgentStrategyEntity
diff --git a/web/app/components/workflow/nodes/agent/node.tsx b/web/app/components/workflow/nodes/agent/node.tsx
index 810a9cf664f..c95a614cfc7 100644
--- a/web/app/components/workflow/nodes/agent/node.tsx
+++ b/web/app/components/workflow/nodes/agent/node.tsx
@@ -18,7 +18,7 @@ const AgentNode: FC<NodeProps<AgentNodeType>> = (props) => {
props.data,
)
const renderI18nObject = useRenderI18nObject()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const models = useMemo(() => {
if (!inputs) return []
// if selected, show in node
diff --git a/web/app/components/workflow/nodes/agent/panel.tsx b/web/app/components/workflow/nodes/agent/panel.tsx
index 1d56774e750..c6b8d82b44e 100644
--- a/web/app/components/workflow/nodes/agent/panel.tsx
+++ b/web/app/components/workflow/nodes/agent/panel.tsx
@@ -29,7 +29,7 @@ const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (props) => {
outputSchema,
handleMemoryChange,
} = useConfig(props.id, props.data)
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const isMCPVersionSupported = isSupportMCP(inputs.meta?.version ?? undefined)
const resetEditor = useStore((s) => s.setControlPromptEditorRerenderKey)
diff --git a/web/app/components/workflow/nodes/answer/default.ts b/web/app/components/workflow/nodes/answer/default.ts
index 44c88beb94e..c46d939a048 100644
--- a/web/app/components/workflow/nodes/answer/default.ts
+++ b/web/app/components/workflow/nodes/answer/default.ts
@@ -15,7 +15,7 @@ const nodeDefault: NodeDefault<AnswerNodeType> = {
variables: [],
answer: '',
},
- checkValid(payload: AnswerNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: AnswerNodeType, t: TFunction<['workflow']>) {
let errorMessages = ''
const { answer } = payload
if (!answer)
diff --git a/web/app/components/workflow/nodes/answer/node.tsx b/web/app/components/workflow/nodes/answer/node.tsx
index 6db24f3a38b..caf056586ee 100644
--- a/web/app/components/workflow/nodes/answer/node.tsx
+++ b/web/app/components/workflow/nodes/answer/node.tsx
@@ -7,7 +7,7 @@ import InfoPanel from '../_base/components/info-panel'
import ReadonlyInputWithSelectVar from '../_base/components/readonly-input-with-select-var'
const Node: FC<NodeProps<AnswerNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="mb-1 px-3 py-1">
diff --git a/web/app/components/workflow/nodes/answer/panel.tsx b/web/app/components/workflow/nodes/answer/panel.tsx
index 0a3b6fdd907..010e775b819 100644
--- a/web/app/components/workflow/nodes/answer/panel.tsx
+++ b/web/app/components/workflow/nodes/answer/panel.tsx
@@ -10,7 +10,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.answer'
const Panel: FC<NodePanelProps<AnswerNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { readOnly, inputs, handleAnswerChange, filterVar } = useConfig(id, data)
diff --git a/web/app/components/workflow/nodes/assigner/components/operation-selector.tsx b/web/app/components/workflow/nodes/assigner/components/operation-selector.tsx
index 64a072a0fd4..efd70ea4db0 100644
--- a/web/app/components/workflow/nodes/assigner/components/operation-selector.tsx
+++ b/web/app/components/workflow/nodes/assigner/components/operation-selector.tsx
@@ -39,7 +39,7 @@ const OperationSelector: FC<OperationSelectorProps> = ({
writeModeTypesArr,
writeModeTypesNum,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const items = getOperationItems(
assignedVarType,
diff --git a/web/app/components/workflow/nodes/assigner/components/var-list/index.tsx b/web/app/components/workflow/nodes/assigner/components/var-list/index.tsx
index d73e4d836c2..bed7eb2080e 100644
--- a/web/app/components/workflow/nodes/assigner/components/var-list/index.tsx
+++ b/web/app/components/workflow/nodes/assigner/components/var-list/index.tsx
@@ -48,7 +48,7 @@ const VarList: FC<Props> = ({
writeModeTypesArr,
writeModeTypesNum,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const handleAssignedVarChange = useCallback(
(index: number) => {
return (value: ValueSelector | string) => {
diff --git a/web/app/components/workflow/nodes/assigner/default.ts b/web/app/components/workflow/nodes/assigner/default.ts
index c9d5b315679..33ddcf5946c 100644
--- a/web/app/components/workflow/nodes/assigner/default.ts
+++ b/web/app/components/workflow/nodes/assigner/default.ts
@@ -20,7 +20,7 @@ const nodeDefault: NodeDefault<AssignerNodeType> = {
version: '2',
items: [],
},
- checkValid(payload: AssignerNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: AssignerNodeType, t: TFunction<['workflow']>) {
let errorMessages = ''
const { items: operationItems } = payload
diff --git a/web/app/components/workflow/nodes/assigner/node.tsx b/web/app/components/workflow/nodes/assigner/node.tsx
index a725f830bb1..5908ec97b69 100644
--- a/web/app/components/workflow/nodes/assigner/node.tsx
+++ b/web/app/components/workflow/nodes/assigner/node.tsx
@@ -13,7 +13,7 @@ import { BlockEnum } from '@/app/components/workflow/types'
const i18nPrefix = 'nodes.assigner'
const NodeComponent: FC<NodeProps<AssignerNodeType>> = ({ data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const nodes: Node[] = useNodes()
if (data.version === '2') {
const { items: operationItems } = data
diff --git a/web/app/components/workflow/nodes/assigner/panel.tsx b/web/app/components/workflow/nodes/assigner/panel.tsx
index b6b2c6d721c..789c445781f 100644
--- a/web/app/components/workflow/nodes/assigner/panel.tsx
+++ b/web/app/components/workflow/nodes/assigner/panel.tsx
@@ -12,7 +12,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.assigner'
const Panel: FC<NodePanelProps<AssignerNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const handleAddOperationItem = useHandleAddOperationItem()
const {
readOnly,
diff --git a/web/app/components/workflow/nodes/code/default.ts b/web/app/components/workflow/nodes/code/default.ts
index 0d69445c3b5..be90402a19e 100644
--- a/web/app/components/workflow/nodes/code/default.ts
+++ b/web/app/components/workflow/nodes/code/default.ts
@@ -21,7 +21,7 @@ const nodeDefault: NodeDefault<CodeNodeType> = {
variables: [],
outputs: {},
},
- checkValid(payload: CodeNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: CodeNodeType, t: TFunction<['workflow']>) {
let errorMessages = ''
const { code, variables } = payload
if (!errorMessages && variables.filter((v) => !v.variable).length > 0)
diff --git a/web/app/components/workflow/nodes/code/panel.tsx b/web/app/components/workflow/nodes/code/panel.tsx
index dd8714cb65d..b9f25de2325 100644
--- a/web/app/components/workflow/nodes/code/panel.tsx
+++ b/web/app/components/workflow/nodes/code/panel.tsx
@@ -28,7 +28,7 @@ const codeLanguages = [
},
]
const Panel: FC<NodePanelProps<CodeNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const {
readOnly,
diff --git a/web/app/components/workflow/nodes/data-source-empty/index.tsx b/web/app/components/workflow/nodes/data-source-empty/index.tsx
index e1276b9ebc0..fc0e075fd60 100644
--- a/web/app/components/workflow/nodes/data-source-empty/index.tsx
+++ b/web/app/components/workflow/nodes/data-source-empty/index.tsx
@@ -8,7 +8,7 @@ import { TabType } from '@/app/components/workflow/block-selector/types'
import { useReplaceDataSourceNode } from './hooks'
const DataSourceEmptyNode = ({ id, data }: NodeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { handleReplaceNode } = useReplaceDataSourceNode(id)
const triggerElement = (
diff --git a/web/app/components/workflow/nodes/data-source/before-run-form.tsx b/web/app/components/workflow/nodes/data-source/before-run-form.tsx
index 52058711c6c..e4e4a8de5ba 100644
--- a/web/app/components/workflow/nodes/data-source/before-run-form.tsx
+++ b/web/app/components/workflow/nodes/data-source/before-run-form.tsx
@@ -22,7 +22,7 @@ import useBeforeRunForm from './hooks/use-before-run-form'
const BeforeRunForm: FC<CustomRunFormProps> = (props) => {
const { nodeId, payload, onCancel } = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const dataSourceStore = useDataSourceStore()
const {
diff --git a/web/app/components/workflow/nodes/data-source/default.ts b/web/app/components/workflow/nodes/data-source/default.ts
index 8a316538c11..0412bfa4354 100644
--- a/web/app/components/workflow/nodes/data-source/default.ts
+++ b/web/app/components/workflow/nodes/data-source/default.ts
@@ -54,7 +54,7 @@ const nodeDefault: NodeDefault<DataSourceNodeType> = {
},
checkValid(
payload,
- t: TFunction<'workflow'>,
+ t: TFunction<['workflow']>,
moreDataForCheckValid: ReturnType<typeof getDataSourceCheckParams>,
) {
const { dataSourceInputsSchema, notAuthed } = moreDataForCheckValid
diff --git a/web/app/components/workflow/nodes/data-source/panel.tsx b/web/app/components/workflow/nodes/data-source/panel.tsx
index e115ab60e73..bd6db16ea46 100644
--- a/web/app/components/workflow/nodes/data-source/panel.tsx
+++ b/web/app/components/workflow/nodes/data-source/panel.tsx
@@ -20,7 +20,7 @@ import { useConfig } from './hooks/use-config'
import { DataSourceClassification } from './types'
const Panel: FC<NodePanelProps<DataSourceNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { nodesReadOnly } = useNodesReadOnly()
const dataSourceList = useStore((s) => s.dataSourceList)
const { provider_type, fileExtensions = [], datasource_parameters } = data
diff --git a/web/app/components/workflow/nodes/document-extractor/default.ts b/web/app/components/workflow/nodes/document-extractor/default.ts
index d362ef41b22..b1b7292bbb4 100644
--- a/web/app/components/workflow/nodes/document-extractor/default.ts
+++ b/web/app/components/workflow/nodes/document-extractor/default.ts
@@ -19,7 +19,7 @@ const nodeDefault: NodeDefault<DocExtractorNodeType> = {
variable_selector: [],
is_array_file: false,
},
- checkValid(payload: DocExtractorNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: DocExtractorNodeType, t: TFunction<['workflow']>) {
let errorMessages = ''
const { variable_selector: variable } = payload
diff --git a/web/app/components/workflow/nodes/document-extractor/node.tsx b/web/app/components/workflow/nodes/document-extractor/node.tsx
index 0a0b8ec4e3a..1161c8c643a 100644
--- a/web/app/components/workflow/nodes/document-extractor/node.tsx
+++ b/web/app/components/workflow/nodes/document-extractor/node.tsx
@@ -11,7 +11,7 @@ import { BlockEnum } from '@/app/components/workflow/types'
const i18nPrefix = 'nodes.docExtractor'
const NodeComponent: FC<NodeProps<DocExtractorNodeType>> = ({ data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const nodes: Node[] = useNodes()
const { variable_selector: variable } = data
diff --git a/web/app/components/workflow/nodes/document-extractor/panel.tsx b/web/app/components/workflow/nodes/document-extractor/panel.tsx
index eb67d072f05..453c9326f6e 100644
--- a/web/app/components/workflow/nodes/document-extractor/panel.tsx
+++ b/web/app/components/workflow/nodes/document-extractor/panel.tsx
@@ -18,7 +18,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.docExtractor'
const Panel: FC<NodePanelProps<DocExtractorNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const locale = useLocale()
const link = useNodeHelpLink(BlockEnum.DocExtractor)
const { data: supportFileTypesResponse } = useQuery(
diff --git a/web/app/components/workflow/nodes/document-extractor/use-single-run-form-params.ts b/web/app/components/workflow/nodes/document-extractor/use-single-run-form-params.ts
index f2261aac714..80812c17d64 100644
--- a/web/app/components/workflow/nodes/document-extractor/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/document-extractor/use-single-run-form-params.ts
@@ -17,7 +17,7 @@ type Params = {
toVarInputs: (variables: Variable[]) => InputVar[]
}
const useSingleRunFormParams = ({ payload, runInputData, setRunInputData }: Params) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const files = runInputData.files
const setFiles = useCallback(
(newFiles: []) => {
diff --git a/web/app/components/workflow/nodes/end/default.ts b/web/app/components/workflow/nodes/end/default.ts
index 06e54d379ba..baf0e605f39 100644
--- a/web/app/components/workflow/nodes/end/default.ts
+++ b/web/app/components/workflow/nodes/end/default.ts
@@ -15,7 +15,7 @@ const nodeDefault: NodeDefault<EndNodeType> = {
defaultValue: {
outputs: [],
},
- checkValid(payload: EndNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: EndNodeType, t: TFunction<['workflow']>) {
const outputs = payload.outputs || []
let errorMessage = ''
diff --git a/web/app/components/workflow/nodes/end/panel.tsx b/web/app/components/workflow/nodes/end/panel.tsx
index 03cb50a3aab..18fdb208fca 100644
--- a/web/app/components/workflow/nodes/end/panel.tsx
+++ b/web/app/components/workflow/nodes/end/panel.tsx
@@ -10,7 +10,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.end'
const Panel: FC<NodePanelProps<EndNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const { readOnly, inputs, handleVarListChange, handleAddVariable } = useConfig(id, data)
diff --git a/web/app/components/workflow/nodes/http/components/api-input.tsx b/web/app/components/workflow/nodes/http/components/api-input.tsx
index d1488aeef33..063b5293833 100644
--- a/web/app/components/workflow/nodes/http/components/api-input.tsx
+++ b/web/app/components/workflow/nodes/http/components/api-input.tsx
@@ -30,7 +30,7 @@ type Props = Readonly<{
}>
const ApiInput: FC<Props> = ({ nodeId, readonly, method, onMethodChange, url, onUrlChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [isFocus, setIsFocus] = useState(false)
const { availableVars, availableNodesWithParent } = useAvailableVarList(nodeId, {
diff --git a/web/app/components/workflow/nodes/http/components/authorization/index.tsx b/web/app/components/workflow/nodes/http/components/authorization/index.tsx
index 7fb7d8a6d72..12a0ba66f50 100644
--- a/web/app/components/workflow/nodes/http/components/authorization/index.tsx
+++ b/web/app/components/workflow/nodes/http/components/authorization/index.tsx
@@ -49,7 +49,7 @@ const Field = ({
}
const Authorization: FC<Props> = ({ nodeId, payload, onChange, isShow, onHide }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const headerId = useId()
const [isFocus, setIsFocus] = useState(false)
diff --git a/web/app/components/workflow/nodes/http/components/curl-panel.tsx b/web/app/components/workflow/nodes/http/components/curl-panel.tsx
index e00b9ceeb5c..2d676ad1baf 100644
--- a/web/app/components/workflow/nodes/http/components/curl-panel.tsx
+++ b/web/app/components/workflow/nodes/http/components/curl-panel.tsx
@@ -21,7 +21,7 @@ type Props = Readonly<{
const CurlPanel: FC<Props> = ({ nodeId, isShow, onHide, handleCurlImport }) => {
const [inputString, setInputString] = useState('')
const { handleNodeSelect } = useNodesInteractions()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const handleSave = useCallback(() => {
const { node, error } = parseCurl(inputString)
diff --git a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/index.tsx b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/index.tsx
index 6d7d2663afd..5ae272c9181 100644
--- a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/index.tsx
+++ b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/index.tsx
@@ -33,7 +33,7 @@ const KeyValueList: FC<Props> = ({
keyNotSupportVar,
insertVarTipToLeft,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const handleChange = useCallback(
(index: number) => {
diff --git a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx
index 88fe959e0eb..dbdbecf3bb9 100644
--- a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx
+++ b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/input-item.tsx
@@ -37,7 +37,7 @@ const InputItem: FC<Props> = ({
isSupportFile,
insertVarTipToLeft,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const hasValue = !!value
diff --git a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/item.tsx b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/item.tsx
index 4fa634ec2d8..8678945954b 100644
--- a/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/item.tsx
+++ b/web/app/components/workflow/nodes/http/components/key-value/key-value-edit/item.tsx
@@ -56,7 +56,7 @@ const KeyValueItem: FC<Props> = ({
keyNotSupportVar,
insertVarTipToLeft,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const hasValuePayload = payload.type === 'file' ? !!payload.file?.length : !!payload.value
const handleChange = useCallback(
diff --git a/web/app/components/workflow/nodes/http/components/timeout/index.tsx b/web/app/components/workflow/nodes/http/components/timeout/index.tsx
index b5f3ec19c32..62441691bb5 100644
--- a/web/app/components/workflow/nodes/http/components/timeout/index.tsx
+++ b/web/app/components/workflow/nodes/http/components/timeout/index.tsx
@@ -53,7 +53,7 @@ const InputField: FC<{
}
const Timeout: FC<Props> = ({ readonly, payload, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { connect, read, write, max_connect_timeout, max_read_timeout, max_write_timeout } =
payload ?? {}
diff --git a/web/app/components/workflow/nodes/http/default.ts b/web/app/components/workflow/nodes/http/default.ts
index 25e17bc7ff6..036f47a30c4 100644
--- a/web/app/components/workflow/nodes/http/default.ts
+++ b/web/app/components/workflow/nodes/http/default.ts
@@ -39,7 +39,7 @@ const nodeDefault: NodeDefault<HttpNodeType> = {
retry_interval: 100,
},
},
- checkValid(payload: HttpNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: HttpNodeType, t: TFunction<['workflow']>) {
let errorMessages = ''
if (!errorMessages && !payload.url)
diff --git a/web/app/components/workflow/nodes/http/panel.tsx b/web/app/components/workflow/nodes/http/panel.tsx
index 0849abe4236..28948366550 100644
--- a/web/app/components/workflow/nodes/http/panel.tsx
+++ b/web/app/components/workflow/nodes/http/panel.tsx
@@ -19,7 +19,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.http'
const Panel: FC<NodePanelProps<HttpNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const {
readOnly,
diff --git a/web/app/components/workflow/nodes/human-input/components/button-style-dropdown.tsx b/web/app/components/workflow/nodes/human-input/components/button-style-dropdown.tsx
index 91573e8db41..ab1df7cb9fe 100644
--- a/web/app/components/workflow/nodes/human-input/components/button-style-dropdown.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/button-style-dropdown.tsx
@@ -20,7 +20,7 @@ type Props = Readonly<{
}>
const ButtonStyleDropdown: FC<Props> = ({ text = 'Button Text', data, onChange, readonly }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const titleId = useId()
const chooseStyleLabel = t(($) => $[`${i18nPrefix}.userActions.chooseStyle`], { ns: 'workflow' })
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx
index b7621769443..1a21efab505 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx
@@ -33,7 +33,7 @@ const EmailConfigureModal = ({
nodesOutputVars = [],
availableNodes = [],
}: EmailConfigureModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const subjectId = useId()
const debugModeId = useId()
const debugDescriptionId = useId()
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx
index d3c54295ae6..3f2e1dd3952 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx
@@ -34,7 +34,7 @@ const DeliveryMethodForm: React.FC<Props> = ({
}) => {
const deliveryLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { handleSyncWorkflowDraft } = useNodesSyncDraft()
const handleMethodChange = (target: DeliveryMethod) => {
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/mail-body-input.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/mail-body-input.tsx
index b68e5479391..f13ec78418f 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/mail-body-input.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/mail-body-input.tsx
@@ -20,7 +20,7 @@ const MailBodyInput = ({
value = '',
onChange,
}: MailBodyInputProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<PromptEditor
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx
index 81dfac147d5..2547d29a5e8 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx
@@ -41,7 +41,7 @@ const DeliveryMethodItem: FC<DeliveryMethodItemProps> = ({
onDelete,
readonly,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const { data: email } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.email,
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx
index 1a67cba0063..d6e440813b3 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx
@@ -25,7 +25,7 @@ type MethodSelectorProps = {
}
const MethodSelector: FC<MethodSelectorProps> = ({ data, onAdd, onShowUpgradeTip }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-input.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-input.tsx
index f5e72f3aa1a..b6cdab08b90 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-input.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-input.tsx
@@ -26,7 +26,7 @@ type Props = Readonly<{
}>
const EmailInput = ({ email, value, list, onDelete, onSelect, onAdd, disabled = false }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const inputRef = useRef<HTMLInputElement>(null)
const [isFocus, setIsFocus] = useState(false)
const [open, setOpen] = useState(false)
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-item.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-item.tsx
index faaf49fa340..729a926d5a3 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-item.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-item.tsx
@@ -15,7 +15,7 @@ type Props = Readonly<{
}>
const EmailItem = ({ email, data, onDelete, disabled = false, isError }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx
index a6f4fc1ac7a..82a8f9ddaa7 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/index.tsx
@@ -21,7 +21,7 @@ type Props = Readonly<{
}>
const Recipient = ({ data, onChange }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const wholeWorkspaceId = useId()
const { data: userProfileEmail } = useSuspenseQuery({
...userProfileQueryOptions(),
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-list.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-list.tsx
index 779a8d81c16..0e9f98493a3 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-list.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-list.tsx
@@ -29,7 +29,7 @@ const MemberList: FC<Props> = ({
email,
hideSearch,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const searchLabel = t(($) => $['operation.search'], { ns: 'common' })
const filteredList = useMemo(() => {
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-selector.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-selector.tsx
index f2cecc91d96..54f3245e0cf 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-selector.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/member-selector.tsx
@@ -19,7 +19,7 @@ type Props = Readonly<{
}>
const MemberSelector: FC<Props> = ({ value, email, onSelect, list = [] }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const [searchValue, setSearchValue] = useState('')
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx
index adb093417d6..8cb277cc81b 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx
@@ -129,7 +129,7 @@ const EmailSenderContent = ({
nodesOutputVars = [],
availableNodes = [],
}: EmailSenderContentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const { data: userProfileEmail } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.email,
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx
index eca18e302f9..5b9dba90b13 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx
@@ -16,7 +16,7 @@ type UpgradeModalProps = {
}
export function UpgradeModal({ open, onOpenChange }: UpgradeModalProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'workflow'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/workflow/nodes/human-input/components/form-content-preview.tsx b/web/app/components/workflow/nodes/human-input/components/form-content-preview.tsx
index cf5100be750..b5971a36f5e 100644
--- a/web/app/components/workflow/nodes/human-input/components/form-content-preview.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/form-content-preview.tsx
@@ -28,7 +28,7 @@ const FormContentPreview: FC<FormContentPreviewProps> = ({
userActions,
onClose,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const panelWidth = useStore((state) => state.panelWidth)
const nodes = useNodes()
diff --git a/web/app/components/workflow/nodes/human-input/components/form-content.tsx b/web/app/components/workflow/nodes/human-input/components/form-content.tsx
index c34d406b2f3..3411891e4c1 100644
--- a/web/app/components/workflow/nodes/human-input/components/form-content.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/form-content.tsx
@@ -74,7 +74,7 @@ const FormContent: FC<FormContentProps> = ({
availableNodes,
readonly,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const getVarType = useWorkflowVariableType()
diff --git a/web/app/components/workflow/nodes/human-input/components/single-run-form.tsx b/web/app/components/workflow/nodes/human-input/components/single-run-form.tsx
index 3700a8765d6..62a72a6ad5d 100644
--- a/web/app/components/workflow/nodes/human-input/components/single-run-form.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/single-run-form.tsx
@@ -37,7 +37,7 @@ type Props = Readonly<{
}>
const FormContent = ({ nodeName, data, showBackButton, handleBack, onSubmit }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const contentList = splitByOutputVar(data.form_content)
const renderedFormInputs = getRenderedFormInputs(data.inputs, data.form_content)
const defaultInputs = initializeInputs(renderedFormInputs, data.resolved_default_values || {})
diff --git a/web/app/components/workflow/nodes/human-input/components/timeout.tsx b/web/app/components/workflow/nodes/human-input/components/timeout.tsx
index 66e2adb72c4..ae6eddfe638 100644
--- a/web/app/components/workflow/nodes/human-input/components/timeout.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/timeout.tsx
@@ -16,7 +16,7 @@ const unitOptionClassName =
'cursor-pointer border-0 text-text-tertiary transition-none data-checked:border-0 data-checked:shadow-sm data-checked:shadow-black/10 data-checked:hover:bg-components-segmented-control-item-active-bg data-checked:hover:text-text-accent-light-mode-only data-disabled:cursor-default data-disabled:text-text-tertiary data-disabled:data-checked:bg-components-segmented-control-item-active-bg data-disabled:data-checked:text-text-accent-light-mode-only data-disabled:data-checked:shadow-sm data-disabled:data-checked:shadow-black/10'
const TimeoutInput: FC<Props> = ({ timeout, unit, onChange, readonly }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const timeoutLabel = t(($) => $[`${i18nPrefix}.timeout.title`], { ns: 'workflow' })
const daysLabel = t(($) => $[`${i18nPrefix}.timeout.days`], { ns: 'workflow' })
const hoursLabel = t(($) => $[`${i18nPrefix}.timeout.hours`], { ns: 'workflow' })
diff --git a/web/app/components/workflow/nodes/human-input/components/user-action.tsx b/web/app/components/workflow/nodes/human-input/components/user-action.tsx
index 42f5ca8f87f..8ecac95b299 100644
--- a/web/app/components/workflow/nodes/human-input/components/user-action.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/user-action.tsx
@@ -19,7 +19,7 @@ type UserActionItemProps = {
}
const UserActionItem: FC<UserActionItemProps> = ({ data, onChange, onDelete, readonly }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const handleIDChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value
diff --git a/web/app/components/workflow/nodes/human-input/components/variable-in-markdown.tsx b/web/app/components/workflow/nodes/human-input/components/variable-in-markdown.tsx
index 433ef40114e..b45df92dd9c 100644
--- a/web/app/components/workflow/nodes/human-input/components/variable-in-markdown.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/variable-in-markdown.tsx
@@ -180,7 +180,7 @@ const SelectPreview: React.FC<{ label: string; options: string[] }> = ({ label,
)
}
-const FileUploadPreview: React.FC<{ methods: TransferMethod[]; t: TFunction }> = ({
+const FileUploadPreview: React.FC<{ methods: TransferMethod[]; t: TFunction<['common']> }> = ({
methods,
t,
}) => {
@@ -220,7 +220,7 @@ export const Note: React.FC<{ input: FormInputItem; nodeName: (nodeId: string) =
input,
nodeName,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'appDebug', 'workflow'])
if (isSelectFormInput(input)) {
const isVariable = input.option_source.type === 'variable'
if (isVariable) {
diff --git a/web/app/components/workflow/nodes/human-input/default.ts b/web/app/components/workflow/nodes/human-input/default.ts
index 443e10d55c2..37ca37785f9 100644
--- a/web/app/components/workflow/nodes/human-input/default.ts
+++ b/web/app/components/workflow/nodes/human-input/default.ts
@@ -61,7 +61,7 @@ const nodeDefault: NodeDefault<HumanInputNodeType> = {
timeout: 3,
timeout_unit: 'day',
},
- checkValid(payload: HumanInputNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: HumanInputNodeType, t: TFunction<['workflow']>) {
let errorMessages = ''
if (!errorMessages && !payload.delivery_methods.length)
errorMessages = t(($) => $[`${i18nPrefix}.noDeliveryMethod`], { ns: 'workflow' })
diff --git a/web/app/components/workflow/nodes/human-input/hooks/use-single-run-form-params.ts b/web/app/components/workflow/nodes/human-input/hooks/use-single-run-form-params.ts
index e508e5906d1..fb58bc8cf2e 100644
--- a/web/app/components/workflow/nodes/human-input/hooks/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/human-input/hooks/use-single-run-form-params.ts
@@ -29,7 +29,7 @@ const useSingleRunFormParams = ({
getInputVars,
setRunInputData,
}: Params) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { inputs } = useNodeCrud<HumanInputNodeType>(id, payload)
const [showGeneratedForm, setShowGeneratedForm] = useState(false)
const [formData, setFormData] = useState<HumanInputFormData | null>(null)
diff --git a/web/app/components/workflow/nodes/human-input/node.tsx b/web/app/components/workflow/nodes/human-input/node.tsx
index a49a5112b05..15f54f99361 100644
--- a/web/app/components/workflow/nodes/human-input/node.tsx
+++ b/web/app/components/workflow/nodes/human-input/node.tsx
@@ -10,7 +10,7 @@ import { DeliveryMethodType } from './types'
const i18nPrefix = 'nodes.humanInput'
const Node: FC<NodeProps<HumanInputNodeType>> = (props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { data } = props
const deliveryMethods = data.delivery_methods
diff --git a/web/app/components/workflow/nodes/human-input/panel.tsx b/web/app/components/workflow/nodes/human-input/panel.tsx
index 4c8f5cc3a6b..67375fa9cb6 100644
--- a/web/app/components/workflow/nodes/human-input/panel.tsx
+++ b/web/app/components/workflow/nodes/human-input/panel.tsx
@@ -45,7 +45,7 @@ const Panel: FC<NodePanelProps<HumanInputNodeType>> = ({ id, data }) => {
const actionsLabelId = React.useId()
const formContentLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'share', 'workflow'])
const {
readOnly,
inputs,
diff --git a/web/app/components/workflow/nodes/if-else/components/condition-add.tsx b/web/app/components/workflow/nodes/if-else/components/condition-add.tsx
index 0745b9c1112..4a95374aa96 100644
--- a/web/app/components/workflow/nodes/if-else/components/condition-add.tsx
+++ b/web/app/components/workflow/nodes/if-else/components/condition-add.tsx
@@ -23,7 +23,7 @@ const ConditionAdd = ({
disabled,
}: ConditionAddProps) => {
const searchInputRef = useRef<HTMLInputElement>(null)
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const handleSelectVariable = useCallback(
diff --git a/web/app/components/workflow/nodes/if-else/components/condition-files-list-value.tsx b/web/app/components/workflow/nodes/if-else/components/condition-files-list-value.tsx
index ad954bf8092..f91d2b4b02f 100644
--- a/web/app/components/workflow/nodes/if-else/components/condition-files-list-value.tsx
+++ b/web/app/components/workflow/nodes/if-else/components/condition-files-list-value.tsx
@@ -16,7 +16,7 @@ type ConditionValueProps = {
condition: Condition
}
const ConditionValue = ({ condition }: ConditionValueProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { variable_selector, comparison_operator: operator, sub_variable_condition } = condition
const variableSelector = variable_selector as ValueSelector
diff --git a/web/app/components/workflow/nodes/if-else/components/condition-list/condition-input.tsx b/web/app/components/workflow/nodes/if-else/components/condition-list/condition-input.tsx
index 1dd87117d3c..da24c0a54a9 100644
--- a/web/app/components/workflow/nodes/if-else/components/condition-list/condition-input.tsx
+++ b/web/app/components/workflow/nodes/if-else/components/condition-list/condition-input.tsx
@@ -18,7 +18,7 @@ const ConditionInput = ({
nodesOutputVars,
availableNodes,
}: ConditionInputProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const controlPromptEditorRerenderKey = useStore((s) => s.controlPromptEditorRerenderKey)
const pipelineId = useStore((s) => s.pipelineId)
const setShowInputFieldPanel = useStore((s) => s.setShowInputFieldPanel)
diff --git a/web/app/components/workflow/nodes/if-else/components/condition-list/condition-item.tsx b/web/app/components/workflow/nodes/if-else/components/condition-list/condition-item.tsx
index 4671f90ec7b..e76fce2e14c 100644
--- a/web/app/components/workflow/nodes/if-else/components/condition-list/condition-item.tsx
+++ b/web/app/components/workflow/nodes/if-else/components/condition-list/condition-item.tsx
@@ -100,7 +100,7 @@ const ConditionItem = ({
ComparisonOperator.notIn,
]
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const isChatMode = useIsChatMode()
const [isHovered, setIsHovered] = useState(false)
const [open, setOpen] = useState(false)
diff --git a/web/app/components/workflow/nodes/if-else/components/condition-list/condition-operator.tsx b/web/app/components/workflow/nodes/if-else/components/condition-list/condition-operator.tsx
index c7642797339..b8e57bcd24c 100644
--- a/web/app/components/workflow/nodes/if-else/components/condition-list/condition-operator.tsx
+++ b/web/app/components/workflow/nodes/if-else/components/condition-list/condition-operator.tsx
@@ -32,7 +32,7 @@ const ConditionOperator = ({
value,
onSelect,
}: ConditionOperatorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const options = useMemo(() => {
return getOperators(varType, file).map((o) => {
diff --git a/web/app/components/workflow/nodes/if-else/components/condition-number-input.tsx b/web/app/components/workflow/nodes/if-else/components/condition-number-input.tsx
index 172ec1ca657..15950d5b03a 100644
--- a/web/app/components/workflow/nodes/if-else/components/condition-number-input.tsx
+++ b/web/app/components/workflow/nodes/if-else/components/condition-number-input.tsx
@@ -41,7 +41,7 @@ const ConditionNumberInput = ({
unit,
}: ConditionNumberInputProps) => {
const searchInputRef = useRef<HTMLInputElement>(null)
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [variableSelectorVisible, setVariableSelectorVisible] = useState(false)
const [isFocus, { setTrue: setFocus, setFalse: setBlur }] = useBoolean()
diff --git a/web/app/components/workflow/nodes/if-else/components/condition-value.tsx b/web/app/components/workflow/nodes/if-else/components/condition-value.tsx
index b52d131a61d..de31a70ec81 100644
--- a/web/app/components/workflow/nodes/if-else/components/condition-value.tsx
+++ b/web/app/components/workflow/nodes/if-else/components/condition-value.tsx
@@ -16,7 +16,7 @@ type ConditionValueProps = {
value: string | string[] | boolean
}
const ConditionValue = ({ variableSelector, labelName, operator, value }: ConditionValueProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const nodes = useNodes()
const variableName =
labelName ||
diff --git a/web/app/components/workflow/nodes/if-else/components/condition-wrap.tsx b/web/app/components/workflow/nodes/if-else/components/condition-wrap.tsx
index e14114b01ad..51423f39a1f 100644
--- a/web/app/components/workflow/nodes/if-else/components/condition-wrap.tsx
+++ b/web/app/components/workflow/nodes/if-else/components/condition-wrap.tsx
@@ -83,7 +83,7 @@ const ConditionWrap: FC<Props> = ({
varsIsVarFileAttribute = {},
filterVar = () => true,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const getAvailableVars = useGetAvailableVars()
diff --git a/web/app/components/workflow/nodes/if-else/default.ts b/web/app/components/workflow/nodes/if-else/default.ts
index 94ae91e62b7..c83b18246ce 100644
--- a/web/app/components/workflow/nodes/if-else/default.ts
+++ b/web/app/components/workflow/nodes/if-else/default.ts
@@ -37,7 +37,7 @@ const nodeDefault: NodeDefault<IfElseNodeType> = {
},
],
},
- checkValid(payload: IfElseNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: IfElseNodeType, t: TFunction<['workflow']>) {
let errorMessages = ''
const { cases } = payload
if (!cases || cases.length === 0)
diff --git a/web/app/components/workflow/nodes/if-else/node.tsx b/web/app/components/workflow/nodes/if-else/node.tsx
index e03fa6d2b2e..8c7b0f70efc 100644
--- a/web/app/components/workflow/nodes/if-else/node.tsx
+++ b/web/app/components/workflow/nodes/if-else/node.tsx
@@ -14,7 +14,7 @@ const i18nPrefix = 'nodes.ifElse'
const IfElseNode: FC<NodeProps<IfElseNodeType>> = (props) => {
const { data } = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { cases } = data
const casesLength = cases.length
const checkIsConditionSet = useCallback((condition: Condition) => {
diff --git a/web/app/components/workflow/nodes/if-else/panel.tsx b/web/app/components/workflow/nodes/if-else/panel.tsx
index 158562d9a18..358a8f8ec28 100644
--- a/web/app/components/workflow/nodes/if-else/panel.tsx
+++ b/web/app/components/workflow/nodes/if-else/panel.tsx
@@ -12,7 +12,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.ifElse'
const Panel: FC<NodePanelProps<IfElseNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const {
readOnly,
inputs,
diff --git a/web/app/components/workflow/nodes/iteration-start/index.tsx b/web/app/components/workflow/nodes/iteration-start/index.tsx
index 67e1c90e679..3e114af42b0 100644
--- a/web/app/components/workflow/nodes/iteration-start/index.tsx
+++ b/web/app/components/workflow/nodes/iteration-start/index.tsx
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
import { NodeSourceHandle } from '@/app/components/workflow/nodes/_base/components/node-handle'
const IterationStartNode = ({ id, data }: NodeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="nodrag group mt-1 flex size-11 items-center justify-center rounded-2xl border border-workflow-block-border bg-workflow-block-bg shadow-xs">
@@ -30,7 +30,7 @@ const IterationStartNode = ({ id, data }: NodeProps) => {
}
export const IterationStartNodeDumb = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="nodrag relative top-5.25 left-4.25 z-11 flex h-11 w-11 items-center justify-center rounded-2xl border border-workflow-block-border bg-workflow-block-bg">
diff --git a/web/app/components/workflow/nodes/iteration/add-block.tsx b/web/app/components/workflow/nodes/iteration/add-block.tsx
index 4055cbef826..d9052836183 100644
--- a/web/app/components/workflow/nodes/iteration/add-block.tsx
+++ b/web/app/components/workflow/nodes/iteration/add-block.tsx
@@ -15,7 +15,7 @@ type AddBlockProps = {
iterationNodeData: IterationNodeType
}
const AddBlock = ({ iterationNodeData }: AddBlockProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { nodesReadOnly } = useNodesReadOnly()
const { handleNodeAdd } = useNodesInteractions()
const { availableNextBlocks } = useAvailableBlocks(BlockEnum.Start, true)
diff --git a/web/app/components/workflow/nodes/iteration/default.ts b/web/app/components/workflow/nodes/iteration/default.ts
index 51aa010e304..1b6e8c5078b 100644
--- a/web/app/components/workflow/nodes/iteration/default.ts
+++ b/web/app/components/workflow/nodes/iteration/default.ts
@@ -26,7 +26,7 @@ const nodeDefault: NodeDefault<IterationNodeType> = {
error_handle_mode: ErrorHandleMode.Terminated,
flatten_output: true,
},
- checkValid(payload: IterationNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: IterationNodeType, t: TFunction<['workflow']>) {
let errorMessages = ''
if (!errorMessages && (!payload.iterator_selector || payload.iterator_selector.length === 0)) {
diff --git a/web/app/components/workflow/nodes/iteration/node.tsx b/web/app/components/workflow/nodes/iteration/node.tsx
index a33763e65e3..1c4750dadcf 100644
--- a/web/app/components/workflow/nodes/iteration/node.tsx
+++ b/web/app/components/workflow/nodes/iteration/node.tsx
@@ -16,7 +16,7 @@ const Node: FC<NodeProps<IterationNodeType>> = ({ id, data }) => {
const { zoom } = useViewport()
const nodesInitialized = useNodesInitialized()
const { handleNodeIterationRerender } = useNodeIterationInteractions()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [showTips, setShowTips] = useState(data._isShowTips)
useEffect(() => {
diff --git a/web/app/components/workflow/nodes/iteration/panel.tsx b/web/app/components/workflow/nodes/iteration/panel.tsx
index f2e183e98df..ef3365cd67b 100644
--- a/web/app/components/workflow/nodes/iteration/panel.tsx
+++ b/web/app/components/workflow/nodes/iteration/panel.tsx
@@ -41,7 +41,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.iteration'
const Panel: FC<NodePanelProps<IterationNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const maxParallelismLabel = t(($) => $[`${i18nPrefix}.MaxParallelismTitle`], { ns: 'workflow' })
const errorResponseMethodLabel = t(($) => $[`${i18nPrefix}.errorResponseMethod`], {
ns: 'workflow',
diff --git a/web/app/components/workflow/nodes/iteration/use-interactions.ts b/web/app/components/workflow/nodes/iteration/use-interactions.ts
index 2506370f554..d3b5aaf15d8 100644
--- a/web/app/components/workflow/nodes/iteration/use-interactions.ts
+++ b/web/app/components/workflow/nodes/iteration/use-interactions.ts
@@ -15,7 +15,7 @@ import {
} from './use-interactions.helpers'
export const useNodeIterationInteractions = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { nodesMap: nodesMetaDataMap } = useNodesMetaData()
const collaborativeWorkflow = useCollaborativeWorkflow()
diff --git a/web/app/components/workflow/nodes/iteration/use-single-run-form-params.ts b/web/app/components/workflow/nodes/iteration/use-single-run-form-params.ts
index c4da3972659..f0df513eaa8 100644
--- a/web/app/components/workflow/nodes/iteration/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/iteration/use-single-run-form-params.ts
@@ -35,7 +35,7 @@ const useSingleRunFormParams = ({
setRunInputData,
iterationRunResult,
}: Params) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { isNodeInIteration } = useIsNodeInIteration(id)
const { getIterationNodeChildren, getBeforeNodesInSameBranch } = useWorkflow()
diff --git a/web/app/components/workflow/nodes/knowledge-base/__tests__/utils.spec.ts b/web/app/components/workflow/nodes/knowledge-base/__tests__/utils.spec.ts
index c729d9e25c8..b2d54b8b82c 100644
--- a/web/app/components/workflow/nodes/knowledge-base/__tests__/utils.spec.ts
+++ b/web/app/components/workflow/nodes/knowledge-base/__tests__/utils.spec.ts
@@ -205,7 +205,7 @@ describe('knowledge-base validation issue', () => {
describe('knowledge-base validation messaging', () => {
const t = withSelectorKey(
(key: string, _options?: Record<string, unknown>) => key,
- ) as unknown as TFunction
+ ) as unknown as TFunction<['common', 'workflow']>
it.each([
[
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/hooks.tsx b/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/hooks.tsx
index cb20c92d577..029147b189e 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/hooks.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/hooks.tsx
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'
import { ChunkStructureEnum } from '../../types'
export const useChunkStructure = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const GeneralOption: Option = {
id: ChunkStructureEnum.general,
icon: (isActive: boolean) => (
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/index.tsx b/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/index.tsx
index fdce1f79314..339bbdfea98 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/index.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/index.tsx
@@ -20,7 +20,7 @@ const ChunkStructure = ({
warningDot = false,
readonly = false,
}: ChunkStructureProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { options, optionMap } = useChunkStructure()
return (
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/instruction/index.tsx b/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/instruction/index.tsx
index f299453f110..b5a2a806d28 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/instruction/index.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/instruction/index.tsx
@@ -9,7 +9,7 @@ type InstructionProps = {
}
const Instruction = ({ className }: InstructionProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const docLink = useDocLink()
return (
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/selector.tsx b/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/selector.tsx
index f95cad742a8..45c22651613 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/selector.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/components/chunk-structure/selector.tsx
@@ -15,7 +15,7 @@ type SelectorProps = {
trigger?: ReactElement
}
const Selector = ({ options, value, onChange, readonly, trigger }: SelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const handleSelect = useCallback(
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/embedding-model.tsx b/web/app/components/workflow/nodes/knowledge-base/components/embedding-model.tsx
index 7d5cee619f0..b3f6fa45843 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/embedding-model.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/components/embedding-model.tsx
@@ -28,7 +28,7 @@ const EmbeddingModel = ({
warningDot = false,
readonly = false,
}: EmbeddingModelProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetSettings'])
const { data: embeddingModelList = [] } = useQuery(
consoleQuery.workspaces.current.models.modelTypes.byModelType.get.queryOptions({
input: { params: { model_type: ModelTypeEnum.textEmbedding } },
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/index-method.tsx b/web/app/components/workflow/nodes/knowledge-base/components/index-method.tsx
index d83b3c16ac5..31dab188b1d 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/index-method.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/components/index-method.tsx
@@ -38,7 +38,7 @@ const IndexMethod = ({
onKeywordNumberChange,
readonly = false,
}: IndexMethodProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation', 'datasetSettings'])
const keywordInputId = useId()
const keywordNumberLabel = t(($) => $['form.numberOfKeywords'], { ns: 'datasetSettings' })
const isHighQuality = indexMethod === IndexMethodEnum.QUALIFIED
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/option-card.tsx b/web/app/components/workflow/nodes/knowledge-base/components/option-card.tsx
index b09786ed77b..62c0e92bf25 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/option-card.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/components/option-card.tsx
@@ -60,7 +60,7 @@ const OptionCard = memo(
onClick,
readonly,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const isActive = useMemo(() => {
return id === selectedId
}, [id, selectedId])
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/hooks.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/hooks.tsx
index 756a3598e0f..5fd2069d1ff 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/hooks.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/hooks.tsx
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'
import { HybridSearchModeEnum, IndexMethodEnum, RetrievalSearchMethodEnum } from '../../types'
export const useRetrievalSetting = (indexMethod?: IndexMethodEnum) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const VectorSearchOption: Option = useMemo(() => {
return {
id: RetrievalSearchMethodEnum.semantic,
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/index.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/index.tsx
index 8e2de3ad9e8..8bb933403b8 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/index.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/index.tsx
@@ -58,7 +58,7 @@ const RetrievalSetting = ({
onScoreThresholdEnabledChange,
showMultiModalTip,
}: RetrievalSettingProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetSettings', 'workflow'])
const docLink = useDocLink()
const { options, hybridSearchModeOptions } = useRetrievalSetting(indexMethod)
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx
index bb78be91306..6bd2540f056 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx
@@ -143,7 +143,7 @@ function SearchMethodRadioCard({
isRecommended,
children,
}: SearchMethodRadioCardProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetCreation'])
const isActive = option.id === searchMethod
return (
@@ -238,7 +238,7 @@ export function SearchMethodOption({
}: SearchMethodOptionProps) {
const rerankLabelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'datasetSettings'])
const isHybridSearch = option.id === RetrievalSearchMethodEnum.hybrid
const isHybridSearchWeightedScoreMode = hybridSearch.mode === HybridSearchModeEnum.WeightedScore
const showRerankModelSelectorSwitch = shouldShowRerankModelSelectorSwitch(option.id)
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx
index bbd3072c557..399c3101b86 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/top-k-and-score-threshold.tsx
@@ -58,7 +58,7 @@ export function TopKAndScoreThreshold({
const scoreThresholdLabelId = useId()
const topKLabelId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const topKLabel = t(($) => $['datasetConfig.top_k'], { ns: 'appDebug' })
const scoreThresholdLabel = t(($) => $['datasetConfig.score_threshold'], { ns: 'appDebug' })
const topKTip = t(($) => $['datasetConfig.top_kTip'], { ns: 'appDebug' })
diff --git a/web/app/components/workflow/nodes/knowledge-base/hooks/use-settings-display.ts b/web/app/components/workflow/nodes/knowledge-base/hooks/use-settings-display.ts
index eb8439ab8f8..87da11fd76a 100644
--- a/web/app/components/workflow/nodes/knowledge-base/hooks/use-settings-display.ts
+++ b/web/app/components/workflow/nodes/knowledge-base/hooks/use-settings-display.ts
@@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next'
import { IndexMethodEnum, RetrievalSearchMethodEnum } from '../types'
export const useSettingsDisplay = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset', 'datasetCreation', 'datasetSettings'])
return {
[IndexMethodEnum.QUALIFIED]: t(($) => $['stepTwo.qualified'], { ns: 'datasetCreation' }),
diff --git a/web/app/components/workflow/nodes/knowledge-base/node.tsx b/web/app/components/workflow/nodes/knowledge-base/node.tsx
index e51e73e8554..a31d4983e8e 100644
--- a/web/app/components/workflow/nodes/knowledge-base/node.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/node.tsx
@@ -57,7 +57,13 @@ const RETRIEVAL_WARNING_CODES = new Set<KnowledgeBaseValidationIssueCode>([
])
const Node: FC<NodeProps<KnowledgeBaseNodeType>> = ({ data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation([
+ 'common',
+ 'datasetCreation',
+ 'datasetSettings',
+ 'plugin',
+ 'workflow',
+ ])
const language = useLanguage()
const settingsDisplay = useSettingsDisplay()
const { data: embeddingModelList = [] } = useQuery(
diff --git a/web/app/components/workflow/nodes/knowledge-base/panel.tsx b/web/app/components/workflow/nodes/knowledge-base/panel.tsx
index c60b5f3dc4b..73b7b2005dd 100644
--- a/web/app/components/workflow/nodes/knowledge-base/panel.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/panel.tsx
@@ -33,7 +33,7 @@ const Panel: FC<NodePanelProps<KnowledgeBaseNodeType>> = ({ id, data }) => {
ChunkStructureEnum.parent_child,
]
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/components/workflow/nodes/knowledge-base/use-single-run-form-params.ts b/web/app/components/workflow/nodes/knowledge-base/use-single-run-form-params.ts
index a518237d152..53bddc234f4 100644
--- a/web/app/components/workflow/nodes/knowledge-base/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/knowledge-base/use-single-run-form-params.ts
@@ -13,7 +13,7 @@ type Params = {
toVarInputs: (variables: Variable[]) => InputVar[]
}
const useSingleRunFormParams = ({ payload, runInputData, setRunInputData }: Params) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const query = runInputData.query
const setQuery = useCallback(
(newQuery: string) => {
diff --git a/web/app/components/workflow/nodes/knowledge-base/utils.ts b/web/app/components/workflow/nodes/knowledge-base/utils.ts
index 53f65b88519..f760bad8da6 100644
--- a/web/app/components/workflow/nodes/knowledge-base/utils.ts
+++ b/web/app/components/workflow/nodes/knowledge-base/utils.ts
@@ -160,7 +160,7 @@ export const getKnowledgeBaseValidationIssue = (
export const getKnowledgeBaseValidationMessage = (
issue: KnowledgeBaseValidationIssue | null | undefined,
- t: TFunction,
+ t: TFunction<['common', 'workflow']>,
) => {
if (!issue) return ''
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/add-dataset.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/add-dataset.tsx
index 96329581225..797b9d80490 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/add-dataset.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/add-dataset.tsx
@@ -13,7 +13,7 @@ type Props = Readonly<{
}>
const AddDataset: FC<Props> = ({ selectedIds, modal, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const [isShowModal, setIsShowModal] = useState(false)
const handleSelect = useCallback(
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/dataset-item.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/dataset-item.tsx
index e6dd33b3d53..d23b568ac70 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/dataset-item.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/dataset-item.tsx
@@ -46,7 +46,7 @@ const DatasetItem: FC<Props> = ({
settingsModalHeight,
}) => {
const media = useBreakpoints()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'dataset'])
const isMobile = media === MediaType.mobile
const { formatIndexingTechniqueAndMethod } = useKnowledge()
const [isDeleteHovered, setIsDeleteHovered] = useState(false)
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/dataset-list.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/dataset-list.tsx
index aee0f9a9bcf..94de1210de1 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/dataset-list.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/dataset-list.tsx
@@ -32,7 +32,7 @@ const DatasetList: FC<Props> = ({
settingsDrawerPopupClassName,
settingsModalHeight,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const { data: currentUserId } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.id,
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/add-condition.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/add-condition.tsx
index f1311e87945..83e70339e1d 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/add-condition.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/add-condition.tsx
@@ -12,7 +12,7 @@ const AddCondition = ({
metadataList,
handleAddCondition,
}: Pick<MetadataShape, 'handleAddCondition' | 'metadataList'>) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const [searchText, setSearchText] = useState('')
const searchLabel = t(($) => $['nodes.knowledgeRetrieval.metadata.panel.search'], {
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-common-variable-selector.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-common-variable-selector.tsx
index 4f2821dda6e..69dad4c2ded 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-common-variable-selector.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-common-variable-selector.tsx
@@ -16,7 +16,7 @@ const ConditionCommonVariableSelector = ({
onChange,
varType,
}: ConditionCommonVariableSelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const selected = variables.find((v) => v.value === value)
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-date.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-date.tsx
index cb8457cb8d9..58e2c0ca18a 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-date.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-date.tsx
@@ -13,7 +13,7 @@ type ConditionDateProps = {
onChange: (date?: number) => void
}
const ConditionDate = ({ value, onChange }: ConditionDateProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const { data: timezone } = useQuery({
...userProfileQueryOptions(),
select: (data) => data.profile.timezone ?? undefined,
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-number.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-number.tsx
index 05c57a1d7c9..857fcdeaf53 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-number.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-number.tsx
@@ -26,7 +26,7 @@ const ConditionNumber = ({
isCommonVariable,
commonVariables,
}: ConditionNumberProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const handleVariableValueChange = useCallback(
(v: ValueSelector) => {
onChange(`{{#${v.join('.')}#}}`)
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-operator.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-operator.tsx
index 4948e8633d7..bff7f2f0ef5 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-operator.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-operator.tsx
@@ -26,7 +26,7 @@ const ConditionOperator = ({
value,
onSelect,
}: ConditionOperatorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const options = useMemo(() => {
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-string.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-string.tsx
index 94d032f96b8..abcb19c66b0 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-string.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-string.tsx
@@ -26,7 +26,7 @@ const ConditionString = ({
isCommonVariable,
commonVariables,
}: ConditionStringProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const handleVariableValueChange = useCallback(
(v: ValueSelector) => {
onChange(`{{#${v.join('.')}#}}`)
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-variable-selector.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-variable-selector.tsx
index 73936eba713..2829e34aed1 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-variable-selector.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/condition-list/condition-variable-selector.tsx
@@ -22,7 +22,7 @@ const ConditionVariableSelector = ({
onChange,
}: ConditionVariableSelectorProps) => {
const searchInputRef = useRef<HTMLInputElement>(null)
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const handleChange = useCallback(
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/index.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/index.tsx
index f8de2c47c29..14b9f4da94e 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/index.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/index.tsx
@@ -32,7 +32,7 @@ const MetadataFilter = ({
}: MetadataFilterProps) => {
const titleId = useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [collapsed, setCollapsed] = useState(true)
const handleMetadataFilterModeChangeWrapped = useCallback(
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/metadata-filter-selector.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/metadata-filter-selector.tsx
index 7e2ac0045f1..9c71694a88c 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/metadata-filter-selector.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-filter/metadata-filter-selector.tsx
@@ -18,7 +18,7 @@ const MetadataFilterSelector = ({
value = MetadataFilteringModeEnum.disabled,
onSelect,
}: MetadataFilterSelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const options = [
{
key: MetadataFilteringModeEnum.disabled,
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-panel.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-panel.tsx
index 4fb3cde3889..ad371fb8481 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-panel.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-panel.tsx
@@ -14,7 +14,7 @@ const MetadataPanel = ({
handleAddCondition,
...restProps
}: MetadataPanelProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="w-105 rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-2xl">
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-trigger.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-trigger.tsx
index e2ad07b54f7..1cc08a3ff1e 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-trigger.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/metadata/metadata-trigger.tsx
@@ -13,7 +13,7 @@ const MetadataTrigger = ({
selectedDatasetsLoaded,
...restProps
}: MetadataShape) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const conditions = metadataFilteringConditions?.conditions || []
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/retrieval-config.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/retrieval-config.tsx
index 6b7839103a9..17ef7109440 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/components/retrieval-config.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/retrieval-config.tsx
@@ -46,7 +46,7 @@ const RetrievalConfig: FC<Props> = ({
onRerankModelOpenChange,
selectedDatasets,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const { retrieval_mode, multiple_retrieval_config } = payload
const handleOpen = useCallback(
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/panel.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/panel.tsx
index 8279705b02e..b1433d0e4bb 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/panel.tsx
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/panel.tsx
@@ -17,7 +17,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.knowledgeRetrieval'
const Panel: FC<NodePanelProps<KnowledgeRetrievalNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const {
readOnly,
diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/use-single-run-form-params.ts b/web/app/components/workflow/nodes/knowledge-retrieval/use-single-run-form-params.ts
index 02fff29ae11..2d5bb7f600e 100644
--- a/web/app/components/workflow/nodes/knowledge-retrieval/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/knowledge-retrieval/use-single-run-form-params.ts
@@ -28,7 +28,7 @@ const useSingleRunFormParams = ({
runInputDataRef,
setRunInputData,
}: Params) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const datasetsDetail = useDatasetsDetailStore((s) => s.datasetsDetail)
const query = runInputData.query
const queryAttachment = runInputData.queryAttachment
diff --git a/web/app/components/workflow/nodes/list-operator/components/extract-input.tsx b/web/app/components/workflow/nodes/list-operator/components/extract-input.tsx
index 8f2785b3640..b456acd57df 100644
--- a/web/app/components/workflow/nodes/list-operator/components/extract-input.tsx
+++ b/web/app/components/workflow/nodes/list-operator/components/extract-input.tsx
@@ -17,7 +17,7 @@ type Props = Readonly<{
}>
const ExtractInput: FC<Props> = ({ nodeId, readOnly, value, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [isFocus, setIsFocus] = useState(false)
const { availableVars, availableNodesWithParent } = useAvailableVarList(nodeId, {
diff --git a/web/app/components/workflow/nodes/list-operator/components/filter-condition.tsx b/web/app/components/workflow/nodes/list-operator/components/filter-condition.tsx
index 2c95adfb4a1..cc1e4919676 100644
--- a/web/app/components/workflow/nodes/list-operator/components/filter-condition.tsx
+++ b/web/app/components/workflow/nodes/list-operator/components/filter-condition.tsx
@@ -211,7 +211,7 @@ const FilterCondition: FC<Props> = ({
ComparisonOperator.allOf,
]
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const expectedVarType = getExpectedVarType(condition, varType)
const supportVariableInput = !!expectedVarType
diff --git a/web/app/components/workflow/nodes/list-operator/components/limit-config.tsx b/web/app/components/workflow/nodes/list-operator/components/limit-config.tsx
index 4d3d3da0d18..566f4c7e7bd 100644
--- a/web/app/components/workflow/nodes/list-operator/components/limit-config.tsx
+++ b/web/app/components/workflow/nodes/list-operator/components/limit-config.tsx
@@ -28,7 +28,7 @@ const LIMIT_DEFAULT: Limit = {
}
const LimitConfig: FC<Props> = ({ className, readonly, config = LIMIT_DEFAULT, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const payload = config
const handleLimitEnabledChange = useCallback(
diff --git a/web/app/components/workflow/nodes/list-operator/components/sub-variable-picker.tsx b/web/app/components/workflow/nodes/list-operator/components/sub-variable-picker.tsx
index 84f436ce766..b61b6aab09b 100644
--- a/web/app/components/workflow/nodes/list-operator/components/sub-variable-picker.tsx
+++ b/web/app/components/workflow/nodes/list-operator/components/sub-variable-picker.tsx
@@ -28,7 +28,7 @@ type SubVariableOption = {
}
const SubVariablePicker: FC<Props> = ({ value, onChange, className }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const subVarOptions = useMemo<SubVariableOption[]>(
() =>
SUB_VARIABLES.map((item) => ({
diff --git a/web/app/components/workflow/nodes/list-operator/default.ts b/web/app/components/workflow/nodes/list-operator/default.ts
index 3a882186811..60d231c146c 100644
--- a/web/app/components/workflow/nodes/list-operator/default.ts
+++ b/web/app/components/workflow/nodes/list-operator/default.ts
@@ -36,7 +36,7 @@ const nodeDefault: NodeDefault<ListFilterNodeType> = {
size: 10,
},
},
- checkValid(payload: ListFilterNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: ListFilterNodeType, t: TFunction<['workflow']>) {
let errorMessages = ''
const { variable, var_type, filter_by, item_var_type } = payload
diff --git a/web/app/components/workflow/nodes/list-operator/node.tsx b/web/app/components/workflow/nodes/list-operator/node.tsx
index 47cda060799..aa375d94af0 100644
--- a/web/app/components/workflow/nodes/list-operator/node.tsx
+++ b/web/app/components/workflow/nodes/list-operator/node.tsx
@@ -11,7 +11,7 @@ import { BlockEnum } from '@/app/components/workflow/types'
const i18nPrefix = 'nodes.listFilter'
const NodeComponent: FC<NodeProps<ListFilterNodeType>> = ({ data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const nodes: Node[] = useNodes()
const { variable } = data
diff --git a/web/app/components/workflow/nodes/list-operator/panel.tsx b/web/app/components/workflow/nodes/list-operator/panel.tsx
index ecc5bde355a..aad3f09cc99 100644
--- a/web/app/components/workflow/nodes/list-operator/panel.tsx
+++ b/web/app/components/workflow/nodes/list-operator/panel.tsx
@@ -19,7 +19,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.listFilter'
const Panel: FC<NodePanelProps<ListFilterNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const {
readOnly,
diff --git a/web/app/components/workflow/nodes/llm/components/config-prompt-item.tsx b/web/app/components/workflow/nodes/llm/components/config-prompt-item.tsx
index a6d5f86f5d0..4910ca9ea80 100644
--- a/web/app/components/workflow/nodes/llm/components/config-prompt-item.tsx
+++ b/web/app/components/workflow/nodes/llm/components/config-prompt-item.tsx
@@ -88,7 +88,7 @@ const ConfigPromptItem: FC<Props> = ({
handleAddVariable,
modelConfig,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const roleDescription = payload.role
? t(roleDescriptionSelectors[payload.role], { ns: 'workflow' })
: undefined
diff --git a/web/app/components/workflow/nodes/llm/components/config-prompt.tsx b/web/app/components/workflow/nodes/llm/components/config-prompt.tsx
index 2bd7eab6123..e765d4aa53a 100644
--- a/web/app/components/workflow/nodes/llm/components/config-prompt.tsx
+++ b/web/app/components/workflow/nodes/llm/components/config-prompt.tsx
@@ -52,7 +52,7 @@ const ConfigPrompt: FC<Props> = ({
handleAddVariable,
modelConfig,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const workflowStore = useWorkflowStore()
const { setControlPromptEditorRerenderKey } = workflowStore.getState()
const prompts = useMemo(
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/code-editor.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/code-editor.tsx
index 2c48b06c41c..2b40b4d63ed 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/code-editor.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/code-editor.tsx
@@ -37,7 +37,7 @@ const CodeEditor: FC<CodeEditorProps> = ({
onFocus,
onBlur,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { theme } = useTheme()
const monacoRef = useRef<Monaco | null>(null)
const editorRef = useRef<MonacoEditor | null>(null)
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-importer.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-importer.tsx
index b5927d95280..701306db789 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-importer.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-importer.tsx
@@ -18,7 +18,7 @@ type JsonImporterProps = {
}
const JsonImporter: FC<JsonImporterProps> = ({ onSubmit, updateBtnWidth }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const [open, setOpen] = useState(false)
const [json, setJson] = useState('')
const [parseError, setParseError] = useState<any>(null)
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-config.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-config.tsx
index 1b6f639167b..b38ba0592bf 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-config.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-config.tsx
@@ -60,7 +60,7 @@ const DEFAULT_SCHEMA: SchemaRoot = {
}
function JsonSchemaConfigContent({ defaultSchema, onSave, onClose }: JsonSchemaConfigProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const [selectedSchemaView, setSelectedSchemaView] = useState<SchemaView>('visualEditor')
const [jsonSchema, setJsonSchema] = useState(defaultSchema || DEFAULT_SCHEMA)
const [json, setJson] = useState(() => JSON.stringify(jsonSchema, null, 2))
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-generator/generated-result.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-generator/generated-result.tsx
index 09d95b73325..317133fba41 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-generator/generated-result.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-generator/generated-result.tsx
@@ -27,7 +27,7 @@ const GeneratedResult: FC<GeneratedResultProps> = ({
onClose,
onApply,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const [parseError, setParseError] = useState<Error | null>(null)
const [validationError, setValidationError] = useState<string>('')
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-generator/prompt-editor.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-generator/prompt-editor.tsx
index 740a705e7b0..8779ac45ace 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-generator/prompt-editor.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/json-schema-generator/prompt-editor.tsx
@@ -38,7 +38,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
}) => {
const instructionLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const handleInstructionChange = useCallback(
(value: string) => {
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/add-field.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/add-field.tsx
index 82ceb4a4275..44a4d8ff91c 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/add-field.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/add-field.tsx
@@ -7,7 +7,7 @@ import { useMittContext } from './context'
import { useVisualEditorStore } from './store'
const AddField = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const setIsAddingNewField = useVisualEditorStore((state) => state.setIsAddingNewField)
const { emit } = useMittContext()
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/card.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/card.tsx
index 5d163b14813..afd3c17b698 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/card.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/card.tsx
@@ -10,7 +10,7 @@ type CardProps = {
}
const Card: FC<CardProps> = ({ name, type, required, description }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="flex flex-col py-0.5">
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/actions.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/actions.tsx
index fe6764f9be0..82049295ecb 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/actions.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/actions.tsx
@@ -11,7 +11,7 @@ type ActionsProps = {
}
const Actions: FC<ActionsProps> = ({ disableAddBtn, onAddChildField, onEdit, onDelete }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const addChildFieldLabel = t(($) => $['nodes.llm.jsonSchema.addChildField'], { ns: 'workflow' })
const editLabel = t(($) => $['operation.edit'], { ns: 'common' })
const removeLabel = t(($) => $['operation.remove'], { ns: 'common' })
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/advanced-actions.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/advanced-actions.tsx
index 5d02a5073f3..57de638f37c 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/advanced-actions.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/advanced-actions.tsx
@@ -13,7 +13,7 @@ type AdvancedActionsProps = {
}
export function AdvancedActions({ isConfirmDisabled, onCancel, onConfirm }: AdvancedActionsProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
useHotkey(
JSON_SCHEMA_CONFIRM_HOTKEY,
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/advanced-options.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/advanced-options.tsx
index c68a962149f..14dbff7d3b9 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/advanced-options.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/advanced-options.tsx
@@ -15,7 +15,7 @@ type AdvancedOptionsProps = {
}
const AdvancedOptions: FC<AdvancedOptionsProps> = ({ onChange, options }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
// const [showAdvancedOptions, setShowAdvancedOptions] = useState(false)
const [enumValue, setEnumValue] = useState(options.enum)
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/index.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/index.tsx
index 4a5deb4a121..2c67350979b 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/index.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/index.tsx
@@ -58,7 +58,7 @@ const MAXIMUM_DEPTH_TYPE_OPTIONS = [
]
const EditCard: FC<EditCardProps> = ({ fields, depth, path, parentPath }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [currentFields, setCurrentFields] = useState(fields)
const [backupFields, setBackupFields] = useState<EditData | null>(null)
const isAddingNewField = useVisualEditorStore((state) => state.isAddingNewField)
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/required-switch.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/required-switch.tsx
index a447d0a91c9..7a5d0471ca0 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/required-switch.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/required-switch.tsx
@@ -9,7 +9,7 @@ type RequiredSwitchProps = {
}
const RequiredSwitch: FC<RequiredSwitchProps> = ({ defaultValue, toggleRequired }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="flex items-center gap-x-1 rounded-[5px] border border-divider-subtle bg-background-default-lighter px-1.5 py-1">
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/hooks.ts b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/hooks.ts
index c34e7ac490d..95dfcf89c45 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/hooks.ts
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/hooks.ts
@@ -23,7 +23,7 @@ type AddEventParams = {
export const useSchemaNodeOperations = (props: VisualEditorProps) => {
const { schema: jsonSchema, onChange: doOnChange } = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const onChange = doOnChange || noop
const backupSchema = useVisualEditorStore((state) => state.backupSchema)
const setBackupSchema = useVisualEditorStore((state) => state.setBackupSchema)
diff --git a/web/app/components/workflow/nodes/llm/components/panel-memory-section.tsx b/web/app/components/workflow/nodes/llm/components/panel-memory-section.tsx
index 229df4f7d87..f67fd97123f 100644
--- a/web/app/components/workflow/nodes/llm/components/panel-memory-section.tsx
+++ b/web/app/components/workflow/nodes/llm/components/panel-memory-section.tsx
@@ -58,7 +58,7 @@ const PanelMemorySection: FC<Props> = ({
const userLabelId = React.useId()
const memoryLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const isSnippetFlow = flowType === FlowType.snippet
const shouldCheckSysQuery = !isSnippetFlow
const defaultMemory = isSnippetFlow ? SNIPPET_DEFAULT_MEMORY : DEFAULT_MEMORY
diff --git a/web/app/components/workflow/nodes/llm/components/panel-output-section.tsx b/web/app/components/workflow/nodes/llm/components/panel-output-section.tsx
index 4216a1fe20f..383daa523ce 100644
--- a/web/app/components/workflow/nodes/llm/components/panel-output-section.tsx
+++ b/web/app/components/workflow/nodes/llm/components/panel-output-section.tsx
@@ -31,7 +31,7 @@ const PanelOutputSection: FC<Props> = ({
}) => {
const structuredLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'workflow'])
return (
<>
<Split />
diff --git a/web/app/components/workflow/nodes/llm/components/prompt-generator-btn.tsx b/web/app/components/workflow/nodes/llm/components/prompt-generator-btn.tsx
index 64d301da26c..4ac2e357dbe 100644
--- a/web/app/components/workflow/nodes/llm/components/prompt-generator-btn.tsx
+++ b/web/app/components/workflow/nodes/llm/components/prompt-generator-btn.tsx
@@ -27,7 +27,7 @@ const PromptGeneratorBtn: FC<Props> = ({
editorId,
currentPrompt,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const [showAutomatic, setShowAutomatic] = useState(false)
const handleAutomaticRes = useCallback(
(res: GenRes) => {
diff --git a/web/app/components/workflow/nodes/llm/components/reasoning-format-config.tsx b/web/app/components/workflow/nodes/llm/components/reasoning-format-config.tsx
index d0768034f80..e4c2ec38a06 100644
--- a/web/app/components/workflow/nodes/llm/components/reasoning-format-config.tsx
+++ b/web/app/components/workflow/nodes/llm/components/reasoning-format-config.tsx
@@ -15,7 +15,7 @@ const ReasoningFormatConfig: FC<ReasoningFormatConfigProps> = ({
onChange,
readonly = false,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<Field
diff --git a/web/app/components/workflow/nodes/llm/components/resolution-picker.tsx b/web/app/components/workflow/nodes/llm/components/resolution-picker.tsx
index 49ea47b03e9..68de863838f 100644
--- a/web/app/components/workflow/nodes/llm/components/resolution-picker.tsx
+++ b/web/app/components/workflow/nodes/llm/components/resolution-picker.tsx
@@ -14,7 +14,7 @@ type Props = Readonly<{
}>
const ResolutionPicker: FC<Props> = ({ value, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const handleOnChange = useCallback(
(value: Resolution) => {
diff --git a/web/app/components/workflow/nodes/llm/components/structure-output.tsx b/web/app/components/workflow/nodes/llm/components/structure-output.tsx
index 2901a5b6629..8e67c172eb5 100644
--- a/web/app/components/workflow/nodes/llm/components/structure-output.tsx
+++ b/web/app/components/workflow/nodes/llm/components/structure-output.tsx
@@ -15,7 +15,7 @@ type Props = Readonly<{
}>
export function StructureOutput({ className, value, onChange }: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const [showConfig, setShowConfig] = useState(false)
function handleChange(value: SchemaRoot) {
diff --git a/web/app/components/workflow/nodes/llm/default.ts b/web/app/components/workflow/nodes/llm/default.ts
index 5026ac5a46f..dec0beef655 100644
--- a/web/app/components/workflow/nodes/llm/default.ts
+++ b/web/app/components/workflow/nodes/llm/default.ts
@@ -70,7 +70,7 @@ const nodeDefault: NodeDefault<LLMNodeType> = {
},
checkValid(
payload: LLMNodeType,
- t: TFunction<'workflow'>,
+ t: TFunction<['workflow']>,
moreDataForCheckValid?: {
flowType?: FlowType
environmentVariables?: EnvironmentVariable[]
diff --git a/web/app/components/workflow/nodes/llm/panel.tsx b/web/app/components/workflow/nodes/llm/panel.tsx
index 854e1ffd9ed..7a0f75364cb 100644
--- a/web/app/components/workflow/nodes/llm/panel.tsx
+++ b/web/app/components/workflow/nodes/llm/panel.tsx
@@ -46,7 +46,7 @@ const getModelSelectionKey = (
`${source}:${environmentVariableName}:${provider}:${modelName}:${JSON.stringify(completionParams)}`
const Panel: FC<NodePanelProps<LLMNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const flowType = useHooksStore((s) => s.configsMap?.flowType)
const {
readOnly,
diff --git a/web/app/components/workflow/nodes/llm/use-single-run-form-params.ts b/web/app/components/workflow/nodes/llm/use-single-run-form-params.ts
index 1349a9f3de5..fdff56915c0 100644
--- a/web/app/components/workflow/nodes/llm/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/llm/use-single-run-form-params.ts
@@ -39,7 +39,7 @@ const useSingleRunFormParams = ({
setRunInputData,
toVarInputs,
}: Params) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { inputs } = useNodeCrud<LLMNodeType>(id, payload)
const getVarInputs = getInputVars
const isChatMode = useIsChatMode()
diff --git a/web/app/components/workflow/nodes/loop-start/index.tsx b/web/app/components/workflow/nodes/loop-start/index.tsx
index ba5e2f055c3..39a3caf8da9 100644
--- a/web/app/components/workflow/nodes/loop-start/index.tsx
+++ b/web/app/components/workflow/nodes/loop-start/index.tsx
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
import { NodeSourceHandle } from '@/app/components/workflow/nodes/_base/components/node-handle'
const LoopStartNode = ({ id, data }: NodeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="nodrag group mt-1 flex size-11 items-center justify-center rounded-2xl border border-workflow-block-border bg-workflow-block-bg">
@@ -30,7 +30,7 @@ const LoopStartNode = ({ id, data }: NodeProps) => {
}
export const LoopStartNodeDumb = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="nodrag relative top-5.25 left-4.25 z-11 flex h-11 w-11 items-center justify-center rounded-2xl border border-workflow-block-border bg-workflow-block-bg">
diff --git a/web/app/components/workflow/nodes/loop/add-block.tsx b/web/app/components/workflow/nodes/loop/add-block.tsx
index 58ef1b66842..0d0fcd400c8 100644
--- a/web/app/components/workflow/nodes/loop/add-block.tsx
+++ b/web/app/components/workflow/nodes/loop/add-block.tsx
@@ -15,7 +15,7 @@ type AddBlockProps = {
loopNodeData: LoopNodeType
}
const AddBlock = ({ loopNodeData }: AddBlockProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { nodesReadOnly } = useNodesReadOnly()
const { handleNodeAdd } = useNodesInteractions()
const { availableNextBlocks } = useAvailableBlocks(BlockEnum.Start, true)
diff --git a/web/app/components/workflow/nodes/loop/components/condition-add.tsx b/web/app/components/workflow/nodes/loop/components/condition-add.tsx
index 3c55de3dc54..622449fabe0 100644
--- a/web/app/components/workflow/nodes/loop/components/condition-add.tsx
+++ b/web/app/components/workflow/nodes/loop/components/condition-add.tsx
@@ -16,7 +16,7 @@ type ConditionAddProps = {
const ConditionAdd = ({ className, variables, onSelectVariable, disabled }: ConditionAddProps) => {
const searchInputRef = useRef<HTMLInputElement>(null)
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const handleSelectVariable = useCallback(
diff --git a/web/app/components/workflow/nodes/loop/components/condition-list/condition-input.tsx b/web/app/components/workflow/nodes/loop/components/condition-list/condition-input.tsx
index 0d7a8ad058c..63dfd5475c2 100644
--- a/web/app/components/workflow/nodes/loop/components/condition-list/condition-input.tsx
+++ b/web/app/components/workflow/nodes/loop/components/condition-list/condition-input.tsx
@@ -11,7 +11,7 @@ type ConditionInputProps = {
availableNodes: Node[]
}
const ConditionInput = ({ value, onChange, disabled, availableNodes }: ConditionInputProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const controlPromptEditorRerenderKey = useStore((s) => s.controlPromptEditorRerenderKey)
const pipelineId = useStore((s) => s.pipelineId)
const setShowInputFieldPanel = useStore((s) => s.setShowInputFieldPanel)
diff --git a/web/app/components/workflow/nodes/loop/components/condition-list/condition-item.tsx b/web/app/components/workflow/nodes/loop/components/condition-list/condition-item.tsx
index fe82743686d..3d2dc526a25 100644
--- a/web/app/components/workflow/nodes/loop/components/condition-list/condition-item.tsx
+++ b/web/app/components/workflow/nodes/loop/components/condition-list/condition-item.tsx
@@ -86,7 +86,7 @@ const ConditionItem = ({
ComparisonOperator.notIn,
]
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const [isHovered, setIsHovered] = useState(false)
const [open, setOpen] = useState(false)
diff --git a/web/app/components/workflow/nodes/loop/components/condition-list/condition-operator.tsx b/web/app/components/workflow/nodes/loop/components/condition-list/condition-operator.tsx
index c7642797339..b8e57bcd24c 100644
--- a/web/app/components/workflow/nodes/loop/components/condition-list/condition-operator.tsx
+++ b/web/app/components/workflow/nodes/loop/components/condition-list/condition-operator.tsx
@@ -32,7 +32,7 @@ const ConditionOperator = ({
value,
onSelect,
}: ConditionOperatorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const options = useMemo(() => {
return getOperators(varType, file).map((o) => {
diff --git a/web/app/components/workflow/nodes/loop/components/condition-number-input.tsx b/web/app/components/workflow/nodes/loop/components/condition-number-input.tsx
index 172ec1ca657..15950d5b03a 100644
--- a/web/app/components/workflow/nodes/loop/components/condition-number-input.tsx
+++ b/web/app/components/workflow/nodes/loop/components/condition-number-input.tsx
@@ -41,7 +41,7 @@ const ConditionNumberInput = ({
unit,
}: ConditionNumberInputProps) => {
const searchInputRef = useRef<HTMLInputElement>(null)
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [variableSelectorVisible, setVariableSelectorVisible] = useState(false)
const [isFocus, { setTrue: setFocus, setFalse: setBlur }] = useBoolean()
diff --git a/web/app/components/workflow/nodes/loop/components/condition-wrap.tsx b/web/app/components/workflow/nodes/loop/components/condition-wrap.tsx
index 07095700b0e..309824cb612 100644
--- a/web/app/components/workflow/nodes/loop/components/condition-wrap.tsx
+++ b/web/app/components/workflow/nodes/loop/components/condition-wrap.tsx
@@ -72,7 +72,7 @@ const ConditionWrap: FC<Props> = ({
availableNodes = [],
availableVars = [],
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const getAvailableVars = useGetAvailableVars()
diff --git a/web/app/components/workflow/nodes/loop/components/loop-variables/empty.tsx b/web/app/components/workflow/nodes/loop/components/loop-variables/empty.tsx
index a286eb077b3..1feea998c14 100644
--- a/web/app/components/workflow/nodes/loop/components/loop-variables/empty.tsx
+++ b/web/app/components/workflow/nodes/loop/components/loop-variables/empty.tsx
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next'
const Empty = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="flex h-10 items-center justify-center rounded-[10px] bg-background-section system-xs-regular text-text-tertiary">
diff --git a/web/app/components/workflow/nodes/loop/components/loop-variables/form-item.tsx b/web/app/components/workflow/nodes/loop/components/loop-variables/form-item.tsx
index aa57b679bf4..09748fa072c 100644
--- a/web/app/components/workflow/nodes/loop/components/loop-variables/form-item.tsx
+++ b/web/app/components/workflow/nodes/loop/components/loop-variables/form-item.tsx
@@ -24,7 +24,7 @@ type FormItemProps = {
onChange: (value: any) => void
}
const FormItem = ({ nodeId, item, onChange }: FormItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const { value_type, var_type, value } = item
const valueLabel = item.label || t(($) => $['errorMsg.fields.variableValue'], { ns: 'workflow' })
const normalizedVarValue = useMemo(() => {
diff --git a/web/app/components/workflow/nodes/loop/components/loop-variables/input-mode-selec.tsx b/web/app/components/workflow/nodes/loop/components/loop-variables/input-mode-selec.tsx
index 180947e3443..3d80a02e0b8 100644
--- a/web/app/components/workflow/nodes/loop/components/loop-variables/input-mode-selec.tsx
+++ b/web/app/components/workflow/nodes/loop/components/loop-variables/input-mode-selec.tsx
@@ -13,7 +13,7 @@ type InputModeSelectProps = {
onChange: (value: string) => void
}
const InputModeSelect = ({ value, onChange }: InputModeSelectProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const options = [
{
label: 'Variable',
diff --git a/web/app/components/workflow/nodes/loop/components/loop-variables/item.tsx b/web/app/components/workflow/nodes/loop/components/loop-variables/item.tsx
index 0f0e8319f74..5a6c4b18940 100644
--- a/web/app/components/workflow/nodes/loop/components/loop-variables/item.tsx
+++ b/web/app/components/workflow/nodes/loop/components/loop-variables/item.tsx
@@ -18,7 +18,7 @@ type ItemProps = {
item: LoopVariable
} & LoopVariablesComponentShape
const Item = ({ nodeId, item, handleRemoveLoopVariable, handleUpdateLoopVariable }: ItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'workflow'])
const variableNameLabel = t(($) => $['nodes.loop.variableName'], { ns: 'workflow' })
const checkVariableName = (value: string) => {
diff --git a/web/app/components/workflow/nodes/loop/default.ts b/web/app/components/workflow/nodes/loop/default.ts
index 364dbf516a2..08527888be2 100644
--- a/web/app/components/workflow/nodes/loop/default.ts
+++ b/web/app/components/workflow/nodes/loop/default.ts
@@ -29,7 +29,7 @@ const nodeDefault: NodeDefault<LoopNodeType> = {
_children: [],
logical_operator: LogicalOperator.and,
},
- checkValid(payload: LoopNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: LoopNodeType, t: TFunction<['workflow']>) {
let errorMessages = ''
payload.loop_variables?.forEach((variable) => {
diff --git a/web/app/components/workflow/nodes/loop/panel.tsx b/web/app/components/workflow/nodes/loop/panel.tsx
index 7fb2e95468c..5378e939c99 100644
--- a/web/app/components/workflow/nodes/loop/panel.tsx
+++ b/web/app/components/workflow/nodes/loop/panel.tsx
@@ -15,7 +15,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.loop'
const Panel: FC<NodePanelProps<LoopNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const {
readOnly,
diff --git a/web/app/components/workflow/nodes/loop/use-single-run-form-params.ts b/web/app/components/workflow/nodes/loop/use-single-run-form-params.ts
index d38a202e1e4..ceed20ebb4d 100644
--- a/web/app/components/workflow/nodes/loop/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/loop/use-single-run-form-params.ts
@@ -35,7 +35,7 @@ const useSingleRunFormParams = ({
toVarInputs,
varSelectorsToVarInputs,
}: Params) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { isNodeInLoop } = useIsNodeInLoop(id)
diff --git a/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/import-from-tool.tsx b/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/import-from-tool.tsx
index 7a4a21ff5f5..7bf6d2d80d9 100644
--- a/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/import-from-tool.tsx
+++ b/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/import-from-tool.tsx
@@ -35,7 +35,7 @@ function toParmExactParams(toolParams: ToolParameter[], lan: string): Param[] {
})
}
const ImportFromTool: FC<Props> = ({ onImport }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const language = useLanguage()
const { data: buildInTools } = useAllBuiltInTools()
diff --git a/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/item.tsx b/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/item.tsx
index 80d7aa9492e..438404dc733 100644
--- a/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/item.tsx
+++ b/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/item.tsx
@@ -14,7 +14,7 @@ type Props = Readonly<{
}>
const Item: FC<Props> = ({ payload, onEdit, onDelete }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="group relative rounded-lg bg-components-input-bg-normal px-2.5 py-2 hover:shadow-xs">
diff --git a/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/list.tsx b/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/list.tsx
index 9c5ab7decf5..8dc8c617a22 100644
--- a/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/list.tsx
+++ b/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/list.tsx
@@ -18,7 +18,7 @@ type Props = Readonly<{
}>
const List: FC<Props> = ({ list, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [isShowEditModal, setIsShowEditModal] = useState(false)
const handleItemChange = useCallback(
diff --git a/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/update.tsx b/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/update.tsx
index 406d500232d..753589c3513 100644
--- a/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/update.tsx
+++ b/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/update.tsx
@@ -54,7 +54,7 @@ const TYPES = [
]
const AddExtractParameter: FC<Props> = ({ type, payload, onSave, onCancel }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'workflow'])
const nameLabel = t(($) => $[`${i18nPrefix}.addExtractParameterContent.name`], {
ns: 'workflow',
})
diff --git a/web/app/components/workflow/nodes/parameter-extractor/components/reasoning-mode-picker.tsx b/web/app/components/workflow/nodes/parameter-extractor/components/reasoning-mode-picker.tsx
index 64b663e0712..1b54660ac78 100644
--- a/web/app/components/workflow/nodes/parameter-extractor/components/reasoning-mode-picker.tsx
+++ b/web/app/components/workflow/nodes/parameter-extractor/components/reasoning-mode-picker.tsx
@@ -15,7 +15,7 @@ type Props = Readonly<{
}>
const ReasoningModePicker: FC<Props> = ({ type, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const handleChange = useCallback(
(type: ReasoningModeType) => {
diff --git a/web/app/components/workflow/nodes/parameter-extractor/default.ts b/web/app/components/workflow/nodes/parameter-extractor/default.ts
index cd6b7099ab3..9f26cec1c3e 100644
--- a/web/app/components/workflow/nodes/parameter-extractor/default.ts
+++ b/web/app/components/workflow/nodes/parameter-extractor/default.ts
@@ -31,7 +31,7 @@ const nodeDefault: NodeDefault<ParameterExtractorNodeType> = {
enabled: false,
},
},
- checkValid(payload: ParameterExtractorNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: ParameterExtractorNodeType, t: TFunction<['workflow']>) {
let errorMessages = ''
if (!errorMessages && (!payload.query || payload.query.length === 0))
errorMessages = t(($) => $[`${i18nPrefix}errorMsg.fieldRequired`], {
diff --git a/web/app/components/workflow/nodes/parameter-extractor/panel.tsx b/web/app/components/workflow/nodes/parameter-extractor/panel.tsx
index 79d0f4ac531..4e300235b5b 100644
--- a/web/app/components/workflow/nodes/parameter-extractor/panel.tsx
+++ b/web/app/components/workflow/nodes/parameter-extractor/panel.tsx
@@ -26,7 +26,7 @@ const i18nCommonPrefix = 'common'
const Panel: FC<NodePanelProps<ParameterExtractorNodeType>> = ({ id, data }) => {
const instructionLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const {
readOnly,
diff --git a/web/app/components/workflow/nodes/parameter-extractor/use-single-run-form-params.ts b/web/app/components/workflow/nodes/parameter-extractor/use-single-run-form-params.ts
index 804a9193845..0928f076304 100644
--- a/web/app/components/workflow/nodes/parameter-extractor/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/parameter-extractor/use-single-run-form-params.ts
@@ -30,7 +30,7 @@ const useSingleRunFormParams = ({
getInputVars,
setRunInputData,
}: Params) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { inputs } = useNodeCrud<ParameterExtractorNodeType>(id, payload)
const model = inputs.model
diff --git a/web/app/components/workflow/nodes/question-classifier/components/advanced-setting.tsx b/web/app/components/workflow/nodes/question-classifier/components/advanced-setting.tsx
index ccc57d3b26e..30fb7a977ec 100644
--- a/web/app/components/workflow/nodes/question-classifier/components/advanced-setting.tsx
+++ b/web/app/components/workflow/nodes/question-classifier/components/advanced-setting.tsx
@@ -42,7 +42,7 @@ const AdvancedSetting: FC<Props> = ({
}) => {
const instructionLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<>
diff --git a/web/app/components/workflow/nodes/question-classifier/default.ts b/web/app/components/workflow/nodes/question-classifier/default.ts
index 8052c99c1c1..e4f9b54c2df 100644
--- a/web/app/components/workflow/nodes/question-classifier/default.ts
+++ b/web/app/components/workflow/nodes/question-classifier/default.ts
@@ -51,7 +51,7 @@ const nodeDefault: NodeDefault<QuestionClassifierNodeType> = {
enabled: false,
},
},
- checkValid(payload: QuestionClassifierNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: QuestionClassifierNodeType, t: TFunction<['workflow']>) {
let errorMessages = ''
if (
!errorMessages &&
diff --git a/web/app/components/workflow/nodes/question-classifier/panel.tsx b/web/app/components/workflow/nodes/question-classifier/panel.tsx
index 2a6efa48940..83c6c68c5ad 100644
--- a/web/app/components/workflow/nodes/question-classifier/panel.tsx
+++ b/web/app/components/workflow/nodes/question-classifier/panel.tsx
@@ -17,7 +17,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.questionClassifiers'
const Panel: FC<NodePanelProps<QuestionClassifierNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const {
readOnly,
diff --git a/web/app/components/workflow/nodes/question-classifier/use-single-run-form-params.ts b/web/app/components/workflow/nodes/question-classifier/use-single-run-form-params.ts
index 593e93bd8e0..91332682966 100644
--- a/web/app/components/workflow/nodes/question-classifier/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/question-classifier/use-single-run-form-params.ts
@@ -30,7 +30,7 @@ const useSingleRunFormParams = ({
getInputVars,
setRunInputData,
}: Params) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { inputs } = useNodeCrud<QuestionClassifierNodeType>(id, payload)
const model = inputs.model
diff --git a/web/app/components/workflow/nodes/start-placeholder/default.ts b/web/app/components/workflow/nodes/start-placeholder/default.ts
index d2fc3f2266a..848135e6cf4 100644
--- a/web/app/components/workflow/nodes/start-placeholder/default.ts
+++ b/web/app/components/workflow/nodes/start-placeholder/default.ts
@@ -19,7 +19,7 @@ const nodeDefault: NodeDefault<StartPlaceholderNodeType> = {
title: 'Workflow start',
desc: '',
},
- checkValid(_payload, t: TFunction<'workflow'>) {
+ checkValid(_payload, t: TFunction<['workflow']>) {
return {
isValid: false,
errorMessage: t(($) => $['nodes.startPlaceholder.validationRequired'], { ns: 'workflow' }),
diff --git a/web/app/components/workflow/nodes/start-placeholder/node.tsx b/web/app/components/workflow/nodes/start-placeholder/node.tsx
index a01ad7fb9be..1f88fa92f8d 100644
--- a/web/app/components/workflow/nodes/start-placeholder/node.tsx
+++ b/web/app/components/workflow/nodes/start-placeholder/node.tsx
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
const i18nPrefix = 'nodes.startPlaceholder'
const Node: FC<NodeProps> = ({ data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const descriptionKey = data.selected ? 'nodeDescription' : 'nodeCollapsedDescription'
return (
diff --git a/web/app/components/workflow/nodes/start-placeholder/panel.tsx b/web/app/components/workflow/nodes/start-placeholder/panel.tsx
index 5c396a48a3f..5825666b25f 100644
--- a/web/app/components/workflow/nodes/start-placeholder/panel.tsx
+++ b/web/app/components/workflow/nodes/start-placeholder/panel.tsx
@@ -43,7 +43,7 @@ const getTriggerPluginNodeData = (
}
const Panel: FC<NodePanelProps<StartPlaceholderNodeType>> = ({ id }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [searchText, setSearchText] = useState('')
const [tags, setTags] = useState<string[]>([])
const availableNodesMetaData = useHooksStore((s) => s.availableNodesMetaData)
diff --git a/web/app/components/workflow/nodes/start/components/var-item.tsx b/web/app/components/workflow/nodes/start/components/var-item.tsx
index 55c19d09a43..7cf9b99872e 100644
--- a/web/app/components/workflow/nodes/start/components/var-item.tsx
+++ b/web/app/components/workflow/nodes/start/components/var-item.tsx
@@ -35,7 +35,7 @@ const VarItem: FC<Props> = ({
showLegacyBadge = false,
canDrag,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const ref = useRef(null)
const isHovering = useHover(ref)
diff --git a/web/app/components/workflow/nodes/start/components/var-list.tsx b/web/app/components/workflow/nodes/start/components/var-list.tsx
index 246f4a8bf2c..d23b401f206 100644
--- a/web/app/components/workflow/nodes/start/components/var-list.tsx
+++ b/web/app/components/workflow/nodes/start/components/var-list.tsx
@@ -21,7 +21,7 @@ type Props = Readonly<{
}>
const VarList: FC<Props> = ({ readonly, list, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'workflow'])
const handleVarChange = useCallback(
(index: number) => {
diff --git a/web/app/components/workflow/nodes/start/node.tsx b/web/app/components/workflow/nodes/start/node.tsx
index 2b119ff87f5..f58cb795914 100644
--- a/web/app/components/workflow/nodes/start/node.tsx
+++ b/web/app/components/workflow/nodes/start/node.tsx
@@ -8,7 +8,7 @@ import InputVarTypeIcon from '../_base/components/input-var-type-icon'
const i18nPrefix = 'nodes.start'
const Node: FC<NodeProps<StartNodeType>> = ({ data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { variables } = data
if (!variables.length) return null
diff --git a/web/app/components/workflow/nodes/start/panel.tsx b/web/app/components/workflow/nodes/start/panel.tsx
index bd0bb7f801f..9dfd5da2f15 100644
--- a/web/app/components/workflow/nodes/start/panel.tsx
+++ b/web/app/components/workflow/nodes/start/panel.tsx
@@ -14,7 +14,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.start'
const Panel: FC<NodePanelProps<StartNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const {
readOnly,
isChatMode,
diff --git a/web/app/components/workflow/nodes/start/use-config.ts b/web/app/components/workflow/nodes/start/use-config.ts
index 35f2613f6cb..80d2e98e996 100644
--- a/web/app/components/workflow/nodes/start/use-config.ts
+++ b/web/app/components/workflow/nodes/start/use-config.ts
@@ -11,7 +11,7 @@ import useInspectVarsCrud from '../../hooks/use-inspect-vars-crud'
import { useIsChatMode, useNodesReadOnly, useWorkflow } from '../../hooks/use-workflow'
const useConfig = (id: string, payload: StartNodeType) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const { nodesReadOnly: readOnly } = useNodesReadOnly()
const { handleOutVarRenameChange, isVarUsedInNodes, removeUsedVarInNodes } = useWorkflow()
const isChatMode = useIsChatMode()
diff --git a/web/app/components/workflow/nodes/start/use-single-run-form-params.ts b/web/app/components/workflow/nodes/start/use-single-run-form-params.ts
index 5b94fec5a8f..efee059f567 100644
--- a/web/app/components/workflow/nodes/start/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/start/use-single-run-form-params.ts
@@ -16,7 +16,7 @@ type Params = {
toVarInputs: (variables: Variable[]) => InputVar[]
}
const useSingleRunFormParams = ({ id, payload, runInputData, setRunInputData }: Params) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const isChatMode = useIsChatMode()
const forms = (() => {
diff --git a/web/app/components/workflow/nodes/template-transform/default.ts b/web/app/components/workflow/nodes/template-transform/default.ts
index df1a83a1741..d8a6c1ff85b 100644
--- a/web/app/components/workflow/nodes/template-transform/default.ts
+++ b/web/app/components/workflow/nodes/template-transform/default.ts
@@ -19,7 +19,7 @@ const nodeDefault: NodeDefault<TemplateTransformNodeType> = {
template: '',
variables: [],
},
- checkValid(payload: TemplateTransformNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: TemplateTransformNodeType, t: TFunction<['workflow']>) {
let errorMessages = ''
const { template, variables } = payload
diff --git a/web/app/components/workflow/nodes/template-transform/panel.tsx b/web/app/components/workflow/nodes/template-transform/panel.tsx
index b150c10306d..a58f09b1cf9 100644
--- a/web/app/components/workflow/nodes/template-transform/panel.tsx
+++ b/web/app/components/workflow/nodes/template-transform/panel.tsx
@@ -15,7 +15,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.templateTransform'
const Panel: FC<NodePanelProps<TemplateTransformNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const {
readOnly,
diff --git a/web/app/components/workflow/nodes/tool/components/copy-id.tsx b/web/app/components/workflow/nodes/tool/components/copy-id.tsx
index 69673d62496..5caa79fd401 100644
--- a/web/app/components/workflow/nodes/tool/components/copy-id.tsx
+++ b/web/app/components/workflow/nodes/tool/components/copy-id.tsx
@@ -13,7 +13,7 @@ type Props = Readonly<{
const prefixEmbedded = 'overview.appInfo.embedded'
const CopyFeedbackNew = ({ content }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appOverview'])
const [isCopied, setIsCopied] = useState<boolean>(false)
const onClickCopy = debounce(() => {
diff --git a/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/index.tsx b/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/index.tsx
index f892aa63988..6e4c9824499 100644
--- a/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/index.tsx
+++ b/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/index.tsx
@@ -27,7 +27,7 @@ const MixedVariableTextInput = ({
onManageInputField,
disableVariableInsertion = false,
}: MixedVariableTextInputProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const controlPromptEditorRerenderKey = useStore((s) => s.controlPromptEditorRerenderKey)
return (
diff --git a/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/placeholder.tsx b/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/placeholder.tsx
index 38757055c1e..aa335f8eaad 100644
--- a/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/placeholder.tsx
+++ b/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/placeholder.tsx
@@ -13,7 +13,7 @@ type PlaceholderProps = {
}
const Placeholder = ({ disableVariableInsertion = false, hideBadge = false }: PlaceholderProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [editor] = useLexicalComposerContext()
const handleInsert = useCallback(
diff --git a/web/app/components/workflow/nodes/tool/components/tool-date-picker.tsx b/web/app/components/workflow/nodes/tool/components/tool-date-picker.tsx
index 9f8afb2106a..b0f608dec34 100644
--- a/web/app/components/workflow/nodes/tool/components/tool-date-picker.tsx
+++ b/web/app/components/workflow/nodes/tool/components/tool-date-picker.tsx
@@ -31,7 +31,7 @@ const ToolDatePicker: FC<Props> = ({
placeholder,
readOnly = false,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'time'])
const locale = useLocale()
const displayFormat = t(($) => $['dateFormats.display'], { ns: 'time' })
const resolvedPlaceholder = placeholder || t(($) => $['operation.pickDate'], { ns: 'time' })
diff --git a/web/app/components/workflow/nodes/tool/components/tool-date-range-picker.tsx b/web/app/components/workflow/nodes/tool/components/tool-date-range-picker.tsx
index d40e5a8051b..a67db8b73a9 100644
--- a/web/app/components/workflow/nodes/tool/components/tool-date-range-picker.tsx
+++ b/web/app/components/workflow/nodes/tool/components/tool-date-range-picker.tsx
@@ -23,7 +23,7 @@ type Props = {
}
const ToolDateRangePicker: FC<Props> = ({ value, onChange, readOnly = false, timezone }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['time', 'workflow'])
const parsed = parseToolDateRangeValue(value)
const patch = (partial: Partial<{ start?: string; end?: string }>) => {
diff --git a/web/app/components/workflow/nodes/tool/default.ts b/web/app/components/workflow/nodes/tool/default.ts
index 61d493e4c12..c14f9ace4f1 100644
--- a/web/app/components/workflow/nodes/tool/default.ts
+++ b/web/app/components/workflow/nodes/tool/default.ts
@@ -24,7 +24,7 @@ const nodeDefault: NodeDefault<ToolNodeType> = {
tool_configurations: {},
tool_node_version: '2',
},
- checkValid(payload: ToolNodeType, t: TFunction<'workflow'>, moreDataForCheckValid: any) {
+ checkValid(payload: ToolNodeType, t: TFunction<['workflow']>, moreDataForCheckValid: any) {
const { toolInputsSchema, toolSettingSchema, language, notAuthed } = moreDataForCheckValid
let errorMessages = ''
if (notAuthed) errorMessages = t(($) => $[`${i18nPrefix}.authRequired`], { ns: 'workflow' })
diff --git a/web/app/components/workflow/nodes/tool/hooks/use-config.ts b/web/app/components/workflow/nodes/tool/hooks/use-config.ts
index 3ad066eb0f6..b557bec7c77 100644
--- a/web/app/components/workflow/nodes/tool/hooks/use-config.ts
+++ b/web/app/components/workflow/nodes/tool/hooks/use-config.ts
@@ -29,7 +29,7 @@ const formatDisplayType = (output: Record<string, unknown>): string => {
const useConfig = (id: string, payload: ToolNodeType) => {
const workflowStore = useWorkflowStore()
const { nodesReadOnly: readOnly } = useNodesReadOnly()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const language = useLanguage()
const { inputs, setInputs: doSetInputs } = useNodeCrud<ToolNodeType>(id, payload)
diff --git a/web/app/components/workflow/nodes/tool/hooks/use-single-run-form-params.ts b/web/app/components/workflow/nodes/tool/hooks/use-single-run-form-params.ts
index c3c92a0c526..f0a790d8ec9 100644
--- a/web/app/components/workflow/nodes/tool/hooks/use-single-run-form-params.ts
+++ b/web/app/components/workflow/nodes/tool/hooks/use-single-run-form-params.ts
@@ -28,7 +28,7 @@ const useSingleRunFormParams = ({
setRunInputData,
runResult,
}: Params) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { inputs } = useNodeCrud<ToolNodeType>(id, payload)
const hadVarParams = Object.keys(inputs.tool_parameters)
diff --git a/web/app/components/workflow/nodes/tool/node.tsx b/web/app/components/workflow/nodes/tool/node.tsx
index f5dc719143e..ca629e39699 100644
--- a/web/app/components/workflow/nodes/tool/node.tsx
+++ b/web/app/components/workflow/nodes/tool/node.tsx
@@ -10,7 +10,7 @@ import { isToolAuthorizationRequired } from './auth'
import useCurrentToolCollection from './hooks/use-current-tool-collection'
const Node: FC<NodeProps<ToolNodeType>> = ({ data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { tool_configurations, paramSchemas } = data
const toolConfigs = Object.keys(tool_configurations || {})
const { isChecking, isMissing, uniqueIdentifier, canInstall, onInstallSuccess, shouldDim } =
diff --git a/web/app/components/workflow/nodes/tool/panel.tsx b/web/app/components/workflow/nodes/tool/panel.tsx
index 79d71b68814..fbf2389a1fe 100644
--- a/web/app/components/workflow/nodes/tool/panel.tsx
+++ b/web/app/components/workflow/nodes/tool/panel.tsx
@@ -19,7 +19,7 @@ import useConfig from './hooks/use-config'
const i18nPrefix = 'nodes.tool'
const Panel: FC<NodePanelProps<ToolNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const {
readOnly,
inputs,
diff --git a/web/app/components/workflow/nodes/trigger-plugin/default.ts b/web/app/components/workflow/nodes/trigger-plugin/default.ts
index 1256faf4cb2..b6c8c04f848 100644
--- a/web/app/components/workflow/nodes/trigger-plugin/default.ts
+++ b/web/app/components/workflow/nodes/trigger-plugin/default.ts
@@ -242,7 +242,7 @@ const nodeDefault: NodeDefault<PluginTriggerNodeType> = {
},
checkValid(
payload: PluginTriggerNodeType,
- t: TFunction<'workflow'>,
+ t: TFunction<['workflow']>,
moreDataForCheckValid: {
triggerInputsSchema?: Array<{
variable: string
diff --git a/web/app/components/workflow/nodes/trigger-plugin/node.tsx b/web/app/components/workflow/nodes/trigger-plugin/node.tsx
index d6c0fb01787..2728b4a6c43 100644
--- a/web/app/components/workflow/nodes/trigger-plugin/node.tsx
+++ b/web/app/components/workflow/nodes/trigger-plugin/node.tsx
@@ -41,7 +41,7 @@ const Node: FC<NodeProps<PluginTriggerNodeType>> = ({ id, data }) => {
useNodePluginInstallation(data)
const showInstallButton = !isChecking && isMissing && canInstall && uniqueIdentifier
- const { t } = useTranslation()
+ const { t } = useTranslation(['pluginTrigger'])
const isValidSubscription = useMemo(() => {
return subscription_id && subscriptions?.some((sub) => sub.id === subscription_id)
diff --git a/web/app/components/workflow/nodes/trigger-schedule/components/frequency-selector.tsx b/web/app/components/workflow/nodes/trigger-schedule/components/frequency-selector.tsx
index e236c35720f..6722f4a2919 100644
--- a/web/app/components/workflow/nodes/trigger-schedule/components/frequency-selector.tsx
+++ b/web/app/components/workflow/nodes/trigger-schedule/components/frequency-selector.tsx
@@ -23,7 +23,7 @@ type FrequencySelectorProps = {
}
const FrequencySelector = ({ frequency, onChange }: FrequencySelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const groupLabel = t(($) => $['nodes.triggerSchedule.frequency.label'], { ns: 'workflow' })
const fieldLabel = t(($) => $['nodes.triggerSchedule.frequencyLabel'], { ns: 'workflow' })
diff --git a/web/app/components/workflow/nodes/trigger-schedule/components/mode-toggle.tsx b/web/app/components/workflow/nodes/trigger-schedule/components/mode-toggle.tsx
index 2f05a3472ab..4d5e308fed1 100644
--- a/web/app/components/workflow/nodes/trigger-schedule/components/mode-toggle.tsx
+++ b/web/app/components/workflow/nodes/trigger-schedule/components/mode-toggle.tsx
@@ -8,7 +8,7 @@ type ModeToggleProps = {
}
const ModeToggle = ({ mode, onChange }: ModeToggleProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const handleToggle = () => {
const newMode = mode === 'visual' ? 'cron' : 'visual'
diff --git a/web/app/components/workflow/nodes/trigger-schedule/components/monthly-days-selector.tsx b/web/app/components/workflow/nodes/trigger-schedule/components/monthly-days-selector.tsx
index 7215dd441f4..bf9218cd7f5 100644
--- a/web/app/components/workflow/nodes/trigger-schedule/components/monthly-days-selector.tsx
+++ b/web/app/components/workflow/nodes/trigger-schedule/components/monthly-days-selector.tsx
@@ -11,7 +11,7 @@ type MonthlyDaysSelectorProps = {
const MonthlyDaysSelector = ({ selectedDays, onChange }: MonthlyDaysSelectorProps) => {
const lastDayLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const handleDayClick = (day: number | 'last') => {
const current = selectedDays || []
diff --git a/web/app/components/workflow/nodes/trigger-schedule/components/next-execution-times.tsx b/web/app/components/workflow/nodes/trigger-schedule/components/next-execution-times.tsx
index fcf8b3b8ff3..2dad5287b4d 100644
--- a/web/app/components/workflow/nodes/trigger-schedule/components/next-execution-times.tsx
+++ b/web/app/components/workflow/nodes/trigger-schedule/components/next-execution-times.tsx
@@ -8,7 +8,7 @@ type NextExecutionTimesProps = {
}
const NextExecutionTimes = ({ data }: NextExecutionTimesProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
if (!data.frequency) return null
diff --git a/web/app/components/workflow/nodes/trigger-schedule/components/on-minute-selector.tsx b/web/app/components/workflow/nodes/trigger-schedule/components/on-minute-selector.tsx
index 5a7fdd29ea4..aec0a597aa1 100644
--- a/web/app/components/workflow/nodes/trigger-schedule/components/on-minute-selector.tsx
+++ b/web/app/components/workflow/nodes/trigger-schedule/components/on-minute-selector.tsx
@@ -15,7 +15,7 @@ type OnMinuteSelectorProps = {
}
const OnMinuteSelector = ({ value = 0, onChange }: OnMinuteSelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<Slider
diff --git a/web/app/components/workflow/nodes/trigger-schedule/components/weekday-selector.tsx b/web/app/components/workflow/nodes/trigger-schedule/components/weekday-selector.tsx
index ecde0844388..d2278a57f8f 100644
--- a/web/app/components/workflow/nodes/trigger-schedule/components/weekday-selector.tsx
+++ b/web/app/components/workflow/nodes/trigger-schedule/components/weekday-selector.tsx
@@ -8,7 +8,7 @@ type WeekdaySelectorProps = {
}
const WeekdaySelector = ({ selectedDays, onChange }: WeekdaySelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const weekdays = [
{ key: 'sun', label: 'Sun' },
diff --git a/web/app/components/workflow/nodes/trigger-schedule/default.ts b/web/app/components/workflow/nodes/trigger-schedule/default.ts
index 2f7979e53a6..d3fd7e8f776 100644
--- a/web/app/components/workflow/nodes/trigger-schedule/default.ts
+++ b/web/app/components/workflow/nodes/trigger-schedule/default.ts
@@ -25,14 +25,14 @@ const isValidTimeFormat = (time: string): boolean => {
)
}
-const validateHourlyConfig = (config: any, t: TFunction<'workflow'>): string => {
+const validateHourlyConfig = (config: any, t: TFunction<['workflow']>): string => {
if (config.on_minute === undefined || config.on_minute < 0 || config.on_minute > 59)
return t(($) => $['nodes.triggerSchedule.invalidOnMinute'], { ns: 'workflow' })
return ''
}
-const validateDailyConfig = (config: any, t: TFunction<'workflow'>): string => {
+const validateDailyConfig = (config: any, t: TFunction<['workflow']>): string => {
const i18nPrefix = 'errorMsg'
if (!config.time)
@@ -47,7 +47,7 @@ const validateDailyConfig = (config: any, t: TFunction<'workflow'>): string => {
return ''
}
-const validateWeeklyConfig = (config: any, t: TFunction<'workflow'>): string => {
+const validateWeeklyConfig = (config: any, t: TFunction<['workflow']>): string => {
const dailyError = validateDailyConfig(config, t)
if (dailyError) return dailyError
@@ -68,7 +68,7 @@ const validateWeeklyConfig = (config: any, t: TFunction<'workflow'>): string =>
return ''
}
-const validateMonthlyConfig = (config: any, t: TFunction<'workflow'>): string => {
+const validateMonthlyConfig = (config: any, t: TFunction<['workflow']>): string => {
const dailyError = validateDailyConfig(config, t)
if (dailyError) return dailyError
@@ -99,7 +99,7 @@ const validateMonthlyConfig = (config: any, t: TFunction<'workflow'>): string =>
const validateVisualConfig = (
payload: ScheduleTriggerNodeType,
- t: TFunction<'workflow'>,
+ t: TFunction<['workflow']>,
): string => {
const i18nPrefix = 'errorMsg'
const { visual_config } = payload
@@ -137,7 +137,7 @@ const nodeDefault: NodeDefault<ScheduleTriggerNodeType> = {
...getDefaultScheduleConfig(),
cron_expression: '',
} as ScheduleTriggerNodeType,
- checkValid(payload: ScheduleTriggerNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: ScheduleTriggerNodeType, t: TFunction<['workflow']>) {
const i18nPrefix = 'errorMsg'
let errorMessages = ''
if (!errorMessages && !payload.mode)
diff --git a/web/app/components/workflow/nodes/trigger-schedule/node.tsx b/web/app/components/workflow/nodes/trigger-schedule/node.tsx
index 32cca190b0c..b0f0d0418e8 100644
--- a/web/app/components/workflow/nodes/trigger-schedule/node.tsx
+++ b/web/app/components/workflow/nodes/trigger-schedule/node.tsx
@@ -8,7 +8,7 @@ import { getNextExecutionTime } from './utils/execution-time-calculator'
const i18nPrefix = 'nodes.triggerSchedule'
const Node: FC<NodeProps<ScheduleTriggerNodeType>> = ({ data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="mb-1 px-3 py-1">
diff --git a/web/app/components/workflow/nodes/trigger-schedule/panel.tsx b/web/app/components/workflow/nodes/trigger-schedule/panel.tsx
index 18aadb8e844..1072c910d20 100644
--- a/web/app/components/workflow/nodes/trigger-schedule/panel.tsx
+++ b/web/app/components/workflow/nodes/trigger-schedule/panel.tsx
@@ -18,7 +18,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.triggerSchedule'
const Panel: FC<NodePanelProps<ScheduleTriggerNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const timeInputId = React.useId()
const {
inputs,
diff --git a/web/app/components/workflow/nodes/trigger-webhook/components/header-table.tsx b/web/app/components/workflow/nodes/trigger-webhook/components/header-table.tsx
index a01b94a58e4..1e71c7cf8f8 100644
--- a/web/app/components/workflow/nodes/trigger-webhook/components/header-table.tsx
+++ b/web/app/components/workflow/nodes/trigger-webhook/components/header-table.tsx
@@ -13,7 +13,7 @@ type HeaderTableProps = {
}
const HeaderTable: FC<HeaderTableProps> = ({ readonly = false, headers = [], onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
// Define columns for header table - matching prototype design
const columns: ColumnConfig[] = [
diff --git a/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx b/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx
index 5364aea3c94..03040ba2edb 100644
--- a/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx
+++ b/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx
@@ -26,7 +26,7 @@ const ParameterTable: FC<ParameterTableProps> = ({
placeholder,
contentType,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
// Memoize typeOptions to prevent unnecessary re-renders that cause Select state resets
const typeOptions = useMemo(() => createParameterTypeOptions(contentType), [contentType])
diff --git a/web/app/components/workflow/nodes/trigger-webhook/default.ts b/web/app/components/workflow/nodes/trigger-webhook/default.ts
index f8818410344..c01a6ce2ee7 100644
--- a/web/app/components/workflow/nodes/trigger-webhook/default.ts
+++ b/web/app/components/workflow/nodes/trigger-webhook/default.ts
@@ -27,7 +27,7 @@ const nodeDefault: NodeDefault<WebhookTriggerNodeType> = {
response_body: '',
variables: [createWebhookRawVariable()],
},
- checkValid(payload: WebhookTriggerNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: WebhookTriggerNodeType, t: TFunction<['workflow']>) {
// Require webhook_url to be configured
if (!payload.webhook_url || payload.webhook_url.trim() === '') {
return {
diff --git a/web/app/components/workflow/nodes/trigger-webhook/panel.tsx b/web/app/components/workflow/nodes/trigger-webhook/panel.tsx
index ed025378530..8a4a82ade59 100644
--- a/web/app/components/workflow/nodes/trigger-webhook/panel.tsx
+++ b/web/app/components/workflow/nodes/trigger-webhook/panel.tsx
@@ -100,7 +100,7 @@ const WebhookMethodSelector = ({
}
const Panel: FC<NodePanelProps<WebhookTriggerNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const webhookUrlId = useId()
const { copied: debugUrlCopied, copy: copyDebugUrl } = useClipboard({ timeout: 2000 })
const [outputVarsCollapsed, setOutputVarsCollapsed] = useState(false)
diff --git a/web/app/components/workflow/nodes/trigger-webhook/use-config.ts b/web/app/components/workflow/nodes/trigger-webhook/use-config.ts
index be9cacbcb47..c1e7509d857 100644
--- a/web/app/components/workflow/nodes/trigger-webhook/use-config.ts
+++ b/web/app/components/workflow/nodes/trigger-webhook/use-config.ts
@@ -31,7 +31,7 @@ function isVarKeyErrorKey(key: string): key is keyof typeof varKeyErrorSelectors
}
export const useConfig = (id: string, payload: WebhookTriggerNodeType) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const { nodesReadOnly: readOnly } = useNodesReadOnly()
const { inputs, setInputs } = useNodeCrud<WebhookTriggerNodeType>(id, payload)
const appId = useAppStore.getState().appDetail?.id
diff --git a/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx b/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx
index 869625f7365..cebbfddd214 100644
--- a/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx
+++ b/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx
@@ -27,7 +27,7 @@ type NodeGroupItemProps = {
item: GroupItem
}
const NodeGroupItem = ({ item }: NodeGroupItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const enteringNodePayload = useStore((s) => s.enteringNodePayload)
const hoveringAssignVariableGroupId = useStore((s) => s.hoveringAssignVariableGroupId)
const nodes: Node[] = useNodes()
diff --git a/web/app/components/workflow/nodes/variable-assigner/components/var-group-item.tsx b/web/app/components/workflow/nodes/variable-assigner/components/var-group-item.tsx
index 2507c63c459..89050828393 100644
--- a/web/app/components/workflow/nodes/variable-assigner/components/var-group-item.tsx
+++ b/web/app/components/workflow/nodes/variable-assigner/components/var-group-item.tsx
@@ -44,7 +44,7 @@ const VarGroupItem: FC<Props> = ({
onRemove,
availableVars,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'workflow'])
const handleAddVariable = useCallback(
(value: ValueSelector | string, _varKindType: VarKindType, varInfo?: Var) => {
diff --git a/web/app/components/workflow/nodes/variable-assigner/components/var-list/index.tsx b/web/app/components/workflow/nodes/variable-assigner/components/var-list/index.tsx
index 1bd69ac9e67..00f38faa9c2 100644
--- a/web/app/components/workflow/nodes/variable-assigner/components/var-list/index.tsx
+++ b/web/app/components/workflow/nodes/variable-assigner/components/var-list/index.tsx
@@ -21,7 +21,7 @@ type Props = Readonly<{
}>
const VarList: FC<Props> = ({ readonly, nodeId, list, onChange, onOpen = noop, filterVar }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const handleVarReferenceChange = useCallback(
(index: number) => {
return (value: ValueSelector | string) => {
diff --git a/web/app/components/workflow/nodes/variable-assigner/default.ts b/web/app/components/workflow/nodes/variable-assigner/default.ts
index 87a5acddfe9..80895a47627 100644
--- a/web/app/components/workflow/nodes/variable-assigner/default.ts
+++ b/web/app/components/workflow/nodes/variable-assigner/default.ts
@@ -24,7 +24,7 @@ const nodeDefault: NodeDefault<VariableAssignerNodeType> = {
output_type: VarType.any,
variables: [],
},
- checkValid(payload: VariableAssignerNodeType, t: TFunction<'workflow'>) {
+ checkValid(payload: VariableAssignerNodeType, t: TFunction<['workflow']>) {
let errorMessages = ''
const { variables, advanced_settings } = payload
const { group_enabled = false, groups = [] } = advanced_settings || {}
diff --git a/web/app/components/workflow/nodes/variable-assigner/node.tsx b/web/app/components/workflow/nodes/variable-assigner/node.tsx
index e049ed3167a..cf21d9e2893 100644
--- a/web/app/components/workflow/nodes/variable-assigner/node.tsx
+++ b/web/app/components/workflow/nodes/variable-assigner/node.tsx
@@ -8,7 +8,7 @@ import NodeGroupItem from './components/node-group-item'
const i18nPrefix = 'nodes.variableAssigner'
const Node: FC<NodeProps<VariableAssignerNodeType>> = (props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const ref = useRef<HTMLDivElement>(null)
const { id, data } = props
const { advanced_settings } = data
diff --git a/web/app/components/workflow/nodes/variable-assigner/panel.tsx b/web/app/components/workflow/nodes/variable-assigner/panel.tsx
index 620697c7cd1..01592d1c192 100644
--- a/web/app/components/workflow/nodes/variable-assigner/panel.tsx
+++ b/web/app/components/workflow/nodes/variable-assigner/panel.tsx
@@ -15,7 +15,7 @@ import useConfig from './use-config'
const i18nPrefix = 'nodes.variableAssigner'
const Panel: FC<NodePanelProps<VariableAssignerNodeType>> = ({ id, data }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const {
readOnly,
diff --git a/web/app/components/workflow/note-node/index.tsx b/web/app/components/workflow/note-node/index.tsx
index aac7c317b16..90bc7545580 100644
--- a/web/app/components/workflow/note-node/index.tsx
+++ b/web/app/components/workflow/note-node/index.tsx
@@ -27,7 +27,7 @@ const Icon = () => {
}
const NoteNode = ({ id, data }: NodeProps<NoteNodeType>) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const controlPromptEditorRerenderKey = useStore((s) => s.controlPromptEditorRerenderKey)
const setHistoryShortcutsEnabled = useStore((s) => s.setHistoryShortcutsEnabled)
const ref = useRef<HTMLDivElement | null>(null)
diff --git a/web/app/components/workflow/note-node/note-editor/editor.tsx b/web/app/components/workflow/note-node/note-editor/editor.tsx
index 451e1baf234..bb8acc5c205 100644
--- a/web/app/components/workflow/note-node/note-editor/editor.tsx
+++ b/web/app/components/workflow/note-node/note-editor/editor.tsx
@@ -28,7 +28,7 @@ const Editor = ({
containerElement,
setHistoryShortcutsEnabled,
}: EditorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const handleEditorChange = useCallback(
(editorState: EditorState) => {
onChange?.(editorState)
diff --git a/web/app/components/workflow/note-node/note-editor/plugins/link-editor-plugin/component.tsx b/web/app/components/workflow/note-node/note-editor/plugins/link-editor-plugin/component.tsx
index 23817ba1f08..88e40d12a20 100644
--- a/web/app/components/workflow/note-node/note-editor/plugins/link-editor-plugin/component.tsx
+++ b/web/app/components/workflow/note-node/note-editor/plugins/link-editor-plugin/component.tsx
@@ -21,7 +21,7 @@ type LinkEditorComponentProps = {
containerElement: HTMLDivElement | null
}
const LinkEditorComponent = ({ containerElement }: LinkEditorComponentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const { handleSaveLink, handleUnlink, restoreEditorFocus } = useLink()
const selectedLinkUrl = useStore((s) => s.selectedLinkUrl)
const linkAnchorElement = useStore((s) => s.linkAnchorElement)
diff --git a/web/app/components/workflow/note-node/note-editor/plugins/link-editor-plugin/hooks.ts b/web/app/components/workflow/note-node/note-editor/plugins/link-editor-plugin/hooks.ts
index 01efe72ac52..c421527ef48 100644
--- a/web/app/components/workflow/note-node/note-editor/plugins/link-editor-plugin/hooks.ts
+++ b/web/app/components/workflow/note-node/note-editor/plugins/link-editor-plugin/hooks.ts
@@ -91,7 +91,7 @@ export const useOpenLink = () => {
}, [editor, noteEditorStore])
}
export const useLink = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [editor] = useLexicalComposerContext()
const noteEditorStore = useNoteEditorStore()
const handleSaveLink = useCallback(
diff --git a/web/app/components/workflow/note-node/note-editor/toolbar/command.tsx b/web/app/components/workflow/note-node/note-editor/toolbar/command.tsx
index e1a61611f31..bdfd58b4fe8 100644
--- a/web/app/components/workflow/note-node/note-editor/toolbar/command.tsx
+++ b/web/app/components/workflow/note-node/note-editor/toolbar/command.tsx
@@ -9,7 +9,7 @@ type CommandProps = {
type: 'bold' | 'italic' | 'strikethrough' | 'link' | 'bullet'
}
const Command = ({ type }: CommandProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const selectedIsBold = useStore((s) => s.selectedIsBold)
const selectedIsItalic = useStore((s) => s.selectedIsItalic)
const selectedIsStrikeThrough = useStore((s) => s.selectedIsStrikeThrough)
diff --git a/web/app/components/workflow/note-node/note-editor/toolbar/font-size-selector.tsx b/web/app/components/workflow/note-node/note-editor/toolbar/font-size-selector.tsx
index a17b872b013..7c36e13c9a0 100644
--- a/web/app/components/workflow/note-node/note-editor/toolbar/font-size-selector.tsx
+++ b/web/app/components/workflow/note-node/note-editor/toolbar/font-size-selector.tsx
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
import { useFontSize } from './hooks'
const FontSizeSelector = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const FONT_SIZE_LIST = [
{
key: '12px',
diff --git a/web/app/components/workflow/note-node/note-editor/toolbar/operator.tsx b/web/app/components/workflow/note-node/note-editor/toolbar/operator.tsx
index e25c8af6e52..6a21318e5e3 100644
--- a/web/app/components/workflow/note-node/note-editor/toolbar/operator.tsx
+++ b/web/app/components/workflow/note-node/note-editor/toolbar/operator.tsx
@@ -27,7 +27,7 @@ const Operator = ({
showAuthor,
onShowAuthorChange,
}: OperatorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const [open, setOpen] = useState(false)
return (
diff --git a/web/app/components/workflow/operator/add-block.tsx b/web/app/components/workflow/operator/add-block.tsx
index 0ee6cfc9010..1e2e13be197 100644
--- a/web/app/components/workflow/operator/add-block.tsx
+++ b/web/app/components/workflow/operator/add-block.tsx
@@ -33,7 +33,7 @@ const AddBlock = ({
onClose,
isolateKeyboardEvents,
}: AddBlockProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const store = useStoreApi()
const workflowStore = useWorkflowStore()
const isChatMode = useIsChatMode()
diff --git a/web/app/components/workflow/operator/control.tsx b/web/app/components/workflow/operator/control.tsx
index a0ad98728a0..e1e0d8181ec 100644
--- a/web/app/components/workflow/operator/control.tsx
+++ b/web/app/components/workflow/operator/control.tsx
@@ -18,7 +18,7 @@ const pressedModeClassName =
'data-pressed:bg-state-accent-active data-pressed:text-text-accent data-pressed:hover:bg-state-base-hover data-pressed:hover:text-text-secondary data-disabled:data-pressed:text-text-disabled data-disabled:data-pressed:hover:bg-transparent data-disabled:data-pressed:hover:text-text-disabled'
const Control = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const controlMode = useStore((s) => s.controlMode)
const {
handleModePointer,
diff --git a/web/app/components/workflow/operator/more-actions.tsx b/web/app/components/workflow/operator/more-actions.tsx
index 0d139407114..388fefeeb75 100644
--- a/web/app/components/workflow/operator/more-actions.tsx
+++ b/web/app/components/workflow/operator/more-actions.tsx
@@ -17,7 +17,7 @@ import { useNodesReadOnly } from '../hooks/use-workflow'
import TipPopup from './tip-popup'
function MoreActions() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { getNodesReadOnly } = useNodesReadOnly()
const reactFlow = useReactFlow()
diff --git a/web/app/components/workflow/operator/zoom-in-out.tsx b/web/app/components/workflow/operator/zoom-in-out.tsx
index a7affb6eccd..6162d4e39af 100644
--- a/web/app/components/workflow/operator/zoom-in-out.tsx
+++ b/web/app/components/workflow/operator/zoom-in-out.tsx
@@ -52,7 +52,7 @@ const ZoomInOut: FC<ZoomInOutProps> = ({
onToggleUserComments,
isCommentMode = false,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { zoomIn, zoomOut, zoomTo, fitView } = useReactFlow()
const { zoom } = useViewport()
const { handleSyncWorkflowDraft } = useNodesSyncDraft()
diff --git a/web/app/components/workflow/panel-contextmenu.tsx b/web/app/components/workflow/panel-contextmenu.tsx
index 0eb6785aa32..f36df29f705 100644
--- a/web/app/components/workflow/panel-contextmenu.tsx
+++ b/web/app/components/workflow/panel-contextmenu.tsx
@@ -23,7 +23,7 @@ import { useStore } from './store'
import { WorkflowRunningStatus } from './types'
export function PanelContextmenu({ onClose }: { onClose: () => void }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'workflow'])
const isPanelContextMenu = useStore((s) => s.contextMenuTarget?.type === 'panel')
const clipboardElements = useStore((s) => s.clipboardElements)
const setShowImportDSLModal = useStore((s) => s.setShowImportDSLModal)
diff --git a/web/app/components/workflow/panel/chat-record/user-input.tsx b/web/app/components/workflow/panel/chat-record/user-input.tsx
index ef237fb4827..bcc9e880516 100644
--- a/web/app/components/workflow/panel/chat-record/user-input.tsx
+++ b/web/app/components/workflow/panel/chat-record/user-input.tsx
@@ -12,7 +12,7 @@ type UserInputProps = {
}
const UserInput = ({ variables = [], initialExpanded = true }: UserInputProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [expanded, setExpanded] = useState(initialExpanded)
if (!variables.length) return null
diff --git a/web/app/components/workflow/panel/chat-variable-panel/components/array-bool-list.tsx b/web/app/components/workflow/panel/chat-variable-panel/components/array-bool-list.tsx
index 77eab8adfe2..4dc73ec3d4d 100644
--- a/web/app/components/workflow/panel/chat-variable-panel/components/array-bool-list.tsx
+++ b/web/app/components/workflow/panel/chat-variable-panel/components/array-bool-list.tsx
@@ -17,7 +17,7 @@ type Props = Readonly<{
}>
const ArrayValueList: FC<Props> = ({ className, list, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const handleChange = useCallback(
(index: number) => {
diff --git a/web/app/components/workflow/panel/chat-variable-panel/components/array-value-list.tsx b/web/app/components/workflow/panel/chat-variable-panel/components/array-value-list.tsx
index 45a78db4eb9..54a7472e274 100644
--- a/web/app/components/workflow/panel/chat-variable-panel/components/array-value-list.tsx
+++ b/web/app/components/workflow/panel/chat-variable-panel/components/array-value-list.tsx
@@ -17,7 +17,7 @@ type Props = Readonly<{
}>
const ArrayValueList: FC<Props> = ({ isString = true, list, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const handleValueChange = useCallback(
(index: number) => {
diff --git a/web/app/components/workflow/panel/chat-variable-panel/components/object-value-item.tsx b/web/app/components/workflow/panel/chat-variable-panel/components/object-value-item.tsx
index ea6478c3b1a..0d20582a259 100644
--- a/web/app/components/workflow/panel/chat-variable-panel/components/object-value-item.tsx
+++ b/web/app/components/workflow/panel/chat-variable-panel/components/object-value-item.tsx
@@ -24,7 +24,7 @@ export const DEFAULT_OBJECT_VALUE = {
}
const ObjectValueItem: FC<Props> = ({ index, list, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const [isFocus, setIsFocus] = useState(false)
const handleKeyChange = useCallback(
diff --git a/web/app/components/workflow/panel/chat-variable-panel/components/object-value-list.tsx b/web/app/components/workflow/panel/chat-variable-panel/components/object-value-list.tsx
index 982023c7f28..dacaf3fa247 100644
--- a/web/app/components/workflow/panel/chat-variable-panel/components/object-value-list.tsx
+++ b/web/app/components/workflow/panel/chat-variable-panel/components/object-value-list.tsx
@@ -10,7 +10,7 @@ type Props = Readonly<{
}>
const ObjectValueList: FC<Props> = ({ list, onChange }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="w-full overflow-hidden rounded-lg border border-gray-200">
diff --git a/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal-trigger.tsx b/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal-trigger.tsx
index 09a54a022f8..193f9e6b6bc 100644
--- a/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal-trigger.tsx
+++ b/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal-trigger.tsx
@@ -17,7 +17,7 @@ type Props = Readonly<{
}>
const VariableModalTrigger = ({ open, setOpen, showTip, chatVar, onClose, onSave }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const handleOpenChange = React.useCallback(
(nextOpen: boolean) => {
setOpen(nextOpen)
diff --git a/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx b/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx
index f858105a892..ab5cf3e0b96 100644
--- a/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx
+++ b/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx
@@ -30,7 +30,7 @@ type ModalPropsType = {
}
const ChatVariableModal = ({ chatVar, onClose, onSave }: ModalPropsType) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'workflow'])
const translateChatVariable: ChatVariableTranslator = (selector, options) => t(selector, options)
const workflowStore = useWorkflowStore()
const notify = React.useCallback(({ children, message, type = 'info' }: ToastPayload) => {
diff --git a/web/app/components/workflow/panel/chat-variable-panel/index.tsx b/web/app/components/workflow/panel/chat-variable-panel/index.tsx
index d212a32c784..aac7cd50114 100644
--- a/web/app/components/workflow/panel/chat-variable-panel/index.tsx
+++ b/web/app/components/workflow/panel/chat-variable-panel/index.tsx
@@ -20,7 +20,7 @@ import { useCollaborativeWorkflow } from '../../hooks/use-collaborative-workflow
import useInspectVarsCrud from '../../hooks/use-inspect-vars-crud'
const ChatVariablePanel = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const setShowChatVariablePanel = useStore((s) => s.setShowChatVariablePanel)
const varList = useStore((s) => s.conversationVariables) as ConversationVariable[]
const updateChatVarList = useStore((s) => s.setConversationVariables)
diff --git a/web/app/components/workflow/panel/comments-panel/index.tsx b/web/app/components/workflow/panel/comments-panel/index.tsx
index c11c607395b..d317f605318 100644
--- a/web/app/components/workflow/panel/comments-panel/index.tsx
+++ b/web/app/components/workflow/panel/comments-panel/index.tsx
@@ -20,7 +20,7 @@ import { useFormatTimeFromNow } from '@/hooks/use-format-time-from-now'
import { useWorkflowComment } from '../../hooks/use-workflow-comment'
const CommentsPanel = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const activeCommentId = useStore((s) => s.activeCommentId)
const setActiveCommentId = useStore((s) => s.setActiveCommentId)
const setControlMode = useStore((s) => s.setControlMode)
diff --git a/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx b/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx
index e9738fc861c..fcaa5fed412 100644
--- a/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx
+++ b/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx
@@ -23,7 +23,7 @@ type Props = Readonly<{
}>
const ConversationVariableModal = ({ conversationID, onHide }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'common', 'workflow'])
const { formatTime } = useTimestamp()
const varList = useStore((s) => s.conversationVariables) as ConversationVariable[]
const appID = useStore((s) => s.appId)
diff --git a/web/app/components/workflow/panel/debug-and-preview/empty.tsx b/web/app/components/workflow/panel/debug-and-preview/empty.tsx
index 76ab1d2c38d..ea30f552948 100644
--- a/web/app/components/workflow/panel/debug-and-preview/empty.tsx
+++ b/web/app/components/workflow/panel/debug-and-preview/empty.tsx
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next'
const Empty = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="absolute top-1/2 left-1/2 -translate-1/2">
diff --git a/web/app/components/workflow/panel/debug-and-preview/hooks.ts b/web/app/components/workflow/panel/debug-and-preview/hooks.ts
index ee6b1ccdc84..8949b2f56ed 100644
--- a/web/app/components/workflow/panel/debug-and-preview/hooks.ts
+++ b/web/app/components/workflow/panel/debug-and-preview/hooks.ts
@@ -45,7 +45,7 @@ export const useChat = (
prevChatTree?: ChatItemInTree[],
stopChat?: (taskId: string) => void,
) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug'])
const { handleRun } = useWorkflowRun()
const hasStopRespondedRef = useRef(false)
const workflowStore = useWorkflowStore()
diff --git a/web/app/components/workflow/panel/debug-and-preview/index.tsx b/web/app/components/workflow/panel/debug-and-preview/index.tsx
index 3f861b794e7..aed156b71ba 100644
--- a/web/app/components/workflow/panel/debug-and-preview/index.tsx
+++ b/web/app/components/workflow/panel/debug-and-preview/index.tsx
@@ -22,7 +22,7 @@ export type ChatWrapperRefType = {
handleRestart: () => void
}
const DebugAndPreview = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const panelId = useId()
const chatRef = useRef({ handleRestart: noop })
const { handleCancelDebugAndPreviewPanel } = useWorkflowInteractions()
diff --git a/web/app/components/workflow/panel/env-panel/env-item.tsx b/web/app/components/workflow/panel/env-panel/env-item.tsx
index 1e93501324f..c2b3b7c14e0 100644
--- a/web/app/components/workflow/panel/env-panel/env-item.tsx
+++ b/web/app/components/workflow/panel/env-panel/env-item.tsx
@@ -13,7 +13,7 @@ type EnvItemProps = {
}
const EnvItem = ({ env, onEdit, onDelete }: EnvItemProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const envSecrets = useStore((s) => s.envSecrets)
const [destructive, setDestructive] = useState(false)
const typeLabel =
diff --git a/web/app/components/workflow/panel/env-panel/index.tsx b/web/app/components/workflow/panel/env-panel/index.tsx
index cee45bdfbf6..dc96245a305 100644
--- a/web/app/components/workflow/panel/env-panel/index.tsx
+++ b/web/app/components/workflow/panel/env-panel/index.tsx
@@ -413,7 +413,7 @@ const useEnvPanelActions = ({
}
const EnvPanel = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const collaborativeWorkflow = useCollaborativeWorkflow()
const workflowStore = useWorkflowStore()
const setShowEnvPanel = useStore((s) => s.setShowEnvPanel)
diff --git a/web/app/components/workflow/panel/env-panel/variable-modal.tsx b/web/app/components/workflow/panel/env-panel/variable-modal.tsx
index b02c89dd097..1b67f7b7e33 100644
--- a/web/app/components/workflow/panel/env-panel/variable-modal.tsx
+++ b/web/app/components/workflow/panel/env-panel/variable-modal.tsx
@@ -26,7 +26,7 @@ type ModalPropsType = {
const VariableModal = ({ env, onClose, onSave }: ModalPropsType) => {
const secretLabelId = React.useId()
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'workflow'])
const workflowStore = useWorkflowStore()
const [type, setType] = React.useState<EnvironmentVariable['value_type']>('string')
const [name, setName] = React.useState('')
diff --git a/web/app/components/workflow/panel/env-panel/variable-trigger.tsx b/web/app/components/workflow/panel/env-panel/variable-trigger.tsx
index bc3770c672e..f55d40d6f9d 100644
--- a/web/app/components/workflow/panel/env-panel/variable-trigger.tsx
+++ b/web/app/components/workflow/panel/env-panel/variable-trigger.tsx
@@ -16,7 +16,7 @@ type Props = Readonly<{
}>
const VariableTrigger = ({ open, setOpen, env, onClose, onSave }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const handleOpenChange = React.useCallback(
(nextOpen: boolean) => {
setOpen(nextOpen)
diff --git a/web/app/components/workflow/panel/global-variable-panel/index.tsx b/web/app/components/workflow/panel/global-variable-panel/index.tsx
index 57e48dcaac6..3ca86195da0 100644
--- a/web/app/components/workflow/panel/global-variable-panel/index.tsx
+++ b/web/app/components/workflow/panel/global-variable-panel/index.tsx
@@ -9,7 +9,7 @@ import { useIsChatMode } from '../../hooks/use-workflow'
import Item from './item'
const Panel = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const isChatMode = useIsChatMode()
const setShowPanel = useStore((s) => s.setShowGlobalVariablePanel)
const isWorkflowPage = isInWorkflowPage()
diff --git a/web/app/components/workflow/panel/inputs-panel.tsx b/web/app/components/workflow/panel/inputs-panel.tsx
index f023f1125b4..4f75625430d 100644
--- a/web/app/components/workflow/panel/inputs-panel.tsx
+++ b/web/app/components/workflow/panel/inputs-panel.tsx
@@ -17,7 +17,7 @@ type Props = Readonly<{
}>
const InputsPanel = ({ onRun }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const workflowStore = useWorkflowStore()
const inputs = useStore((s) => s.inputs)
const fileSettings = useHooksStore((s) => s.configsMap?.fileSettings)
diff --git a/web/app/components/workflow/panel/version-history-panel/action-menu/index.tsx b/web/app/components/workflow/panel/version-history-panel/action-menu/index.tsx
index d1eae933471..bdce50c0214 100644
--- a/web/app/components/workflow/panel/version-history-panel/action-menu/index.tsx
+++ b/web/app/components/workflow/panel/version-history-panel/action-menu/index.tsx
@@ -25,7 +25,7 @@ export type ActionMenuProps = {
const ActionMenu: FC<ActionMenuProps> = (props: ActionMenuProps) => {
const { isShowDelete, handleClickActionMenuItem, open, setOpen } = props
const { deleteOperation, options } = useActionMenu(props)
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<DropdownMenu open={open} onOpenChange={setOpen}>
diff --git a/web/app/components/workflow/panel/version-history-panel/action-menu/use-action-menu.ts b/web/app/components/workflow/panel/version-history-panel/action-menu/use-action-menu.ts
index a6d4592408a..84dd272a08d 100644
--- a/web/app/components/workflow/panel/version-history-panel/action-menu/use-action-menu.ts
+++ b/web/app/components/workflow/panel/version-history-panel/action-menu/use-action-menu.ts
@@ -10,7 +10,7 @@ import { VersionHistoryContextMenuOptions } from '../../../types'
const useActionMenu = (props: ActionMenuProps) => {
const { workflowId, isNamedVersion, canImportExportDSL } = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'common', 'workflow'])
const pipelineId = useStore((s) => s.pipelineId)
const deploymentEdition = useAtomValue(deploymentEditionAtom)
const { data: plan } = useQuery(
diff --git a/web/app/components/workflow/panel/version-history-panel/delete-confirm-modal.tsx b/web/app/components/workflow/panel/version-history-panel/delete-confirm-modal.tsx
index 3f460361d8a..c7b749bc5a1 100644
--- a/web/app/components/workflow/panel/version-history-panel/delete-confirm-modal.tsx
+++ b/web/app/components/workflow/panel/version-history-panel/delete-confirm-modal.tsx
@@ -26,7 +26,7 @@ const DeleteConfirmModal: FC<DeleteConfirmModalProps> = ({
onClose,
onDelete,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
return (
<AlertDialog
diff --git a/web/app/components/workflow/panel/version-history-panel/empty.tsx b/web/app/components/workflow/panel/version-history-panel/empty.tsx
index fbbf841cdb0..ea2ac351b7f 100644
--- a/web/app/components/workflow/panel/version-history-panel/empty.tsx
+++ b/web/app/components/workflow/panel/version-history-panel/empty.tsx
@@ -9,7 +9,7 @@ type EmptyProps = {
}
const Empty: FC<EmptyProps> = ({ onResetFilter }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="flex h-5/6 w-full flex-col justify-center gap-y-2">
diff --git a/web/app/components/workflow/panel/version-history-panel/filter/filter-switch.tsx b/web/app/components/workflow/panel/version-history-panel/filter/filter-switch.tsx
index a0e7cf826d2..32b67418f71 100644
--- a/web/app/components/workflow/panel/version-history-panel/filter/filter-switch.tsx
+++ b/web/app/components/workflow/panel/version-history-panel/filter/filter-switch.tsx
@@ -9,7 +9,7 @@ type FilterSwitchProps = {
}
const FilterSwitch: FC<FilterSwitchProps> = ({ enabled, handleSwitch }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="flex items-center p-1">
diff --git a/web/app/components/workflow/panel/version-history-panel/filter/use-filter.ts b/web/app/components/workflow/panel/version-history-panel/filter/use-filter.ts
index 1017111bb46..4b88e32b55e 100644
--- a/web/app/components/workflow/panel/version-history-panel/filter/use-filter.ts
+++ b/web/app/components/workflow/panel/version-history-panel/filter/use-filter.ts
@@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next'
import { WorkflowVersionFilterOptions } from '../../../types'
export const useFilterOptions = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return [
{
diff --git a/web/app/components/workflow/panel/version-history-panel/index.tsx b/web/app/components/workflow/panel/version-history-panel/index.tsx
index a31ee13360c..fb7dc0644d0 100644
--- a/web/app/components/workflow/panel/version-history-panel/index.tsx
+++ b/web/app/components/workflow/panel/version-history-panel/index.tsx
@@ -96,7 +96,7 @@ export const VersionHistoryPanel = ({
const invalidAllLastRun = useInvalidAllLastRun(configsMap?.flowType, configsMap?.flowId)
const invalidateAppWorkflow = useInvalidateAppWorkflow()
const { deleteAllInspectVars } = workflowStore.getState()
- const { t } = useTranslation()
+ const { t } = useTranslation(['billing', 'common', 'workflow'])
const {
data: versionHistory,
diff --git a/web/app/components/workflow/panel/version-history-panel/restore-confirm-modal.tsx b/web/app/components/workflow/panel/version-history-panel/restore-confirm-modal.tsx
index 47fdb082a49..3c85ced33cc 100644
--- a/web/app/components/workflow/panel/version-history-panel/restore-confirm-modal.tsx
+++ b/web/app/components/workflow/panel/version-history-panel/restore-confirm-modal.tsx
@@ -26,7 +26,7 @@ const RestoreConfirmModal: FC<RestoreConfirmModalProps> = ({
onClose,
onRestore,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
return (
<AlertDialog
diff --git a/web/app/components/workflow/panel/version-history-panel/version-history-item.tsx b/web/app/components/workflow/panel/version-history-panel/version-history-item.tsx
index 802b544c73a..cbeb01f458b 100644
--- a/web/app/components/workflow/panel/version-history-panel/version-history-item.tsx
+++ b/web/app/components/workflow/panel/version-history-panel/version-history-item.tsx
@@ -46,7 +46,7 @@ const VersionHistoryItem: React.FC<VersionHistoryItemProps> = ({
isLast,
hideActionMenu,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const formatTime = (time: number) => dayjs.unix(time).format('YYYY-MM-DD HH:mm')
diff --git a/web/app/components/workflow/panel/workflow-preview.tsx b/web/app/components/workflow/panel/workflow-preview.tsx
index 538a9ec51f5..6dd8720fabb 100644
--- a/web/app/components/workflow/panel/workflow-preview.tsx
+++ b/web/app/components/workflow/panel/workflow-preview.tsx
@@ -23,7 +23,7 @@ import InputsPanel from './inputs-panel'
import { getPreviewPanelMaxWidth } from './panel-width'
const WorkflowPreview = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'runLog', 'workflow'])
const panelId = useId()
const { handleCancelDebugAndPreviewPanel } = useWorkflowInteractions()
const workflowRunningData = useStore((s) => s.workflowRunningData)
diff --git a/web/app/components/workflow/run/agent-log/agent-log-nav-more.tsx b/web/app/components/workflow/run/agent-log/agent-log-nav-more.tsx
index 864048b6af3..2748e05a9eb 100644
--- a/web/app/components/workflow/run/agent-log/agent-log-nav-more.tsx
+++ b/web/app/components/workflow/run/agent-log/agent-log-nav-more.tsx
@@ -13,7 +13,7 @@ type AgentLogNavMoreProps = {
onShowAgentOrToolLog: (detail?: AgentLogItemWithChildren) => void
}
const AgentLogNavMore = ({ options, onShowAgentOrToolLog }: AgentLogNavMoreProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<DropdownMenu>
diff --git a/web/app/components/workflow/run/agent-log/agent-log-nav.tsx b/web/app/components/workflow/run/agent-log/agent-log-nav.tsx
index b86f3561dc3..1c8356d8a29 100644
--- a/web/app/components/workflow/run/agent-log/agent-log-nav.tsx
+++ b/web/app/components/workflow/run/agent-log/agent-log-nav.tsx
@@ -15,7 +15,7 @@ type AgentLogNavProps = {
onShowAgentOrToolLog: (detail?: AgentLogItemWithChildren) => void
}
export function AgentLogNav({ agentOrToolLogItemStack, onShowAgentOrToolLog }: AgentLogNavProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const agentOrToolLogItemStackLength = agentOrToolLogItemStack.length
const first = agentOrToolLogItemStack[0]
const mid = agentOrToolLogItemStack.slice(1, -1)
diff --git a/web/app/components/workflow/run/agent-log/agent-log-trigger.tsx b/web/app/components/workflow/run/agent-log/agent-log-trigger.tsx
index c04517c4b80..5e871431910 100644
--- a/web/app/components/workflow/run/agent-log/agent-log-trigger.tsx
+++ b/web/app/components/workflow/run/agent-log/agent-log-trigger.tsx
@@ -6,7 +6,7 @@ type AgentLogTriggerProps = {
onShowAgentOrToolLog: (detail?: AgentLogItemWithChildren) => void
}
export function AgentLogTrigger({ nodeInfo, onShowAgentOrToolLog }: AgentLogTriggerProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['runLog', 'workflow'])
const { agentLog, execution_metadata } = nodeInfo
const agentStrategy = execution_metadata?.tool_info?.agent_strategy
diff --git a/web/app/components/workflow/run/agent-log/agent-result-panel.tsx b/web/app/components/workflow/run/agent-log/agent-result-panel.tsx
index f89462f5ba8..d490a042a99 100644
--- a/web/app/components/workflow/run/agent-log/agent-result-panel.tsx
+++ b/web/app/components/workflow/run/agent-log/agent-result-panel.tsx
@@ -13,7 +13,7 @@ const AgentResultPanel = ({
agentOrToolLogListMap,
onShowAgentOrToolLog,
}: AgentResultPanelProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['runLog'])
const top = agentOrToolLogItemStack[agentOrToolLogItemStack.length - 1]
const list = agentOrToolLogListMap[top!.message_id]
diff --git a/web/app/components/workflow/run/index.tsx b/web/app/components/workflow/run/index.tsx
index c2593ee6af7..c1447366c26 100644
--- a/web/app/components/workflow/run/index.tsx
+++ b/web/app/components/workflow/run/index.tsx
@@ -30,7 +30,7 @@ const RunPanel: FC<RunProps> = ({
runDetailUrl,
tracingListUrl,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['runLog'])
const [currentTab, setCurrentTab] = useState<string>(activeTab)
const [loading, setLoading] = useState<boolean>(true)
const [runDetail, setRunDetail] = useState<WorkflowRunDetailResponse>()
diff --git a/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx b/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx
index 69e37900027..4a659b75e24 100644
--- a/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx
+++ b/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx
@@ -61,7 +61,7 @@ const IterationLogTrigger = ({
allExecutions,
onShowIterationResultList,
}: IterationLogTriggerProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const getNodesForInstance = (key: string): NodeTracing[] => {
if (!allExecutions) return []
diff --git a/web/app/components/workflow/run/iteration-log/iteration-result-panel.tsx b/web/app/components/workflow/run/iteration-log/iteration-result-panel.tsx
index 39078e58773..7a437d6982f 100644
--- a/web/app/components/workflow/run/iteration-log/iteration-result-panel.tsx
+++ b/web/app/components/workflow/run/iteration-log/iteration-result-panel.tsx
@@ -23,7 +23,7 @@ type Props = {
}
const IterationResultPanel: FC<Props> = ({ list, onBack, iterDurationMap }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [expandedIterations, setExpandedIterations] = useState<Record<number, boolean>>({})
const toggleIteration = useCallback((index: number) => {
diff --git a/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx b/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx
index f59912e21f2..07c6e4ce186 100644
--- a/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx
+++ b/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx
@@ -13,7 +13,7 @@ type LoopLogTriggerProps = {
) => void
}
const LoopLogTrigger = ({ nodeInfo, allExecutions, onShowLoopResultList }: LoopLogTriggerProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const filterNodesForInstance = (key: string): NodeTracing[] => {
if (!allExecutions) return []
diff --git a/web/app/components/workflow/run/loop-log/loop-result-panel.tsx b/web/app/components/workflow/run/loop-log/loop-result-panel.tsx
index 69db647aac1..fb05b7141a5 100644
--- a/web/app/components/workflow/run/loop-log/loop-result-panel.tsx
+++ b/web/app/components/workflow/run/loop-log/loop-result-panel.tsx
@@ -37,7 +37,7 @@ type Props = {
}
const LoopResultPanel: FC<Props> = ({ list, onBack, loopDurationMap, loopVariableMap }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [expandedLoops, setExpandedLoops] = useState<Record<number, boolean>>({})
const toggleLoop = useCallback((index: number) => {
diff --git a/web/app/components/workflow/run/meta.tsx b/web/app/components/workflow/run/meta.tsx
index ce7f45368a1..cb18642de8a 100644
--- a/web/app/components/workflow/run/meta.tsx
+++ b/web/app/components/workflow/run/meta.tsx
@@ -22,7 +22,7 @@ const MetaData: FC<Props> = ({
steps = 1,
showSteps = true,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appLog', 'runLog'])
const { formatTime } = useTimestamp()
return (
diff --git a/web/app/components/workflow/run/node.tsx b/web/app/components/workflow/run/node.tsx
index 52f65ec2a81..14f47e46dee 100644
--- a/web/app/components/workflow/run/node.tsx
+++ b/web/app/components/workflow/run/node.tsx
@@ -77,7 +77,7 @@ const NodePanel: FC<Props> = ({
},
[hideProcessDetail],
)
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const docLink = useDocLink()
const detailsId = useId()
const Header = hideProcessDetail ? 'div' : 'button'
diff --git a/web/app/components/workflow/run/result-panel.tsx b/web/app/components/workflow/run/result-panel.tsx
index 72c6d722462..6c1830c40c0 100644
--- a/web/app/components/workflow/run/result-panel.tsx
+++ b/web/app/components/workflow/run/result-panel.tsx
@@ -73,7 +73,7 @@ const ResultPanel: FC<ResultPanelProps> = ({
onShowRetryDetail,
handleShowAgentOrToolLog,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const isIterationNode = nodeInfo?.node_type === BlockEnum.Iteration && !!nodeInfo?.details?.length
const isLoopNode = nodeInfo?.node_type === BlockEnum.Loop && !!nodeInfo?.details?.length
const isRetryNode = hasRetryNode(nodeInfo?.node_type) && !!nodeInfo?.retryDetail?.length
diff --git a/web/app/components/workflow/run/result-text.tsx b/web/app/components/workflow/run/result-text.tsx
index 09fbf541ddc..3f2b3e47fe1 100644
--- a/web/app/components/workflow/run/result-text.tsx
+++ b/web/app/components/workflow/run/result-text.tsx
@@ -24,7 +24,7 @@ const ResultText: FC<ResultTextProps> = ({
onClick,
allFiles,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['runLog'])
return (
<div className="bg-background-section-burn">
{isRunning && !outputs && (
diff --git a/web/app/components/workflow/run/retry-log/retry-log-trigger.tsx b/web/app/components/workflow/run/retry-log/retry-log-trigger.tsx
index 0c150cfb76a..d4cf9aa560c 100644
--- a/web/app/components/workflow/run/retry-log/retry-log-trigger.tsx
+++ b/web/app/components/workflow/run/retry-log/retry-log-trigger.tsx
@@ -8,7 +8,7 @@ type RetryLogTriggerProps = {
onShowRetryResultList: (detail: NodeTracing[]) => void
}
const RetryLogTrigger = ({ nodeInfo, onShowRetryResultList }: RetryLogTriggerProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { retryDetail } = nodeInfo
const handleShowRetryResultList = (e: React.MouseEvent<HTMLButtonElement>) => {
diff --git a/web/app/components/workflow/run/retry-log/retry-result-panel.tsx b/web/app/components/workflow/run/retry-log/retry-result-panel.tsx
index 41748df1846..e91e2034d81 100644
--- a/web/app/components/workflow/run/retry-log/retry-result-panel.tsx
+++ b/web/app/components/workflow/run/retry-log/retry-result-panel.tsx
@@ -11,7 +11,7 @@ type Props = {
}
function RetryResultPanel({ list, onBack }: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div>
diff --git a/web/app/components/workflow/run/status.tsx b/web/app/components/workflow/run/status.tsx
index d7ac3c45767..57f9bfd476b 100644
--- a/web/app/components/workflow/run/status.tsx
+++ b/web/app/components/workflow/run/status.tsx
@@ -29,7 +29,7 @@ const StatusPanel: FC<ResultProps> = ({
workflowRunId,
onOpenTracingTab,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['runLog', 'workflow'])
const docLink = useDocLink()
const { data: pausedDetails } = useWorkflowPausedDetails({
workflowRunId: workflowRunId || '',
diff --git a/web/app/components/workflow/run/tracing-panel.tsx b/web/app/components/workflow/run/tracing-panel.tsx
index 5c28554bd5e..f4bc98f0e5f 100644
--- a/web/app/components/workflow/run/tracing-panel.tsx
+++ b/web/app/components/workflow/run/tracing-panel.tsx
@@ -24,7 +24,7 @@ const TracingPanel: FC<TracingPanelProps> = ({
hideNodeInfo = false,
hideNodeProcessDetail = false,
}) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const treeNodes = formatNodeList(list, t)
const [collapsedNodes, setCollapsedNodes] = useState<Set<string>>(() => new Set())
const [hoveredParallel, setHoveredParallel] = useState<string | null>(null)
diff --git a/web/app/components/workflow/run/utils/format-log/parallel/index.ts b/web/app/components/workflow/run/utils/format-log/parallel/index.ts
index 0ed7b8ceeff..54c301b6abb 100644
--- a/web/app/components/workflow/run/utils/format-log/parallel/index.ts
+++ b/web/app/components/workflow/run/utils/format-log/parallel/index.ts
@@ -5,7 +5,7 @@ import { BlockEnum } from '@/app/components/workflow/types'
export type WorkflowTranslate = <const Selector extends SelectorParam<'workflow'>>(
selector: Selector,
options: { ns: 'workflow' },
-) => ReturnType<TFunction>
+) => ReturnType<TFunction<['workflow']>>
const translateWorkflowString = <const Selector extends SelectorParam<'workflow'>>(
t: WorkflowTranslate,
diff --git a/web/app/components/workflow/selection-contextmenu.tsx b/web/app/components/workflow/selection-contextmenu.tsx
index 5b9085cb31d..db38adee60f 100644
--- a/web/app/components/workflow/selection-contextmenu.tsx
+++ b/web/app/components/workflow/selection-contextmenu.tsx
@@ -245,7 +245,7 @@ const distributeNodes = (nodesToAlign: Node[], nodes: Node[], alignType: AlignTy
}
export function SelectionContextmenu({ onClose }: { onClose: () => void }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const { getNodesReadOnly } = useNodesReadOnly()
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
const { handleNodesCopy, handleNodesDelete, handleNodesDuplicate } = useNodesInteractions()
diff --git a/web/app/components/workflow/update-dsl-modal.helpers.ts b/web/app/components/workflow/update-dsl-modal.helpers.ts
index 0aaab0a260c..b3b12ed328c 100644
--- a/web/app/components/workflow/update-dsl-modal.helpers.ts
+++ b/web/app/components/workflow/update-dsl-modal.helpers.ts
@@ -75,7 +75,7 @@ export const isImportCompleted = (status: Import['status']) => {
export const getImportNotificationPayload = (
status: Import['status'],
- t: TFunction,
+ t: TFunction<['workflow']>,
): ImportNotificationPayload => {
return {
type: status === DSLImportStatus.COMPLETED ? 'success' : 'warning',
diff --git a/web/app/components/workflow/update-dsl-modal.tsx b/web/app/components/workflow/update-dsl-modal.tsx
index c6009125fa5..bd0101c6e73 100644
--- a/web/app/components/workflow/update-dsl-modal.tsx
+++ b/web/app/components/workflow/update-dsl-modal.tsx
@@ -33,7 +33,7 @@ type UpdateDSLModalProps = {
}
const UpdateDSLModal = ({ onCancel, onBackup, onImport }: UpdateDSLModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow', 'app', 'common'])
const appDetail = useAppStore((s) => s.appDetail)
const [currentFile, setDSLFile] = useState<File>()
const [fileContent, setFileContent] = useState<string>()
diff --git a/web/app/components/workflow/variable-inspect/display-content.tsx b/web/app/components/workflow/variable-inspect/display-content.tsx
index a95da3630af..245a6a7a03a 100644
--- a/web/app/components/workflow/variable-inspect/display-content.tsx
+++ b/web/app/components/workflow/variable-inspect/display-content.tsx
@@ -38,7 +38,7 @@ export function DisplayContent(props: DisplayContentProps) {
} = props
const [selectedViewMode, setSelectedViewMode] = useState<ViewMode>(ViewMode.Code)
const [isFocused, setIsFocused] = useState(false)
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const viewOptions = [
{
value: ViewMode.Code,
diff --git a/web/app/components/workflow/variable-inspect/empty.tsx b/web/app/components/workflow/variable-inspect/empty.tsx
index 413ad87aa1b..ba99eeba0f5 100644
--- a/web/app/components/workflow/variable-inspect/empty.tsx
+++ b/web/app/components/workflow/variable-inspect/empty.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
import { useDocLink } from '@/context/i18n'
const Empty: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const docLink = useDocLink()
return (
diff --git a/web/app/components/workflow/variable-inspect/group.tsx b/web/app/components/workflow/variable-inspect/group.tsx
index 3b9f0f1a5c4..d4aa1016e16 100644
--- a/web/app/components/workflow/variable-inspect/group.tsx
+++ b/web/app/components/workflow/variable-inspect/group.tsx
@@ -37,7 +37,7 @@ const Group = ({
handleView,
handleClear,
}: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const [isCollapsed, setIsCollapsed] = useState(false)
const toolIcon = useToolIcon(nodeData?.nodePayload)
diff --git a/web/app/components/workflow/variable-inspect/index.tsx b/web/app/components/workflow/variable-inspect/index.tsx
index 775184f560d..50c04343353 100644
--- a/web/app/components/workflow/variable-inspect/index.tsx
+++ b/web/app/components/workflow/variable-inspect/index.tsx
@@ -10,7 +10,7 @@ import { useStore } from '../store'
import Panel from './panel'
const VariableInspectPanel: FC = () => {
- const { t } = useTranslation('workflow')
+ const { t } = useTranslation(['workflow'])
const panelId = useId()
const showVariableInspectPanel = useStore((s) => s.showVariableInspectPanel)
const workflowCanvasHeight = useStore((s) => s.workflowCanvasHeight)
diff --git a/web/app/components/workflow/variable-inspect/large-data-alert.tsx b/web/app/components/workflow/variable-inspect/large-data-alert.tsx
index 134aadc9366..972e9e369ba 100644
--- a/web/app/components/workflow/variable-inspect/large-data-alert.tsx
+++ b/web/app/components/workflow/variable-inspect/large-data-alert.tsx
@@ -12,7 +12,7 @@ type Props = Readonly<{
}>
const LargeDataAlert: FC<Props> = ({ textHasNoExport, downloadUrl, className }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const text = textHasNoExport
? t(($) => $['debug.variableInspect.largeDataNoExport'], { ns: 'workflow' })
: t(($) => $['debug.variableInspect.largeData'], { ns: 'workflow' })
diff --git a/web/app/components/workflow/variable-inspect/left.tsx b/web/app/components/workflow/variable-inspect/left.tsx
index 4b7b6966522..bc4296e2f4f 100644
--- a/web/app/components/workflow/variable-inspect/left.tsx
+++ b/web/app/components/workflow/variable-inspect/left.tsx
@@ -16,7 +16,7 @@ type Props = Readonly<{
}>
const Left = ({ currentNodeVar, handleVarSelect }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const environmentVariables = useStore((s) => s.environmentVariables)
const setCurrentFocusNodeId = useStore((s) => s.setCurrentFocusNodeId)
diff --git a/web/app/components/workflow/variable-inspect/listening.tsx b/web/app/components/workflow/variable-inspect/listening.tsx
index 857b3edcb56..3d5c310e987 100644
--- a/web/app/components/workflow/variable-inspect/listening.tsx
+++ b/web/app/components/workflow/variable-inspect/listening.tsx
@@ -19,7 +19,7 @@ const resolveListeningDescription = (
message: string | undefined,
triggerNode: Node | undefined,
triggerType: BlockEnum,
- t: TFunction,
+ t: TFunction<['workflow']>,
): string => {
if (message) return message
@@ -55,7 +55,7 @@ const resolveListeningDescription = (
return t(($) => $['debug.variableInspect.listening.tipFallback'], { ns: 'workflow' })
}
-const resolveMultipleListeningDescription = (nodes: Node[], t: TFunction): string => {
+const resolveMultipleListeningDescription = (nodes: Node[], t: TFunction<['workflow']>): string => {
if (!nodes.length)
return t(($) => $['debug.variableInspect.listening.tipFallback'], { ns: 'workflow' })
@@ -78,7 +78,7 @@ type ListeningProps = {
}
const Listening: FC<ListeningProps> = ({ onStop, message }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const store = useStoreApi()
// Get the current trigger type and node ID from store
diff --git a/web/app/components/workflow/variable-inspect/panel.tsx b/web/app/components/workflow/variable-inspect/panel.tsx
index 8f0c49175f5..0a5ae13d1e8 100644
--- a/web/app/components/workflow/variable-inspect/panel.tsx
+++ b/web/app/components/workflow/variable-inspect/panel.tsx
@@ -27,7 +27,7 @@ export type currentVarType = {
}
const Panel: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'workflow'])
const bottomPanelWidth = useStore((s) => s.bottomPanelWidth)
const setShowVariableInspectPanel = useStore((s) => s.setShowVariableInspectPanel)
diff --git a/web/app/components/workflow/variable-inspect/right.tsx b/web/app/components/workflow/variable-inspect/right.tsx
index 6d0fe07f38e..4612388c6b7 100644
--- a/web/app/components/workflow/variable-inspect/right.tsx
+++ b/web/app/components/workflow/variable-inspect/right.tsx
@@ -38,7 +38,7 @@ type Props = Readonly<{
}>
const Right = ({ nodeId, currentNodeVar, handleOpenMenu, isValueFetching }: Props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common', 'workflow'])
const bottomPanelWidth = useStore((s) => s.bottomPanelWidth)
const setShowVariableInspectPanel = useStore((s) => s.setShowVariableInspectPanel)
const setCurrentFocusNodeId = useStore((s) => s.setCurrentFocusNodeId)
diff --git a/web/app/components/workflow/variable-inspect/trigger.tsx b/web/app/components/workflow/variable-inspect/trigger.tsx
index 97bb19a63ae..8532d97f632 100644
--- a/web/app/components/workflow/variable-inspect/trigger.tsx
+++ b/web/app/components/workflow/variable-inspect/trigger.tsx
@@ -16,7 +16,7 @@ import { useNodesReadOnly } from '../hooks/use-workflow'
import { useStore } from '../store'
const VariableInspectTrigger: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { eventEmitter } = useEventEmitterContextContext()
const showVariableInspectPanel = useStore((s) => s.showVariableInspectPanel)
diff --git a/web/app/components/workflow/variable-inspect/value-content-sections.tsx b/web/app/components/workflow/variable-inspect/value-content-sections.tsx
index 89888fb74e5..73d280f8f09 100644
--- a/web/app/components/workflow/variable-inspect/value-content-sections.tsx
+++ b/web/app/components/workflow/variable-inspect/value-content-sections.tsx
@@ -31,7 +31,7 @@ export const TextEditorSection = ({
isTruncated,
onTextChange,
}: TextEditorSectionProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<>
diff --git a/web/app/components/workflow/workflow-generator/example-prompts.tsx b/web/app/components/workflow/workflow-generator/example-prompts.tsx
index 40af187cdd6..321b9891e61 100644
--- a/web/app/components/workflow/workflow-generator/example-prompts.tsx
+++ b/web/app/components/workflow/workflow-generator/example-prompts.tsx
@@ -31,7 +31,7 @@ const SKELETONS = [
* the row is never empty. Create-only — the parent hides it in refine mode.
*/
const ExamplePrompts = ({ mode, onSelect }: Props) => {
- const { t, i18n } = useTranslation('workflow')
+ const { t, i18n } = useTranslation(['workflow'])
// Curated fallback, shown until AI suggestions arrive and whenever generation
// is unavailable. The spread per mode covers a range of workflow shapes.
diff --git a/web/app/components/workflow/workflow-generator/generation-plan.tsx b/web/app/components/workflow/workflow-generator/generation-plan.tsx
index 29181310a00..a0b6b774002 100644
--- a/web/app/components/workflow/workflow-generator/generation-plan.tsx
+++ b/web/app/components/workflow/workflow-generator/generation-plan.tsx
@@ -23,7 +23,7 @@ const SKELETON_ROWS = ['s1', 's2', 's3', 's4'] as const
// about to arrive, using the shared Skeleton primitives. The pane fills in
// place instead of jerking from a centred spinner to a left-aligned list.
const PlanningSkeleton = memo(() => {
- const { t } = useTranslation('workflow')
+ const { t } = useTranslation(['workflow'])
return (
<div
aria-busy="true"
@@ -69,7 +69,7 @@ PlanningSkeleton.displayName = 'PlanningSkeleton'
* canvas — while the builder fills in the graph.
*/
const GenerationPlan = ({ plan }: Props) => {
- const { t } = useTranslation('workflow')
+ const { t } = useTranslation(['workflow'])
if (!plan) return <PlanningSkeleton />
diff --git a/web/app/components/workflow/workflow-generator/index.tsx b/web/app/components/workflow/workflow-generator/index.tsx
index 70a7ed20df0..4a41e8950b8 100644
--- a/web/app/components/workflow/workflow-generator/index.tsx
+++ b/web/app/components/workflow/workflow-generator/index.tsx
@@ -90,7 +90,7 @@ const workflowGeneratorErrorSelectors: Record<
UNRESOLVED_REFERENCE: ($) => $['workflowGenerator.errors.UNRESOLVED_REFERENCE'],
}
-function getWorkflowGeneratorErrorMessage(error: GenError, t: TFunction<'workflow'>) {
+function getWorkflowGeneratorErrorMessage(error: GenError, t: TFunction<['workflow']>) {
return t(workflowGeneratorErrorSelectors[error.code])
}
@@ -152,7 +152,7 @@ const RecoveryDialog = ({
)
function WorkflowGeneratorModal() {
- const { t } = useTranslation('workflow')
+ const { t } = useTranslation(['workflow', 'common'])
const router = useRouter()
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const isRbacEnabled = systemFeatures.rbac_enabled
diff --git a/web/app/components/workflow/workflow-preview/components/error-handle-on-node.tsx b/web/app/components/workflow/workflow-preview/components/error-handle-on-node.tsx
index e2ce0b3018f..660eeefbee1 100644
--- a/web/app/components/workflow/workflow-preview/components/error-handle-on-node.tsx
+++ b/web/app/components/workflow/workflow-preview/components/error-handle-on-node.tsx
@@ -9,7 +9,7 @@ import { NodeSourceHandle } from './node-handle'
type ErrorHandleOnNodeProps = Pick<Node, 'id' | 'data'>
const ErrorHandleOnNode = ({ id, data }: ErrorHandleOnNodeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { error_strategy } = data
const updateNodeInternals = useUpdateNodeInternals()
diff --git a/web/app/components/workflow/workflow-preview/components/nodes/agent-v2/node.tsx b/web/app/components/workflow/workflow-preview/components/nodes/agent-v2/node.tsx
index 3d9e1f7bea9..f094f0777e4 100644
--- a/web/app/components/workflow/workflow-preview/components/nodes/agent-v2/node.tsx
+++ b/web/app/components/workflow/workflow-preview/components/nodes/agent-v2/node.tsx
@@ -7,7 +7,7 @@ import { NodeSourceHandle } from '../../node-handle'
const Node = (props: NodeProps) => {
const { data } = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
if (!hasAgentV2OutputRoutes(data)) return null
diff --git a/web/app/components/workflow/workflow-preview/components/nodes/base.tsx b/web/app/components/workflow/workflow-preview/components/nodes/base.tsx
index bcd0820a04f..76337246779 100644
--- a/web/app/components/workflow/workflow-preview/components/nodes/base.tsx
+++ b/web/app/components/workflow/workflow-preview/components/nodes/base.tsx
@@ -19,7 +19,7 @@ type NodeCardProps = NodeProps & {
}
const BaseCard = ({ id, data, children }: NodeCardProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div
diff --git a/web/app/components/workflow/workflow-preview/components/nodes/if-else/node.tsx b/web/app/components/workflow/workflow-preview/components/nodes/if-else/node.tsx
index 80df2f958da..2fd8a17294f 100644
--- a/web/app/components/workflow/workflow-preview/components/nodes/if-else/node.tsx
+++ b/web/app/components/workflow/workflow-preview/components/nodes/if-else/node.tsx
@@ -13,7 +13,7 @@ const i18nPrefix = 'nodes.ifElse'
const IfElseNode: FC<NodeProps<IfElseNodeType>> = (props) => {
const { data } = props
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { cases } = data
const casesLength = cases.length
const checkIsConditionSet = useCallback((condition: Condition) => {
diff --git a/web/app/components/workflow/workflow-preview/components/nodes/iteration-start/index.tsx b/web/app/components/workflow/workflow-preview/components/nodes/iteration-start/index.tsx
index d0ff8314f32..132a202d024 100644
--- a/web/app/components/workflow/workflow-preview/components/nodes/iteration-start/index.tsx
+++ b/web/app/components/workflow/workflow-preview/components/nodes/iteration-start/index.tsx
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
import { NodeSourceHandle } from '../../node-handle'
const IterationStartNode = ({ id, data }: NodeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="nodrag group mt-1 flex size-11 items-center justify-center rounded-2xl border border-workflow-block-border bg-workflow-block-bg shadow-xs">
diff --git a/web/app/components/workflow/workflow-preview/components/nodes/loop-start/index.tsx b/web/app/components/workflow/workflow-preview/components/nodes/loop-start/index.tsx
index bf3cd5dfdbb..f981b5b0971 100644
--- a/web/app/components/workflow/workflow-preview/components/nodes/loop-start/index.tsx
+++ b/web/app/components/workflow/workflow-preview/components/nodes/loop-start/index.tsx
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
import { NodeSourceHandle } from '../../node-handle'
const LoopStartNode = ({ id, data }: NodeProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
return (
<div className="nodrag group mt-1 flex size-11 items-center justify-center rounded-2xl border border-workflow-block-border bg-workflow-block-bg">
diff --git a/web/app/components/workflow/workflow-preview/components/nodes/question-classifier/node.tsx b/web/app/components/workflow/workflow-preview/components/nodes/question-classifier/node.tsx
index 44917e737ff..ea923b3e0d1 100644
--- a/web/app/components/workflow/workflow-preview/components/nodes/question-classifier/node.tsx
+++ b/web/app/components/workflow/workflow-preview/components/nodes/question-classifier/node.tsx
@@ -8,7 +8,7 @@ import InfoPanel from '@/app/components/workflow/nodes/_base/components/info-pan
import { NodeSourceHandle } from '../../node-handle'
const Node: FC<NodeProps<QuestionClassifierNodeType>> = (props) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { data } = props
const topics = data.classes
diff --git a/web/app/components/workflow/workflow-preview/components/note-node/index.tsx b/web/app/components/workflow/workflow-preview/components/note-node/index.tsx
index 4e97ac51b98..3b65cf5d647 100644
--- a/web/app/components/workflow/workflow-preview/components/note-node/index.tsx
+++ b/web/app/components/workflow/workflow-preview/components/note-node/index.tsx
@@ -10,7 +10,7 @@ import {
} from '@/app/components/workflow/note-node/note-editor'
const NoteNode = ({ data }: NodeProps<NoteNodeType>) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const ref = useRef<HTMLDivElement | null>(null)
const theme = data.theme
diff --git a/web/app/components/workflow/workflow-preview/components/zoom-in-out.tsx b/web/app/components/workflow/workflow-preview/components/zoom-in-out.tsx
index c84a8c846d1..7ced2a9e435 100644
--- a/web/app/components/workflow/workflow-preview/components/zoom-in-out.tsx
+++ b/web/app/components/workflow/workflow-preview/components/zoom-in-out.tsx
@@ -27,7 +27,7 @@ const ZoomType = {
type ZoomType = (typeof ZoomType)[keyof typeof ZoomType]
const ZoomInOut: FC = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['workflow'])
const { zoomIn, zoomOut, zoomTo, fitView } = useReactFlow()
const { zoom } = useViewport()
diff --git a/web/app/device/components/authorize-account.tsx b/web/app/device/components/authorize-account.tsx
index a5001c8958b..d7a6c2cf0bd 100644
--- a/web/app/device/components/authorize-account.tsx
+++ b/web/app/device/components/authorize-account.tsx
@@ -35,7 +35,7 @@ const AuthorizeAccount: FC<Props> = ({
onDenied,
onError,
}) => {
- const { t } = useTranslation('deviceFlow')
+ const { t } = useTranslation(['deviceFlow', 'common'])
const [busy, setBusy] = useState(false)
const approve = async () => {
diff --git a/web/app/device/components/authorize-sso.tsx b/web/app/device/components/authorize-sso.tsx
index 897b21335c0..3e3cde706cb 100644
--- a/web/app/device/components/authorize-sso.tsx
+++ b/web/app/device/components/authorize-sso.tsx
@@ -26,7 +26,7 @@ type Props = {
* pre-SSO ?user_code=... query param.
*/
const AuthorizeSSO: FC<Props> = ({ onApproved, onError }) => {
- const { t } = useTranslation('deviceFlow')
+ const { t } = useTranslation(['deviceFlow'])
const [ctx, setCtx] = useState<ApprovalContext | null>(null)
const [busy, setBusy] = useState(false)
const [loadErr, setLoadErr] = useState<string | null>(null)
diff --git a/web/app/device/components/chooser.tsx b/web/app/device/components/chooser.tsx
index 11de05b2e95..5c1f76fe5d2 100644
--- a/web/app/device/components/chooser.tsx
+++ b/web/app/device/components/chooser.tsx
@@ -26,7 +26,7 @@ type Props = {
* generalises post-signin redirect to all methods.
*/
const Chooser: FC<Props> = ({ userCode, ssoAvailable }) => {
- const { t } = useTranslation('deviceFlow')
+ const { t } = useTranslation(['deviceFlow'])
const deviceReturnPath = `/device?user_code=${encodeURIComponent(userCode)}`
return (
diff --git a/web/app/device/components/code-input.tsx b/web/app/device/components/code-input.tsx
index 4f6d7776a60..b2395f3cbdf 100644
--- a/web/app/device/components/code-input.tsx
+++ b/web/app/device/components/code-input.tsx
@@ -20,7 +20,7 @@ type Props = {
* not need to run validation itself.
*/
const CodeInput: FC<Props> = ({ value, onChange, disabled, autoFocus }) => {
- const { t } = useTranslation('deviceFlow')
+ const { t } = useTranslation(['deviceFlow'])
const handle = useCallback(
(raw: string) => {
onChange(normaliseUserCodeInput(raw))
diff --git a/web/app/device/page.tsx b/web/app/device/page.tsx
index 251378662fd..15e7d25454d 100644
--- a/web/app/device/page.tsx
+++ b/web/app/device/page.tsx
@@ -32,7 +32,7 @@ type View =
| { kind: 'error_sso'; code: string; userCode: string }
export default function DevicePage() {
- const { t } = useTranslation('deviceFlow')
+ const { t } = useTranslation(['deviceFlow'])
const searchParams = useSearchParams()
const router = useRouter()
const pathname = usePathname()
diff --git a/web/app/device/utils/error-copy.ts b/web/app/device/utils/error-copy.ts
index cc0c337c342..fe6a8e620a0 100644
--- a/web/app/device/utils/error-copy.ts
+++ b/web/app/device/utils/error-copy.ts
@@ -27,7 +27,7 @@ const APPROVE_KEY: Record<string, DeviceFlowKey> = {
server_error: 'approveError.serverError',
}
-export function approveErrorCopy(err: unknown, t: TFunction<'deviceFlow'>): string {
+export function approveErrorCopy(err: unknown, t: TFunction<['deviceFlow']>): string {
if (err instanceof DeviceFlowError)
return t(($) => $[APPROVE_KEY[err.code] ?? 'approveError.default'])
return t(($) => $['approveError.default'])
@@ -39,7 +39,7 @@ const SSO_ERROR_KEY: Record<string, DeviceFlowKey> = {
email_belongs_to_dify_account: 'ssoError.emailBelongsToDifyAccount',
}
-export function ssoErrorCopy(code: string, t: TFunction<'deviceFlow'>): string {
+export function ssoErrorCopy(code: string, t: TFunction<['deviceFlow']>): string {
return t(($) => $[SSO_ERROR_KEY[code] ?? 'ssoError.default'])
}
diff --git a/web/app/education/apply/application-form.tsx b/web/app/education/apply/application-form.tsx
index 365daaf7afd..9da116f6955 100644
--- a/web/app/education/apply/application-form.tsx
+++ b/web/app/education/apply/application-form.tsx
@@ -40,7 +40,7 @@ type EducationApplyPageProps = {
}
const EducationApplyPage = ({ plan, token }: EducationApplyPageProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'education'])
const queryClient = useQueryClient()
const [schoolName, setSchoolName] = useState('')
const [role, setRole] = useState<EducationRole>('Student')
diff --git a/web/app/education/apply/applied-education-content.tsx b/web/app/education/apply/applied-education-content.tsx
index 5b16c8f4462..c5ee4b775d8 100644
--- a/web/app/education/apply/applied-education-content.tsx
+++ b/web/app/education/apply/applied-education-content.tsx
@@ -28,7 +28,7 @@ const AppliedEducationContent = ({
isSwitchingWorkspace,
onSwitchWorkspace,
}: AppliedEducationContentProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['education'])
const currentWorkspaceInList = workspaces.find((workspace) => workspace.current)
const workspacePlan = currentWorkspaceInList?.plan ?? plan
const workspaceName = currentWorkspaceInList?.name || currentWorkspace?.name
diff --git a/web/app/education/apply/institution-field.tsx b/web/app/education/apply/institution-field.tsx
index 800d9a5a723..84368015394 100644
--- a/web/app/education/apply/institution-field.tsx
+++ b/web/app/education/apply/institution-field.tsx
@@ -30,7 +30,7 @@ type InstitutionFieldProps = {
}
const InstitutionField = ({ value, onValueChange }: InstitutionFieldProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'education'])
const inputId = useId()
const listRef = useRef<HTMLDivElement>(null)
const [isPopupOpen, setIsPopupOpen] = useState(false)
diff --git a/web/app/education/apply/role-selector.tsx b/web/app/education/apply/role-selector.tsx
index 8c4c7ec6c47..a6d89b78752 100644
--- a/web/app/education/apply/role-selector.tsx
+++ b/web/app/education/apply/role-selector.tsx
@@ -10,7 +10,7 @@ type RoleSelectorProps = {
}
const RoleSelector = ({ onChange, value }: RoleSelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['education'])
const options: { key: EducationRole; value: string }[] = [
{
key: 'Student',
diff --git a/web/app/education/education-shell.tsx b/web/app/education/education-shell.tsx
index 819aff49f0c..d83ab86e3a0 100644
--- a/web/app/education/education-shell.tsx
+++ b/web/app/education/education-shell.tsx
@@ -10,7 +10,7 @@ type EducationShellProps = {
}
export default function EducationShell({ children }: EducationShellProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['education'])
const pageTitle = t(($) => $.toVerified, { ns: 'education' })
useDocumentTitle(pageTitle)
diff --git a/web/app/education/expire-notice/modal.tsx b/web/app/education/expire-notice/modal.tsx
index 372bba8a2ff..2096de27ac0 100644
--- a/web/app/education/expire-notice/modal.tsx
+++ b/web/app/education/expire-notice/modal.tsx
@@ -27,7 +27,7 @@ type Props = {
const i18nPrefix = 'notice'
const ExpireNoticeModal: React.FC<Props> = ({ expireAt, expired, onClose }) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'education'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/app/education/user-info.tsx b/web/app/education/user-info.tsx
index 44dd2a95b16..7d81a85b6ec 100644
--- a/web/app/education/user-info.tsx
+++ b/web/app/education/user-info.tsx
@@ -8,7 +8,7 @@ import { useLogout } from '@/service/use-common'
const UserInfo = () => {
const router = useRouter()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'education'])
const { data: userProfile } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile,
diff --git a/web/app/education/verify/verify-flow.tsx b/web/app/education/verify/verify-flow.tsx
index 360a5e18631..4534b225d4f 100644
--- a/web/app/education/verify/verify-flow.tsx
+++ b/web/app/education/verify/verify-flow.tsx
@@ -48,7 +48,7 @@ export function EducationVerifyFlow({
}: {
requestVerification?: EducationVerificationRequest
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['education'])
const router = useRouter()
const { data: userEmail } = useSuspenseQuery({
...userProfileQueryOptions(),
@@ -196,7 +196,7 @@ function EducationVerifyLoading() {
}
function EducationVerifiedContent() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'education'])
return (
<EducationVerifyContent>
@@ -222,7 +222,7 @@ function EducationVerifiedContent() {
}
function EducationVerifyError({ onRetry }: { onRetry: () => void }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'education'])
return (
<EducationVerifyContent>
diff --git a/web/app/error.tsx b/web/app/error.tsx
index 166ceee6f51..fb6c10a076e 100644
--- a/web/app/error.tsx
+++ b/web/app/error.tsx
@@ -12,7 +12,7 @@ type Props = Readonly<{
}>
export default function AppError({ error, retry }: Props) {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const { reset: resetQueries } = useQueryErrorResetBoundary()
console.error(error)
diff --git a/web/app/forgot-password/ChangePasswordForm.tsx b/web/app/forgot-password/ChangePasswordForm.tsx
index 71a8040b5ff..e216426d125 100644
--- a/web/app/forgot-password/ChangePasswordForm.tsx
+++ b/web/app/forgot-password/ChangePasswordForm.tsx
@@ -27,7 +27,7 @@ type PasswordFormValues = {
}
const ChangePasswordForm = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'login'])
const searchParams = useSearchParams()
const token = searchParams.get('token')
const isTokenMissing = !token
diff --git a/web/app/forgot-password/ForgotPasswordForm.tsx b/web/app/forgot-password/ForgotPasswordForm.tsx
index 79c9e402bb6..38f1c2e5571 100644
--- a/web/app/forgot-password/ForgotPasswordForm.tsx
+++ b/web/app/forgot-password/ForgotPasswordForm.tsx
@@ -27,7 +27,7 @@ const emailSchema = z.email('error.emailInValid').min(1, {
})
const ForgotPasswordForm = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'login'])
const [loading, setLoading] = useState(true)
const [isSubmitting, setIsSubmitting] = useState(false)
const [isEmailSent, setIsEmailSent] = useState(false)
diff --git a/web/app/init/InitPasswordPopup.tsx b/web/app/init/InitPasswordPopup.tsx
index 53659e9f882..266bb534418 100644
--- a/web/app/init/InitPasswordPopup.tsx
+++ b/web/app/init/InitPasswordPopup.tsx
@@ -16,7 +16,7 @@ const InitPasswordPopup = () => {
const [validated, setValidated] = useState(false)
const router = useRouter()
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const pageTitle = t(($) => $.adminInitPassword, { ns: 'login' })
useDocumentTitle(pageTitle)
diff --git a/web/app/install/installForm.tsx b/web/app/install/installForm.tsx
index 85a9bca2e41..77f644c14d7 100644
--- a/web/app/install/installForm.tsx
+++ b/web/app/install/installForm.tsx
@@ -37,7 +37,7 @@ const accountFormSchema = zPostSetupBody.pick({ email: true, name: true, passwor
type AccountFormValues = z.infer<typeof accountFormSchema>
const InstallForm = () => {
- const { t, i18n } = useTranslation()
+ const { t, i18n } = useTranslation(['login'])
const pageTitle = t(($) => $.setAdminAccount, { ns: 'login' })
useDocumentTitle(pageTitle)
const { push, replace } = useRouter()
diff --git a/web/app/notifications/copy-error-action.tsx b/web/app/notifications/copy-error-action.tsx
index 8d649217755..b397768cbb9 100644
--- a/web/app/notifications/copy-error-action.tsx
+++ b/web/app/notifications/copy-error-action.tsx
@@ -6,7 +6,7 @@ import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
export function CopyErrorAction({ text }: { text: string }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const { copy, copied, error, reset } = useClipboard({ timeout: 2000 })
useEffect(() => reset, [reset])
const [feedbackText, setFeedbackText] = useState<string | null>(null)
diff --git a/web/app/oauth-callback/page.tsx b/web/app/oauth-callback/page.tsx
index 6ce015e129b..ad1e0204feb 100644
--- a/web/app/oauth-callback/page.tsx
+++ b/web/app/oauth-callback/page.tsx
@@ -4,7 +4,7 @@ import useDocumentTitle from '@/hooks/use-document-title'
import { useOAuthCallback } from '@/hooks/use-oauth'
const OAuthCallback = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
useDocumentTitle(t(($) => $.signBtn, { ns: 'login' }))
useOAuthCallback()
diff --git a/web/app/reset-password/check-code/page.tsx b/web/app/reset-password/check-code/page.tsx
index d6688511f02..55d988f9929 100644
--- a/web/app/reset-password/check-code/page.tsx
+++ b/web/app/reset-password/check-code/page.tsx
@@ -17,7 +17,7 @@ type CheckCodeFormValues = {
}
export default function CheckCode() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const router = useRouter()
const searchParams = useSearchParams()
const email = decodeURIComponent(searchParams.get('email') as string)
diff --git a/web/app/reset-password/page.tsx b/web/app/reset-password/page.tsx
index 858432a0d82..7f28da755ef 100644
--- a/web/app/reset-password/page.tsx
+++ b/web/app/reset-password/page.tsx
@@ -15,7 +15,7 @@ import { sendResetPasswordCode } from '@/service/common'
import { COUNT_DOWN_TIME_MS, useSetCountdownLeftTime } from '../components/signin/storage'
export default function CheckCode() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const searchParams = useSearchParams()
const router = useRouter()
const [loading, setLoading] = useState(false)
diff --git a/web/app/reset-password/set-password/page.tsx b/web/app/reset-password/set-password/page.tsx
index 8d06c3f3e34..a2f9ae8118b 100644
--- a/web/app/reset-password/set-password/page.tsx
+++ b/web/app/reset-password/set-password/page.tsx
@@ -27,7 +27,7 @@ type PasswordFormValues = {
}
const ChangePasswordForm = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'login'])
const router = useRouter()
const searchParams = useSearchParams()
const token = decodeURIComponent(searchParams.get('token') || '')
diff --git a/web/app/signin/check-code/page.tsx b/web/app/signin/check-code/page.tsx
index fc85ea2bb34..b06e14fc3cd 100644
--- a/web/app/signin/check-code/page.tsx
+++ b/web/app/signin/check-code/page.tsx
@@ -29,7 +29,7 @@ type CheckCodeFormValues = {
}
export default function CheckCode() {
- const { t, i18n } = useTranslation()
+ const { t, i18n } = useTranslation(['login'])
const router = useRouter()
const queryClient = useQueryClient()
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
diff --git a/web/app/signin/components/mail-and-code-auth.tsx b/web/app/signin/components/mail-and-code-auth.tsx
index c56740a9516..b57f56cbee2 100644
--- a/web/app/signin/components/mail-and-code-auth.tsx
+++ b/web/app/signin/components/mail-and-code-auth.tsx
@@ -18,7 +18,7 @@ type MailAndCodeAuthProps = {
}
export default function MailAndCodeAuth({ isInvite }: MailAndCodeAuthProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const router = useRouter()
const searchParams = useSearchParams()
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
diff --git a/web/app/signin/components/mail-and-password-auth.tsx b/web/app/signin/components/mail-and-password-auth.tsx
index 08e7e93a135..48d890e2eae 100644
--- a/web/app/signin/components/mail-and-password-auth.tsx
+++ b/web/app/signin/components/mail-and-password-auth.tsx
@@ -31,7 +31,7 @@ function hasErrorCode(error: unknown, code: string) {
}
export default function MailAndPasswordAuth({ isInvite, isEmailSetup }: MailAndPasswordAuthProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const router = useRouter()
const queryClient = useQueryClient()
const searchParams = useSearchParams()
diff --git a/web/app/signin/components/social-auth.tsx b/web/app/signin/components/social-auth.tsx
index 328f9c36933..4131f2caf2b 100644
--- a/web/app/signin/components/social-auth.tsx
+++ b/web/app/signin/components/social-auth.tsx
@@ -9,7 +9,7 @@ import { getBrowserTimezone } from '@/utils/timezone'
import style from '../page.module.css'
export default function SocialAuth() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const searchParams = useSearchParams()
const locale = useLocale()
diff --git a/web/app/signin/components/sso-auth.tsx b/web/app/signin/components/sso-auth.tsx
index fc24edaee93..31d52d019ea 100644
--- a/web/app/signin/components/sso-auth.tsx
+++ b/web/app/signin/components/sso-auth.tsx
@@ -15,7 +15,7 @@ type SSOAuthProps = {
const SSOAuth: FC<SSOAuthProps> = ({ protocol }) => {
const router = useRouter()
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const searchParams = useSearchParams()
const invite_token = decodeURIComponent(searchParams.get('invite_token') || '')
diff --git a/web/app/signin/components/turnstile.tsx b/web/app/signin/components/turnstile.tsx
index b0d999078a2..be8c8e21373 100644
--- a/web/app/signin/components/turnstile.tsx
+++ b/web/app/signin/components/turnstile.tsx
@@ -42,7 +42,7 @@ export default function Turnstile({
onInvalidate,
onError,
}: TurnstileProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'login'])
const containerRef = useRef<HTMLDivElement>(null)
const onVerifyRef = useRef(onVerify)
const onInvalidateRef = useRef(onInvalidate)
diff --git a/web/app/signin/invite-settings/page.tsx b/web/app/signin/invite-settings/page.tsx
index bd00ead67b8..ade6672bc2c 100644
--- a/web/app/signin/invite-settings/page.tsx
+++ b/web/app/signin/invite-settings/page.tsx
@@ -66,7 +66,7 @@ const getInitialLanguage = (locale: Locale): Locale => {
}
export default function InviteSettingsPage() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'login'])
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
const router = useRouter()
const queryClient = useQueryClient()
diff --git a/web/app/signin/normal-form.tsx b/web/app/signin/normal-form.tsx
index 2b6181bee09..bc8ad3ed1bf 100644
--- a/web/app/signin/normal-form.tsx
+++ b/web/app/signin/normal-form.tsx
@@ -24,7 +24,7 @@ import { resolvePostLoginRedirect } from './utils/post-login-redirect'
type AuthType = 'code' | 'password'
function NormalForm() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const router = useRouter()
const searchParams = useSearchParams()
const queryString = searchParams.toString()
diff --git a/web/app/signin/one-more-step.tsx b/web/app/signin/one-more-step.tsx
index 8cf6494c1c3..58e664c56d7 100644
--- a/web/app/signin/one-more-step.tsx
+++ b/web/app/signin/one-more-step.tsx
@@ -74,7 +74,7 @@ const hasStatus = (error: unknown): error is { status: number } => {
}
const OneMoreStep = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'login'])
const router = useRouter()
const queryClient = useQueryClient()
const searchParams = useSearchParams()
diff --git a/web/app/signup/check-code/page.tsx b/web/app/signup/check-code/page.tsx
index ae015933dc3..55d640e9c22 100644
--- a/web/app/signup/check-code/page.tsx
+++ b/web/app/signup/check-code/page.tsx
@@ -18,7 +18,7 @@ type CheckCodeFormValues = {
}
export default function CheckCode() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const router = useRouter()
const searchParams = useSearchParams()
const email = decodeURIComponent(searchParams.get('email') as string)
diff --git a/web/app/signup/components/input-mail.tsx b/web/app/signup/components/input-mail.tsx
index fd68fafff53..0227e5e7e62 100644
--- a/web/app/signup/components/input-mail.tsx
+++ b/web/app/signup/components/input-mail.tsx
@@ -23,7 +23,7 @@ type SignupEmailFormValues = {
}
export default function SignupEmailForm({ onSuccess }: Props) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const locale = useLocale()
const searchParams = useSearchParams()
const queryString = searchParams.toString()
diff --git a/web/app/signup/page.tsx b/web/app/signup/page.tsx
index dcb5d1d9956..b930e952280 100644
--- a/web/app/signup/page.tsx
+++ b/web/app/signup/page.tsx
@@ -8,7 +8,7 @@ import MailForm from './components/input-mail'
const Signup = () => {
const router = useRouter()
const searchParams = useSearchParams()
- const { t } = useTranslation()
+ const { t } = useTranslation(['login'])
const pageTitle = t(($) => $['signup.createAccount'], { ns: 'login' })
useDocumentTitle(pageTitle)
diff --git a/web/app/signup/set-password/page.tsx b/web/app/signup/set-password/page.tsx
index 9e0d28d93a0..aee29ac58e1 100644
--- a/web/app/signup/set-password/page.tsx
+++ b/web/app/signup/set-password/page.tsx
@@ -48,7 +48,7 @@ const parseUtmInfo = () => {
}
const ChangePasswordForm = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'login'])
const router = useRouter()
const queryClient = useQueryClient()
const searchParams = useSearchParams()
diff --git a/web/docs/lint.md b/web/docs/lint.md
index 86bf2ab8e72..55a7d258d22 100644
--- a/web/docs/lint.md
+++ b/web/docs/lint.md
@@ -122,6 +122,29 @@ Explain the concrete reason after `--`: which external contract, lifecycle, or r
`reportUnusedDisableDirectives` runs at `error` repository-wide. Remove an exception when the finding no longer exists. Keep both checks active: a described disable may still be unused, and a used disable may still lack a reason.
+### Translation Function Types
+
+`dify/require-i18n-namespace` requires translation hook calls to use non-empty
+inline namespace arrays, including single namespaces: `useTranslation(['common'])`.
+Strings and indirect arguments are rejected; only calls reading the `i18n`
+instance alone may omit namespaces. Both `react-i18next` and `#i18n` are checked.
+The shared client/server adapter accepts typed non-empty tuples and forwards them
+through one documented lint exception in its client implementation.
+
+`dify/require-t-function-namespace` requires i18next `TFunction` types to declare a
+non-empty inline tuple of namespace string literals. Use `TFunction<['common']>`
+or `TFunction<['common', 'workflow']>`; readonly tuples are also supported.
+Omitted arguments, single strings, broad namespace types, tuple aliases, and
+unions or rest elements inside the tuple are rejected. Named import aliases,
+namespace imports, and inline `import('i18next').TFunction` types are checked.
+
+Declare the namespaces the helper or component actually uses. TypeScript checks
+translation keys and compatibility with callers; the lint rule does not infer
+transitive dependencies or detect unused namespaces. Keep the first namespace
+compatible with the caller because it defines the default translation namespace.
+The rule has no automatic fix because choosing the dependencies requires reading
+the translation calls.
+
### Introducing New Plugins or Rules
Prefer a native Oxlint rule. If none exists, verify that the rule works through an Oxlint JS plugin on representative files. Record unsupported code rules as migration gaps instead of adding them to ESLint; reserve the ESLint configuration for non-code languages that Oxlint cannot parse. Do not add the Antfu ESLint config as a dependency or enable rules already covered by Oxlint.
diff --git a/web/features/agent-v2/agent-composer/knowledge-validation.ts b/web/features/agent-v2/agent-composer/knowledge-validation.ts
index cbc47fe6000..642d1c50cef 100644
--- a/web/features/agent-v2/agent-composer/knowledge-validation.ts
+++ b/web/features/agent-v2/agent-composer/knowledge-validation.ts
@@ -33,10 +33,10 @@ export const getKnowledgeRetrievalSetName = (item: AgentKnowledgeRetrievalItem)
getKnowledgeRetrievalConcreteName(item) || item.id
export const useKnowledgeValidationMessage = () => {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
- const { t: tAppDebug } = useTranslation('appDebug')
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
+ const { t: tAppDebug } = useTranslation(['appDebug'])
+ const { t: tWorkflow } = useTranslation(['workflow'])
return (issueCode?: KnowledgeValidationIssueCode) => {
switch (issueCode) {
diff --git a/web/features/agent-v2/agent-detail/access-config/page.tsx b/web/features/agent-v2/agent-detail/access-config/page.tsx
index 2a4275f3feb..7af644fcb34 100644
--- a/web/features/agent-v2/agent-detail/access-config/page.tsx
+++ b/web/features/agent-v2/agent-detail/access-config/page.tsx
@@ -13,7 +13,7 @@ import { RESOURCE_ACCESS_SETTINGS_PAGE_SIZE } from '@/service/access-control/con
import { consoleQuery } from '@/service/console'
export function AgentAccessConfigPage({ agentId }: { agentId: string }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'permission'])
const language = getAccessControlTemplateLanguage(useLocale())
const { agentQuery, canAccessConfig } = useAgentPermissions(agentId)
const [page, setPage] = useState(1)
diff --git a/web/features/agent-v2/agent-detail/access/components/agent-api-key-modal.tsx b/web/features/agent-v2/agent-detail/access/components/agent-api-key-modal.tsx
index cf8a6d5932f..a18333b9ce9 100644
--- a/web/features/agent-v2/agent-detail/access/components/agent-api-key-modal.tsx
+++ b/web/features/agent-v2/agent-detail/access/components/agent-api-key-modal.tsx
@@ -35,8 +35,8 @@ export function AgentApiKeyModal({
open: boolean
onOpenChange: (open: boolean) => void
}) {
- const { t } = useTranslation('appApi')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['appApi', 'appLog', 'common'])
+ const { t: tCommon } = useTranslation(['common'])
const { formatTime } = useTimestamp()
const queryClient = useQueryClient()
const [newKey, setNewKey] = useState<ApiKeyItem | null>(null)
@@ -271,7 +271,7 @@ function AgentApiKeyGenerateModal({
apiKey: ApiKeyItem | null
onClose: () => void
}) {
- const { t } = useTranslation('appApi')
+ const { t } = useTranslation(['appApi', 'common'])
return (
<Dialog
diff --git a/web/features/agent-v2/agent-detail/access/components/service-api-access-card.tsx b/web/features/agent-v2/agent-detail/access/components/service-api-access-card.tsx
index da373211f27..fb2f3e852d8 100644
--- a/web/features/agent-v2/agent-detail/access/components/service-api-access-card.tsx
+++ b/web/features/agent-v2/agent-detail/access/components/service-api-access-card.tsx
@@ -15,8 +15,8 @@ import { consoleQuery } from '@/service/console'
import { AgentApiKeyModal } from './agent-api-key-modal'
export function ServiceApiAccessCard({ agentId }: { agentId: string }) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const docLink = useDocLink()
const queryClient = useQueryClient()
const [apiKeyModalOpen, setApiKeyModalOpen] = useState(false)
diff --git a/web/features/agent-v2/agent-detail/access/components/use-web-app-access-control.ts b/web/features/agent-v2/agent-detail/access/components/use-web-app-access-control.ts
index 94d798accea..248806a78f4 100644
--- a/web/features/agent-v2/agent-detail/access/components/use-web-app-access-control.ts
+++ b/web/features/agent-v2/agent-detail/access/components/use-web-app-access-control.ts
@@ -28,7 +28,7 @@ export function useWebAppAccessControl(
agent: AgentAppDetailWithSite | undefined,
isLoading: boolean,
) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const appId = agent?.backing_app_id ?? undefined
const accessMode = isAccessMode(agent?.access_mode) ? agent.access_mode : undefined
const { data: webAppAuthEnabled } = useSuspenseQuery({
diff --git a/web/features/agent-v2/agent-detail/access/components/web-app-access-card.tsx b/web/features/agent-v2/agent-detail/access/components/web-app-access-card.tsx
index 8e54bcc4dc2..4e7f0db9841 100644
--- a/web/features/agent-v2/agent-detail/access/components/web-app-access-card.tsx
+++ b/web/features/agent-v2/agent-detail/access/components/web-app-access-card.tsx
@@ -39,9 +39,9 @@ export function WebAppAccessCard({
agentId: string
isLoading: boolean
}) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
- const { t: tApp } = useTranslation('app')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
+ const { t: tApp } = useTranslation(['app'])
const queryClient = useQueryClient()
const appId = agent?.app_id
const apiBaseUrl = agent?.api_base_url
diff --git a/web/features/agent-v2/agent-detail/access/components/workflow-references-table.tsx b/web/features/agent-v2/agent-detail/access/components/workflow-references-table.tsx
index f5a6e30b588..d5704a29ca5 100644
--- a/web/features/agent-v2/agent-detail/access/components/workflow-references-table.tsx
+++ b/web/features/agent-v2/agent-detail/access/components/workflow-references-table.tsx
@@ -24,8 +24,8 @@ const getWorkflowReferenceHref = (reference: AgentReferencingWorkflowResponse) =
`/app/${reference.app_id}/workflow`
export function WorkflowReferencesTable({ agentId, enabled = true }: WorkflowReferencesTableProps) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const workflowReferencesQuery = useQuery(
consoleQuery.agent.byAgentId.referencingWorkflows.get.queryOptions({
input: {
@@ -109,7 +109,7 @@ export function WorkflowReferencesTable({ agentId, enabled = true }: WorkflowRef
}
function WorkflowAccessRow({ reference }: { reference: AgentReferencingWorkflowResponse }) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const { formatTime } = useTimestamp()
const imageUrl =
reference.app_icon_type === 'image' || reference.app_icon_type === 'link'
diff --git a/web/features/agent-v2/agent-detail/access/page.tsx b/web/features/agent-v2/agent-detail/access/page.tsx
index bb8a00ddd4f..ef751b8e4c3 100644
--- a/web/features/agent-v2/agent-detail/access/page.tsx
+++ b/web/features/agent-v2/agent-detail/access/page.tsx
@@ -21,7 +21,7 @@ type AgentAccessPageProps = {
}
export function AgentAccessPage({ agentId }: AgentAccessPageProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const docLink = useDocLink()
const agentQuery = useQuery(
consoleQuery.agent.byAgentId.get.queryOptions({
diff --git a/web/features/agent-v2/agent-detail/configure/components/composer-provider.tsx b/web/features/agent-v2/agent-detail/configure/components/composer-provider.tsx
index d6e619837c3..06cac7f6c92 100644
--- a/web/features/agent-v2/agent-detail/configure/components/composer-provider.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/composer-provider.tsx
@@ -20,7 +20,7 @@ export function AgentConfigureComposerProvider({
initialConfig?: AgentSoulConfig
initializeDefaultModel: boolean
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const [session, setSession] = useState<{
draft: AgentSoulConfigFormState
savedDraft: AgentSoulConfigFormState
diff --git a/web/features/agent-v2/agent-detail/configure/components/composer-session.tsx b/web/features/agent-v2/agent-detail/configure/components/composer-session.tsx
index df6542c001f..98a8506aff1 100644
--- a/web/features/agent-v2/agent-detail/configure/components/composer-session.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/composer-session.tsx
@@ -73,7 +73,7 @@ export function AgentConfigureComposerScope({
onRightPanelModeChange: (mode: AgentConfigureRightPanelMode) => void | Promise<unknown>
onSelectVersion: (versionId: string | null) => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const { composerQuery, selectedVersionId, activeVersionId, agentSoulConfig } = configureData
const soulSourceOverride = useAtomValue(agentConfigureSoulSourceOverrideAtom)
const setSoulSourceOverride = useSetAtom(agentConfigureSoulSourceOverrideAtom)
@@ -299,8 +299,8 @@ function AgentConfigurePageComposerContent({
activeConfigSnapshot,
agentSoulConfig,
} = configureData
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const [clearChatByMode, setClearChatByMode] = useState<
Record<AgentConfigureRightPanelMode, boolean>
>({
diff --git a/web/features/agent-v2/agent-detail/configure/components/confirm-clear-session-dialog.tsx b/web/features/agent-v2/agent-detail/configure/components/confirm-clear-session-dialog.tsx
index 5622f748d57..d4014ff6575 100644
--- a/web/features/agent-v2/agent-detail/configure/components/confirm-clear-session-dialog.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/confirm-clear-session-dialog.tsx
@@ -29,8 +29,8 @@ export function AgentConfigureClearSessionConfirmDialog({
onOpenChange?: (open: boolean) => void
onConfirm: () => boolean | void | Promise<boolean | void>
}) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const [uncontrolledOpen, setUncontrolledOpen] = useState(false)
const [isConfirming, setIsConfirming] = useState(false)
const open = controlledOpen ?? uncontrolledOpen
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/content-moderation.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/content-moderation.tsx
index 33dd0a3e642..e1960d5f4a0 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/content-moderation.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/content-moderation.tsx
@@ -31,7 +31,7 @@ const defaultModerationConfig: ModerationConfig = {
}
function AgentContentModerationSettingsContent() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['appDebug', 'common'])
const locale = useLocale()
const featuresStore = useFeaturesStore()
const readOnly = useAgentOrchestrateReadOnly()
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/env.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/env.tsx
index cd0f89dacac..f10e3344c53 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/env.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/env.tsx
@@ -91,7 +91,7 @@ function EnvEditorScope({
scope: EnvScope
onChange?: (scope: EnvScope) => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
if (!editable) {
return (
@@ -201,7 +201,7 @@ function EnvEditorRow({
onValueChange?: (value: string) => void
showScope?: boolean
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const [isValueRevealed, setIsValueRevealed] = useState(false)
const shouldMaskValue = variable.masked && !isValueRevealed
const displayedValue = shouldMaskValue ? maskedEnvValue : variable.value
@@ -307,7 +307,7 @@ function EnvEditorDraftRow({
onAdd?: (options?: { focusField?: 'key' | 'value'; scope?: EnvScope }) => void
showScope?: boolean
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const keyPlaceholder = t(
($) => $['agentDetail.configure.advancedSettings.envEditor.keyPlaceholder'],
)
@@ -374,7 +374,7 @@ export function EnvVariablesTable({
showDraftRow?: boolean
showScope?: boolean
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2', 'appDebug'])
const tableLabel = t(($) => $['agentDetail.configure.advancedSettings.envEditor.label'])
const checkEnvVariableKey = (key: string) => {
const { isValid, errorMessageKey } = checkKeys([key], false)
@@ -471,7 +471,7 @@ export function EnvVariablesTable({
}
export function AgentEnvEditor() {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const readOnly = useAgentOrchestrateReadOnly()
const envVariables = useAtomValue(agentComposerEnvVariablesAtom)
const addEnvVariable = useSetAtom(addEnvVariableAtom)
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/index.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/index.tsx
index 7ac4415af7c..652a1575233 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/index.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/advanced/index.tsx
@@ -7,7 +7,7 @@ import { AgentContentModerationSettings } from './content-moderation'
import { AgentEnvEditor } from './env'
export function AgentAdvancedSettings() {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const advancedSettingsPanelId = 'agent-configure-advanced-settings-panel'
return (
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/build-draft-bar.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/build-draft-bar.tsx
index edbde9abdc7..ed0b81430f9 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/build-draft-bar.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/build-draft-bar.tsx
@@ -28,8 +28,8 @@ export function AgentBuildDraftBar({
onApply,
onDiscard,
}: AgentBuildDraftBarProps) {
- const { t } = useTranslation('agentV2')
- const { t: tCustom } = useTranslation('custom')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCustom } = useTranslation(['custom'])
const [open, setOpen] = useState(false)
const [panelWidth, setPanelWidth] = useState<number>()
const collapsedBarRef = useRef<HTMLDivElement>(null)
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/build-draft-changes-panel.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/build-draft-changes-panel.tsx
index 11dd849511f..0a629b50e64 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/build-draft-changes-panel.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/build-draft-changes-panel.tsx
@@ -24,7 +24,7 @@ export function AgentBuildDraftChangesPanel({
changesLabel: string
onToggle: () => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const sections = getChangeSections({ changeSummary, t })
return (
@@ -72,7 +72,7 @@ function AgentBuildDraftChangeSectionRow({ section }: { section: AgentBuildDraft
}
function AgentBuildDraftChangeItemRow({ item }: { item: AgentBuildDraftChangeItem }) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const descriptionKey = item.descriptionKey
return (
@@ -113,7 +113,7 @@ function getChangeSections({
t,
}: {
changeSummary?: AgentBuildDraftChangeSummary
- t: TFunction<'agentV2'>
+ t: TFunction<['agentV2']>
}): AgentBuildDraftChangeSection[] {
if (!changeSummary) return []
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/common/add-button.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/common/add-button.tsx
index 369597ade47..af0319007cc 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/common/add-button.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/common/add-button.tsx
@@ -18,7 +18,7 @@ export function ConfigureSectionAddButton({
className,
...props
}: ConfigureSectionAddButtonProps) {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const isViewingVersion = useAgentOrchestrateViewingVersion()
if (isViewingVersion) return null
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/index.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/index.tsx
index b6892860725..de6e5de7212 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/index.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/index.tsx
@@ -83,7 +83,7 @@ function AgentFileItem({
onRemove: (fileId: string) => void
selected: boolean
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const readOnly = useAgentOrchestrateReadOnly()
const queryClient = useQueryClient()
const [isPreviewOpen, setIsPreviewOpen] = useState(false)
@@ -348,7 +348,7 @@ function AgentBuildNoteFileRow() {
}
function AgentBuildNoteBadge() {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
return (
<FileTreeBadge className="ms-0 gap-0.5 px-1 py-0.5">
@@ -382,7 +382,7 @@ function AgentBuildNoteInfotip() {
}
export function AgentFiles() {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const filesTreeId = 'agent-configure-files-tree'
const readOnly = useAgentOrchestrateReadOnly()
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/upload-dialog.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/upload-dialog.tsx
index 8cbc3312e70..fe3eb79e50b 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/upload-dialog.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/files/upload-dialog.tsx
@@ -49,9 +49,9 @@ function hasDraggedFiles(event: DragEvent<HTMLDivElement>) {
}
function AgentFileUploader({ file, onChange }: { file?: File; onChange: (file?: File) => void }) {
- const { t } = useTranslation('agentV2')
- const { t: tAppDebug } = useTranslation('appDebug')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tAppDebug } = useTranslation(['appDebug'])
+ const { t: tCommon } = useTranslation(['common'])
const { data: fileUploadConfig } = useFileUploadConfig()
const { imgSizeLimit, docSizeLimit, audioSizeLimit, videoSizeLimit } =
useFileSizeLimit(fileUploadConfig)
@@ -222,8 +222,8 @@ export function AgentFileUploadDialog({
onOpenChange: (open: boolean) => void
onUploaded: (file: AgentFileNode) => void
}) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2', 'common'])
+ const { t: tCommon } = useTranslation(['common'])
const [file, setFile] = useState<File>()
const uploadFileMutation = useMutation(consoleQuery.files.upload.post.mutationOptions())
const commitAgentFileMutation = useMutation(
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/header.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/header.tsx
index 78437d9a0de..fb7d2442cba 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/header.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/header.tsx
@@ -15,7 +15,7 @@ export function AgentOrchestrateHeader({
trailingAction,
isBuildDraftActive = false,
}: AgentOrchestrateHeaderProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const communityEditionIsolationTip = t(
($) => $['agentDetail.configure.communityEditionIsolationTip'],
)
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/index.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/index.tsx
index ed115e7df94..74ca999437e 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/index.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/index.tsx
@@ -86,7 +86,7 @@ export function AgentOrchestratePanel({
onOpenVersions,
onVersionRestored,
}: AgentOrchestratePanelProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const orchestrateHeadingId = 'agent-configure-orchestrate-heading'
const orchestrateLabel = t(($) => $['agentDetail.configure.title'])
const orchestrateBottomAction =
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/knowledge/dialog.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/knowledge/dialog.tsx
index 44c0b135c32..c1ca4c1f9a8 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/knowledge/dialog.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/knowledge/dialog.tsx
@@ -328,7 +328,7 @@ function AgentKnowledgeRetrievalDialogContent({
onItemCreate,
onItemChange,
}: Omit<AgentKnowledgeRetrievalDialogProps, 'open' | 'onOpenChange'>) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2', 'common', 'datasetSettings'])
const docLink = useDocLink()
const retrievals = useAtomValue(agentComposerKnowledgeRetrievalsAtom)
const getValidationMessage = useKnowledgeValidationMessage()
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/knowledge/index.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/knowledge/index.tsx
index c6bc9e82501..6a86d66841f 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/knowledge/index.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/knowledge/index.tsx
@@ -28,7 +28,7 @@ function KnowledgeRetrievalIcon() {
)
}
-function getKnowledgeRetrievalName(item: AgentKnowledgeRetrievalItem, t: TFunction<'agentV2'>) {
+function getKnowledgeRetrievalName(item: AgentKnowledgeRetrievalItem, t: TFunction<['agentV2']>) {
const nameKey = item.nameKey
return item.name ?? (nameKey ? t(($) => $[nameKey]) : item.id)
}
@@ -42,7 +42,7 @@ function AgentKnowledgeRetrievalRow({
onEdit: () => void
item: AgentKnowledgeRetrievalItem
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const itemName = getKnowledgeRetrievalName(item, t)
return (
@@ -62,7 +62,7 @@ function AgentKnowledgeRetrievalRow({
}
export function AgentKnowledgeRetrieval() {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const retrievals = useAtomValue(agentComposerKnowledgeRetrievalsAtom)
const addKnowledgeRetrieval = useSetAtom(addKnowledgeRetrievalAtom)
const updateKnowledgeRetrieval = useSetAtom(updateKnowledgeRetrievalAtom)
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/model-config/field.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/model-config/field.tsx
index 0177b329360..a97eaf62050 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/model-config/field.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/model-config/field.tsx
@@ -18,7 +18,7 @@ type AgentModelFieldProps = {
}
export function AgentModelField({ currentModel, onSelect }: AgentModelFieldProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2', 'common'])
const readOnly = useAgentOrchestrateReadOnly()
const modelListQuery = useQuery(
consoleQuery.workspaces.current.models.modelTypes.byModelType.get.queryOptions({
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/prompt-editor/index.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/prompt-editor/index.tsx
index 341ba877364..133418c4501 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/prompt-editor/index.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/prompt-editor/index.tsx
@@ -421,7 +421,7 @@ function AgentPromptSelectionBridge({
}
export function AgentPromptEditor() {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const readOnly = useAgentOrchestrateReadOnly()
const { data: enableSkill } = useQuery(
consoleQuery.features.get.queryOptions({
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/prompt-editor/slash.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/prompt-editor/slash.tsx
index c8f71a19dbf..54647fa3d2a 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/prompt-editor/slash.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/prompt-editor/slash.tsx
@@ -103,7 +103,7 @@ export function AgentPromptSlashMenu({
onOpenCategory,
onInsertToken,
}: AgentPromptSlashMenuProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const title = categories.find((category) => category.key === view)?.label
const handleAddFromFooter = (skillSource?: 'library' | 'upload') => {
if (view === 'skills') {
@@ -357,7 +357,7 @@ function AgentPromptToolRows({
onAddProviderTools: (tools: AgentProviderToolDefaultValue[]) => void
onInsertToken: (token: string) => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const language = useGetLanguage()
const { getProviderIcon, getProviderIcons } = useAgentPromptToolIconResolver()
const [activeTab, setActiveTab] = useState<ToolPromptTab>('all')
@@ -592,7 +592,7 @@ function getProviderLabel(provider: ToolWithProvider, language: string) {
return getLocalizedText(provider.label, language) || provider.name
}
-function getProviderTypeLabel(provider: ToolWithProvider, t: TFunction<'agentV2'>) {
+function getProviderTypeLabel(provider: ToolWithProvider, t: TFunction<['agentV2']>) {
if (provider.type === CollectionType.workflow)
return t(($) => $['agentDetail.configure.tools.toolTabs.workflow'])
if (provider.type === CollectionType.custom)
@@ -678,7 +678,7 @@ function AgentPromptProviderIcon({
}
function AgentPromptToolFooter({ onAddCliTool }: { onAddCliTool?: () => void }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['agentV2', 'plugin'])
return (
<div className="border-t border-divider-subtle p-1">
@@ -744,7 +744,7 @@ function AgentPromptCliToolRow({
tool: Extract<AgentTool, { kind: 'cli' }>
onClick: () => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
return (
<button
@@ -775,7 +775,7 @@ function AgentPromptKnowledgeRows({
knowledgeRetrievals: AgentKnowledgeRetrievalItem[]
onInsertToken: (token: string) => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
return (
<>
@@ -801,7 +801,7 @@ function AgentPromptKnowledgeRows({
function getKnowledgeRetrievalName(
retrieval: AgentKnowledgeRetrievalItem,
- t: TFunction<'agentV2'>,
+ t: TFunction<['agentV2']>,
) {
const nameKey = retrieval.nameKey
return retrieval.name ?? (nameKey ? t(($) => $[nameKey]) : retrieval.id)
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/index.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/index.tsx
index 56ebeadc50e..a176ec8d283 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/index.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/index.tsx
@@ -93,8 +93,8 @@ export function AgentConfigurePublishBar({
onOpenVersions,
onVersionRestored,
}: AgentConfigurePublishBarProps) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const { formatTimeFromNow } = useFormatTimeFromNow()
const queryClient = useQueryClient()
const draft = useAtomValue(agentComposerDraftAtom)
@@ -381,7 +381,7 @@ function PublishBarActions({
onOpenVersions: () => void
onPublishRequest: () => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const publishButtonLabelId = useId()
return (
@@ -459,7 +459,7 @@ function AgentVersionRestoreBar({
onExitVersions?: () => void
onRestoreVersion?: (versionId: string) => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const { formatTime } = useTimestamp()
const versionLabel =
version.version_note ||
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/publish-impact-details.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/publish-impact-details.tsx
index efcf509d76c..78de9b6e5aa 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/publish-impact-details.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/publish-impact-details.tsx
@@ -24,7 +24,7 @@ export function AgentPublishImpactDetails({
agentName,
references,
}: AgentPublishImpactDetailsProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const titleId = useId()
return (
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/publish-success.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/publish-success.tsx
index 33522292a1d..2285f295b61 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/publish-success.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/publish-bar/publish-success.tsx
@@ -23,7 +23,7 @@ export function AgentPublishSuccess({
onDismiss: () => void
onAccessMethods: () => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const agentQuery = useQuery(
consoleQuery.agent.byAgentId.get.queryOptions({
input: { params: { agent_id: agentId } },
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/detail-dialog.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/detail-dialog.tsx
index 41bc44eb3ed..0e9654bb9fc 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/detail-dialog.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/detail-dialog.tsx
@@ -95,7 +95,7 @@ function AgentSkillFileList({
renderFolderSuffix?: AgentSkillDetail['renderFolderSuffix']
selectedFileId?: string
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
if (fileListLoading) {
return (
@@ -226,8 +226,8 @@ function AgentFilePreviewContent({
isLoading?: boolean
onDownloadFile?: (action: AgentSkillDetailDownloadAction) => void
}) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const isPreviewDownloadLoading = downloadActionLoadingTarget === 'preview'
if (isLoading || isDownloadLoading) {
@@ -343,7 +343,7 @@ export function AgentSkillDetailDialog({
skillName: string
detail: AgentSkillDetail
}) {
- const { t: tCommon } = useTranslation('common')
+ const { t: tCommon } = useTranslation(['common'])
const dialogTitleId = useId()
const previewTitle = detail.filePreview?.fileName
const isHeaderDownloadLoading = detail.filePreview?.downloadActionLoadingTarget === 'header'
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/index.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/index.tsx
index dc84de0a7ab..8afda0d9c37 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/index.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/index.tsx
@@ -125,7 +125,7 @@ function WorkspaceSkillRow({
selected: boolean
skill: SkillResponse
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const cannotAdd = unavailable || isAdded || isPending
return (
@@ -163,7 +163,7 @@ function WorkspaceSkillRow({
}
function WorkspaceSkillPreview({ skill }: { skill?: SkillResponse }) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
if (!skill) {
return (
@@ -213,7 +213,7 @@ function WorkspaceSkillSelector({
isBindingPending: boolean
onSelect: (skill: SkillResponse) => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const [keyword, setKeyword] = useState('')
const [selectedTagIds, setSelectedTagIds] = useState<string[]>([])
const [previewSkillId, setPreviewSkillId] = useState<string | undefined>(undefined)
@@ -353,7 +353,7 @@ function WorkspaceAgentSkillItem({
skill: AgentSkillBindingItemResponse
onRemove: (skillId: string) => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const readOnly = useAgentOrchestrateReadOnly()
const [isActionsOpen, setIsActionsOpen] = useState(false)
const [isRemoveHighlighted, setIsRemoveHighlighted] = useState(false)
@@ -454,9 +454,9 @@ function WorkspaceAgentSkillItem({
}
export function AgentSkills() {
- const { t } = useTranslation('agentV2')
- const { t: tSkill } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tSkill } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
const skillsListId = 'agent-configure-skills-list'
const queryClient = useQueryClient()
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/item.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/item.tsx
index 62442f8430d..da4d1335675 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/item.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/item.tsx
@@ -32,8 +32,8 @@ export function AgentSkillItem({
skill: AgentSkill
onRemove: (skillId: string) => void
}) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const queryClient = useQueryClient()
const [isPreviewOpen, setIsPreviewOpen] = useState(false)
const [isActionsOpen, setIsActionsOpen] = useState(false)
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/upload-dialog.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/upload-dialog.tsx
index f093e726b65..8103c959a78 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/upload-dialog.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/upload-dialog.tsx
@@ -69,8 +69,8 @@ function AgentSkillPackageUploader({
onChange: (file?: File) => void
showWarning: boolean
}) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const { data: fileUploadConfig } = useFileUploadConfig()
const { skillSizeLimit } = useFileSizeLimit(fileUploadConfig)
const fileInputRef = useRef<HTMLInputElement>(null)
@@ -250,8 +250,8 @@ export function AgentSkillUploadDialog({
open: boolean
onOpenChange: (open: boolean) => void
}) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2', 'common'])
+ const { t: tCommon } = useTranslation(['common'])
const [file, setFile] = useState<File>()
const uploadAgentSkillMutation = useMutation(
consoleQuery.agent.byAgentId.config.skills.upload.post.mutationOptions(),
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/use-skill-detail.ts b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/use-skill-detail.ts
index 0494e84c759..21299dba57c 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/use-skill-detail.ts
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/use-skill-detail.ts
@@ -178,7 +178,7 @@ export function useAgentSkillDetail({
isOpen: boolean
skill: AgentSkill
}): AgentSkillDetail {
- const { t: tCommon } = useTranslation('common')
+ const { t: tCommon } = useTranslation(['common'])
const queryClient = useQueryClient()
const [selectedFileId, setSelectedFileId] = useState<string>()
const [downloadActionLoadingTarget, setDownloadActionLoadingTarget] =
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/dialog.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/dialog.tsx
index 0e3d996f52a..f934a29ae11 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/dialog.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/dialog.tsx
@@ -52,8 +52,8 @@ export function CliToolDialog({
onOpenChange: (open: boolean) => void
tool?: AgentCliTool | null
}) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2', 'common'])
+ const { t: tCommon } = useTranslation(['common'])
const docLink = useDocLink()
const [installCommand, setInstallCommand] = useState(tool?.installCommand ?? '')
const [toolName, setToolName] = useState(tool?.name ?? '')
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/item.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/item.tsx
index f7c4d0faa31..deded40cbfd 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/item.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/cli-tool/item.tsx
@@ -21,7 +21,7 @@ export function AgentCliToolItem({
onEdit: () => void
tool: AgentCliTool
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
return (
<ConfigureSectionConfigurableItem
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/index.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/index.tsx
index ca5d0818275..6f3d395575e 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/index.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/index.tsx
@@ -272,7 +272,7 @@ function AddToolMenu({
onAddTools: (tools: AgentProviderToolDefaultValue[]) => void
selectedTools: ToolValue[]
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const [open, setOpen] = useState(false)
const [view, setView] = useState<AddToolMenuView>(addToolDefaultView)
const { providerById } = useAgentToolProviderCatalog()
@@ -382,7 +382,7 @@ function AddToolMenu({
}
export function AgentTools() {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const readOnly = useAgentOrchestrateReadOnly()
const setProviderToolCredential = useSetAtom(setProviderToolCredentialAtom)
const invalidateAllBuiltInTools = useInvalidateAllBuiltInTools()
diff --git a/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/provider-tool/item.tsx b/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/provider-tool/item.tsx
index 8e8efb024b6..3867b2e3789 100644
--- a/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/provider-tool/item.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/orchestrate/tools/provider-tool/item.tsx
@@ -57,7 +57,7 @@ function UnauthorizedCredentialStatus({
credentialType?: AgentProviderTool['credentialType'],
) => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['tools'])
const [isOpen, setIsOpen] = useState(false)
const pluginPayload = useMemo(
() => ({
@@ -131,7 +131,7 @@ function UninstalledPluginStatus({
extraIdentifiers: string[]
onInstall: () => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['plugin'])
if (installInfo) {
return (
@@ -215,7 +215,7 @@ const ProviderToolActionItem = memo(
onConfigureAction: (target: ToolSettingTarget) => void
onRemoveAction: (actionId: string) => void
}) => {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const readOnly = useAgentOrchestrateReadOnly()
const handleConfigureAction = useCallback(() => {
onConfigureAction({ actionId: action.id, toolId: tool.id })
@@ -286,7 +286,7 @@ export const AgentProviderToolItem = memo(
credentialType?: AgentProviderTool['credentialType'],
) => void
}) => {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const readOnly = useAgentOrchestrateReadOnly()
const { theme } = useTheme()
const shouldFetchPluginManifest =
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/build-chat.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/build-chat.tsx
index 6e310af608d..f8a43cf2035 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/build-chat.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/build-chat.tsx
@@ -31,7 +31,7 @@ type AgentBuildChatProps = Omit<
function AgentBuildChatEmptyState({
showUnconfiguredNotice,
}: Pick<AgentChatRuntimeEmptyStateProps, 'showUnconfiguredNotice'>) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const communityEditionBuildModeTip = t(
($) => $['agentDetail.configure.build.empty.communityEditionTip'],
)
@@ -72,7 +72,7 @@ function AgentBuildChatEmptyState({
}
export function AgentBuildChat(props: AgentBuildChatProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
return (
<AgentChatRuntime
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/chat-conversation.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/chat-conversation.tsx
index ad7ac25a2b7..125e9e7a56d 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/chat-conversation.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/chat-conversation.tsx
@@ -118,7 +118,7 @@ export function AgentPreviewChatConversation({
onSaveDraftBeforeRun?: () => Promise<AgentSoulConfig | void>
onSendInterrupted?: () => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const docLink = useDocLink()
const queryClient = useQueryClient()
const { data: userProfile } = useSuspenseQuery({
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/chat-features-panel.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/chat-features-panel.tsx
index bc6994c0aed..86aba2d23e4 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/chat-features-panel.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/chat-features-panel.tsx
@@ -136,7 +136,7 @@ function AgentChatFeaturesPanelContent({
show,
onClose,
}: AgentChatFeaturesPanelProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const featuresStore = useFeaturesStore()
const setAppFeatures = useSetAppFeatures()
const handleChange = useCallback(() => {
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/chat-session.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/chat-session.tsx
index 2ff19e62a6f..de5c66f21f6 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/chat-session.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/chat-session.tsx
@@ -82,7 +82,7 @@ export function AgentPreviewChatSession({
onSaveDraftBeforeRun?: () => Promise<AgentSoulConfig | void>
onSendInterrupted?: () => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const prompt = useAtomValue(agentComposerPromptAtom)
const currentModel = useAtomValue(agentComposerModelAtom)
const composerDraft = useAtomValue(agentComposerDraftAtom)
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/header.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/header.tsx
index 51ac341a26c..aa729171eb2 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/header.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/header.tsx
@@ -135,7 +135,7 @@ export function AgentPreviewHeader({
showChatFeaturesAction?: boolean
trailingAction?: ReactNode
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const docLink = useDocLink()
const buildLabel = t(($) => $['agentDetail.configure.rightPanel.build'])
const buildTipBody = t(($) => $['agentDetail.configure.rightPanel.buildTipBody'])
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/preview-chat.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/preview-chat.tsx
index abdc7e86f16..fbbaae4fcba 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/preview-chat.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/preview-chat.tsx
@@ -19,7 +19,7 @@ function AgentPreviewChatEmptyState({
agentName,
showUnconfiguredNotice,
}: AgentChatRuntimeEmptyStateProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const imageUrl = agentIconType === 'image' || agentIconType === 'link' ? agentIcon : undefined
const iconType = imageUrl ? 'image' : agentIconType
@@ -46,7 +46,7 @@ function AgentPreviewChatEmptyState({
}
export function AgentPreviewChat(props: AgentPreviewChatProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const agentName =
props.agentName || t(($) => $['agentDetail.configure.preview.empty.defaultAgentName'])
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/unconfigured-notice.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/unconfigured-notice.tsx
index a07d0c20c92..d5aaa1618ee 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/unconfigured-notice.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/unconfigured-notice.tsx
@@ -3,7 +3,7 @@
import { useTranslation } from 'react-i18next'
export function AgentUnconfiguredNotice({ visible }: { visible: boolean }) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
return (
<p
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/current-draft-item.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/current-draft-item.tsx
index 191feddcb70..1f20b8c10f9 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/current-draft-item.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/current-draft-item.tsx
@@ -11,7 +11,7 @@ export function CurrentDraftItem({
isLast: boolean
onSelect: () => void
}) {
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t: tWorkflow } = useTranslation(['workflow'])
return (
<button
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/filter.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/filter.tsx
index 8dae66d64ad..49b24eb00da 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/filter.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/filter.tsx
@@ -36,8 +36,8 @@ export function VersionFilter({
filterValue: AgentVersionFilter
onFilterChange: (filterValue: AgentVersionFilter) => void
}) {
- const { t } = useTranslation('agentV2')
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tWorkflow } = useTranslation(['workflow'])
const isFiltering = filterValue !== 'all'
return (
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/index.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/index.tsx
index 8b8b423e938..9d46ab0ec07 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/index.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/index.tsx
@@ -40,9 +40,9 @@ export function AgentPreviewVersionsPanel({
onBeforeRestore,
restoreDisabled,
}: AgentPreviewVersionsPanelProps) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
+ const { t: tWorkflow } = useTranslation(['workflow'])
const { data: userProfile } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile,
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/version-filter-empty.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/version-filter-empty.tsx
index 2027d02c841..506663512b5 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/version-filter-empty.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/version-filter-empty.tsx
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next'
export function VersionFilterEmpty({ onReset }: { onReset: () => void }) {
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t: tWorkflow } = useTranslation(['workflow'])
return (
<div className="rounded-lg border border-components-panel-border bg-components-panel-on-panel-item-bg px-3 py-6 text-center">
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/version-item.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/version-item.tsx
index 47842d7bb64..fa8a9d68b23 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/version-item.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/versions-panel/version-item.tsx
@@ -13,7 +13,7 @@ import useTimestamp from '@/hooks/use-timestamp'
import { VersionTimelineDot } from './version-timeline-dot'
function VersionMetadata({ version }: { version: AgentConfigSnapshotSummaryResponse }) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const { formatTime } = useTimestamp()
if (version.created_at == null && !version.created_by) return null
@@ -56,8 +56,8 @@ export function VersionItem({
exportDisabled?: boolean
showUpgrade?: boolean
}) {
- const { t } = useTranslation('agentV2')
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t } = useTranslation(['agentV2', 'app', 'billing'])
+ const { t: tWorkflow } = useTranslation(['workflow'])
const isActive = version.id === activeVersionId
const label =
version.version_note ||
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-breadcrumb.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-breadcrumb.tsx
index 325be1f4519..54402dc5299 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-breadcrumb.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-breadcrumb.tsx
@@ -128,7 +128,7 @@ export function AgentWorkingDirectoryBreadcrumb({
path: AgentWorkingDirectoryPath
onPathChange: (path: AgentWorkingDirectoryPath) => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2', 'common'])
const items = getBreadcrumbItems(path)
const { hiddenItems, visibleItems } = getVisibleBreadcrumbItems(items)
diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-panel.tsx b/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-panel.tsx
index ce6d1d7553f..53d178b018e 100644
--- a/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-panel.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/preview/working-directory-panel.tsx
@@ -247,8 +247,8 @@ export function AgentWorkingDirectoryPanel({
const temporaryFilesLabelId = useId()
const persistentFilesLabelId = useId()
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const persistentFilesTooltip = t(
($) => $['agentDetail.configure.workingDirectory.persistentFilesTooltip'],
)
diff --git a/web/features/agent-v2/agent-detail/configure/components/version-restore/index.tsx b/web/features/agent-v2/agent-detail/configure/components/version-restore/index.tsx
index 911b8c22de9..f3cb7b304da 100644
--- a/web/features/agent-v2/agent-detail/configure/components/version-restore/index.tsx
+++ b/web/features/agent-v2/agent-detail/configure/components/version-restore/index.tsx
@@ -41,7 +41,7 @@ export function AgentVersionRestore({
onBeforeRestore?: () => void | Promise<void>
onRestored?: () => void | Promise<void>
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2', 'billing', 'common', 'workflow'])
const queryClient = useQueryClient()
const { canReleaseAndVersion: canRestore } = useAgentPermissions(agentId)
const deploymentEdition = useAtomValue(deploymentEditionAtom)
diff --git a/web/features/agent-v2/agent-detail/configure/use-agent-configure-build-draft.ts b/web/features/agent-v2/agent-detail/configure/use-agent-configure-build-draft.ts
index 137d5821286..c9946d25c2e 100644
--- a/web/features/agent-v2/agent-detail/configure/use-agent-configure-build-draft.ts
+++ b/web/features/agent-v2/agent-detail/configure/use-agent-configure-build-draft.ts
@@ -156,7 +156,7 @@ export function useAgentConfigureBuildDraftData({
setSoulSourceOverride: (source: AgentConfigureSoulSource | null) => void
soulSourceOverride: AgentConfigureSoulSource | null
}) {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const buildDraftQueryInput = {
params: {
agent_id: agentId,
@@ -286,7 +286,7 @@ export function useAgentConfigureBuildDraftActions({
onComposerRebased?: () => void
setSoulSourceOverride: (source: AgentConfigureSoulSource | null) => void
}) {
- const { t: tCommon } = useTranslation('common')
+ const { t: tCommon } = useTranslation(['common'])
const queryClient = useQueryClient()
const buildDraftRefreshTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
const buildDraftRefreshGenerationRef = useRef(0)
diff --git a/web/features/agent-v2/agent-detail/configure/use-agent-configure-sync.ts b/web/features/agent-v2/agent-detail/configure/use-agent-configure-sync.ts
index 15eb59dfafb..f7dcacaa3bc 100644
--- a/web/features/agent-v2/agent-detail/configure/use-agent-configure-sync.ts
+++ b/web/features/agent-v2/agent-detail/configure/use-agent-configure-sync.ts
@@ -55,8 +55,8 @@ export function useAgentConfigureSync({
enabled: boolean
publishEnabled: boolean
}) {
- const { t: tCommon } = useTranslation('common')
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t: tCommon } = useTranslation(['common'])
+ const { t: tWorkflow } = useTranslation(['workflow'])
const getKnowledgeValidationMessage = useKnowledgeValidationMessage()
const toolPresentationIdentities = useAtomValue(agentComposerToolPresentationIdentitiesAtom)
const toolProviderCatalog = useAgentToolProviderCatalog()
diff --git a/web/features/agent-v2/agent-detail/layout.tsx b/web/features/agent-v2/agent-detail/layout.tsx
index 2af828158f4..741deebe8af 100644
--- a/web/features/agent-v2/agent-detail/layout.tsx
+++ b/web/features/agent-v2/agent-detail/layout.tsx
@@ -18,10 +18,10 @@ type AgentDetailLayoutProps = {
const isNotFoundResponse = (error: unknown) => error instanceof Response && error.status === 404
export function AgentDetailLayout({ agentId, children }: AgentDetailLayoutProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const pathname = usePathname()
const router = useRouter()
- const { t: tCommon } = useTranslation('common')
+ const { t: tCommon } = useTranslation(['common'])
const { agentQuery, ...capabilities } = useAgentPermissions(agentId)
const shouldRedirectToRoster = isNotFoundResponse(agentQuery.error)
const section = pathname.endsWith('/access-config')
diff --git a/web/features/agent-v2/agent-detail/logs/components/log-detail-panel.tsx b/web/features/agent-v2/agent-detail/logs/components/log-detail-panel.tsx
index 4041a413a55..ca6a35b2895 100644
--- a/web/features/agent-v2/agent-detail/logs/components/log-detail-panel.tsx
+++ b/web/features/agent-v2/agent-detail/logs/components/log-detail-panel.tsx
@@ -24,8 +24,8 @@ export function AgentLogDetailPanel({
log?: AgentLogConversationItemResponse
onClose: () => void
}) {
- const { t } = useTranslation()
- const { t: tAgentV2 } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2', 'appLog', 'common'])
+ const { t: tAgentV2 } = useTranslation(['agentV2'])
const { formatTime } = useTimestamp()
const queryClient = useQueryClient()
const feedbackMutation = useMutation(
diff --git a/web/features/agent-v2/agent-detail/logs/components/logs-table.tsx b/web/features/agent-v2/agent-detail/logs/components/logs-table.tsx
index 83fe09ee1cc..efde1317f98 100644
--- a/web/features/agent-v2/agent-detail/logs/components/logs-table.tsx
+++ b/web/features/agent-v2/agent-detail/logs/components/logs-table.tsx
@@ -37,7 +37,7 @@ export function AgentLogsTable({
onOpenLog: (log: AgentLogConversationItemResponse) => void
onRetry: () => void
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const tableHeaderLabels = {
unread: t(($) => $['agentDetail.logs.table.unread']),
title: t(($) => $['agentDetail.logs.table.title']),
@@ -107,8 +107,8 @@ function AgentLogsTableBody({
onOpenLog: (log: AgentLogConversationItemResponse) => void
onRetry: () => void
}) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const { formatTime } = useTimestamp()
const notAvailable = t(($) => $['agentDetail.logs.notAvailable'])
const formatLogTime = (value?: number | null) =>
diff --git a/web/features/agent-v2/agent-detail/logs/components/source-cell.tsx b/web/features/agent-v2/agent-detail/logs/components/source-cell.tsx
index 119bc5a4d2e..d1ca1ddad04 100644
--- a/web/features/agent-v2/agent-detail/logs/components/source-cell.tsx
+++ b/web/features/agent-v2/agent-detail/logs/components/source-cell.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
import { LogSourceIcon } from './source-icon'
export function LogSourceCell({ source }: { source?: AgentLogConversationItemResponse['source'] }) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
if (!source) {
return (
diff --git a/web/features/agent-v2/agent-detail/logs/components/source-picker.tsx b/web/features/agent-v2/agent-detail/logs/components/source-picker.tsx
index 3f9fd92ebd8..81d08706451 100644
--- a/web/features/agent-v2/agent-detail/logs/components/source-picker.tsx
+++ b/web/features/agent-v2/agent-detail/logs/components/source-picker.tsx
@@ -30,7 +30,7 @@ import { LogSourceIcon } from './source-icon'
export type SourceFilterValue = AgentLogSourceResponse['id'][]
-const getSourceGroupLabel = (group: AgentLogSourceGroupResponse, t: TFunction<'agentV2'>) => {
+const getSourceGroupLabel = (group: AgentLogSourceGroupResponse, t: TFunction<['agentV2']>) => {
if (group.type === 'webapp') return t(($) => $['agentDetail.logs.filters.source.webapp'])
if (group.type === 'workflow') return t(($) => $['agentDetail.logs.filters.source.workflow'])
return group.label
@@ -57,8 +57,8 @@ export function AgentLogSourcePicker({
onRetry: () => void
onChange: (value: SourceFilterValue) => void
}) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2', 'common'])
+ const { t: tCommon } = useTranslation(['common'])
const [inputValue, setInputValue] = useState('')
const sourceGroups = useMemo<AgentLogSourceComboboxGroup[]>(
() => groups.map(({ sources, ...group }) => ({ ...group, items: sources ?? [] })),
diff --git a/web/features/agent-v2/agent-detail/logs/page.tsx b/web/features/agent-v2/agent-detail/logs/page.tsx
index 449ad6de189..3abf0ec3139 100644
--- a/web/features/agent-v2/agent-detail/logs/page.tsx
+++ b/web/features/agent-v2/agent-detail/logs/page.tsx
@@ -68,8 +68,8 @@ const parseSortValue = (value: string): AgentLogsSort => {
}
export function AgentLogsPage({ agentId }: AgentLogsPageProps) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const docLink = useDocLink()
const media = useBreakpoints()
const isMobile = media === MediaType.mobile
diff --git a/web/features/agent-v2/agent-detail/monitoring/chart.tsx b/web/features/agent-v2/agent-detail/monitoring/chart.tsx
index 1a92b7cb3a9..b13ab550245 100644
--- a/web/features/agent-v2/agent-detail/monitoring/chart.tsx
+++ b/web/features/agent-v2/agent-detail/monitoring/chart.tsx
@@ -35,7 +35,7 @@ export function AgentMonitoringChart({
}: AgentMonitoringChartProps) {
const titleId = useId()
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const yField = getChartValueField(rows, valueKey)
const tokenSummary = getTokenSummary(rows)
const shouldUseEmptyYAxis = !hasChartData(rows, yField)
diff --git a/web/features/agent-v2/agent-detail/monitoring/page.tsx b/web/features/agent-v2/agent-detail/monitoring/page.tsx
index 5ebbc0b7c2b..d8cd835c65f 100644
--- a/web/features/agent-v2/agent-detail/monitoring/page.tsx
+++ b/web/features/agent-v2/agent-detail/monitoring/page.tsx
@@ -53,8 +53,8 @@ const getDefaultPeriodQuery = () => {
}
export function AgentMonitoringPage({ agentId }: AgentMonitoringPageProps) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const [period, setPeriod] = useState(() => ({
name: t(($) => $['agentDetail.monitoring.timeRanges.today']),
query: getDefaultPeriodQuery(),
@@ -187,7 +187,7 @@ function AgentMonitoringSourceFilter({
onSelect: (item: SourceFilterItem) => void
onClear: () => void
}) {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const selectedItem = items.find((item) => Object.is(item.value, value))
const selectedName = selectedItem?.name ?? ''
const triggerLabel = selectedName ? `${label} ${selectedName}` : label
diff --git a/web/features/agent-v2/agent-detail/monitoring/time-range-picker.tsx b/web/features/agent-v2/agent-detail/monitoring/time-range-picker.tsx
index 1e0e86df5a8..4b057fa56b8 100644
--- a/web/features/agent-v2/agent-detail/monitoring/time-range-picker.tsx
+++ b/web/features/agent-v2/agent-detail/monitoring/time-range-picker.tsx
@@ -140,7 +140,7 @@ export function AgentMonitoringTimeRangePicker({
value,
onChange,
}: AgentMonitoringTimeRangePickerProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const locale = useLocale()
const [selectedRange, setSelectedRange] = useState<TimeRangeKey | 'custom'>('today')
const [start, setStart] = useState(() => dayjs(value.query.start))
diff --git a/web/features/agent-v2/agent-detail/navigation.tsx b/web/features/agent-v2/agent-detail/navigation.tsx
index dfea799b107..2228e3aa57b 100644
--- a/web/features/agent-v2/agent-detail/navigation.tsx
+++ b/web/features/agent-v2/agent-detail/navigation.tsx
@@ -78,8 +78,8 @@ const getAgentDetailNavigation = (agentId: string): AgentDetailNavItem[] => [
]
export function AgentDetailTop({ expand = true, onToggle }: AgentDetailTopProps) {
- const { t: tApp } = useTranslation('app')
- const { t: tCommon } = useTranslation('common')
+ const { t: tApp } = useTranslation(['app'])
+ const { t: tCommon } = useTranslation(['common', 'agentV2'])
if (!expand) {
return (
@@ -165,7 +165,7 @@ export function AgentDetailTop({ expand = true, onToggle }: AgentDetailTopProps)
}
export function AgentDetailSection({ expand = true }: AgentDetailSectionProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const pathname = usePathname()
const agentId = getAgentIdFromPathname(pathname)
const { agentQuery, ...capabilities } = useAgentPermissions(agentId)
diff --git a/web/features/agent-v2/agent-detail/sidebar-actions.tsx b/web/features/agent-v2/agent-detail/sidebar-actions.tsx
index 434f5e95a39..3ad93f68d03 100644
--- a/web/features/agent-v2/agent-detail/sidebar-actions.tsx
+++ b/web/features/agent-v2/agent-detail/sidebar-actions.tsx
@@ -25,9 +25,9 @@ type AgentDetailSidebarActionAgent = AgentFormSource &
Pick<AgentAppPartial, 'app_id' | 'permission_keys'>
export function AgentDetailSidebarActions({ agent }: { agent: AgentDetailSidebarActionAgent }) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
- const { t: tApp } = useTranslation('app')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
+ const { t: tApp } = useTranslation(['app'])
const [isEditOpen, setIsEditOpen] = useState(false)
const [isDuplicateOpen, setIsDuplicateOpen] = useState(false)
const [isDeleteOpen, setIsDeleteOpen] = useState(false)
diff --git a/web/features/agent-v2/roster/components/agent-form-fields.tsx b/web/features/agent-v2/roster/components/agent-form-fields.tsx
index 7203f173256..37a48f6b1d9 100644
--- a/web/features/agent-v2/roster/components/agent-form-fields.tsx
+++ b/web/features/agent-v2/roster/components/agent-form-fields.tsx
@@ -21,8 +21,8 @@ export function AgentFormFields({
onIconClick,
ref,
}: AgentFormFieldsProps) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
return (
<div className="min-h-0 flex-1 space-y-5 overflow-y-auto overscroll-contain px-6 py-3">
diff --git a/web/features/agent-v2/roster/components/agent-roster-list.tsx b/web/features/agent-v2/roster/components/agent-roster-list.tsx
index 4fb13df3756..311fc27620b 100644
--- a/web/features/agent-v2/roster/components/agent-roster-list.tsx
+++ b/web/features/agent-v2/roster/components/agent-roster-list.tsx
@@ -67,7 +67,7 @@ const emptyPlaceholderCardIds = Array.from(
)
function AgentRosterSkeleton() {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
return (
<>
@@ -111,7 +111,7 @@ function AgentRosterPlaceholderState({
role?: 'alert' | 'status'
title: string
}) {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
return (
<div
@@ -171,9 +171,9 @@ function AgentCardActionMenuItems({
onEdit,
onExport,
}: AgentCardActionMenuItemsProps) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
- const { t: tApp } = useTranslation('app')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
+ const { t: tApp } = useTranslation(['app'])
const MenuItem = kind === 'context' ? ContextMenuItem : DropdownMenuItem
const MenuSeparator = kind === 'context' ? ContextMenuSeparator : DropdownMenuSeparator
@@ -209,8 +209,8 @@ function AgentCardActionMenuItems({
}
function AgentRosterItem({ agent }: { agent: AgentAppPartial }) {
- const { t } = useTranslation('agentV2')
- const { t: tApp } = useTranslation('app')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tApp } = useTranslation(['app'])
const { formatTime } = useTimestamp()
const nameId = useId()
const descriptionId = useId()
@@ -443,8 +443,8 @@ function AgentRosterItem({ agent }: { agent: AgentAppPartial }) {
}
export function AgentRosterList({ label, state }: AgentRosterListProps) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const isBusy = state.status === 'pending' || (state.status === 'ready' && state.isFetching)
return (
diff --git a/web/features/agent-v2/roster/components/agent-workflow-references-dropdown.tsx b/web/features/agent-v2/roster/components/agent-workflow-references-dropdown.tsx
index f040eac268f..2842f931125 100644
--- a/web/features/agent-v2/roster/components/agent-workflow-references-dropdown.tsx
+++ b/web/features/agent-v2/roster/components/agent-workflow-references-dropdown.tsx
@@ -36,7 +36,7 @@ export function AgentWorkflowReferencesDropdown({
publishedReferences: AgentAppPublishedReferenceResponse[]
referenceCount: number
}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
return (
<DropdownMenu modal={false}>
diff --git a/web/features/agent-v2/roster/components/create-agent-dialog.tsx b/web/features/agent-v2/roster/components/create-agent-dialog.tsx
index f3b06ee126a..3b1ecc79bae 100644
--- a/web/features/agent-v2/roster/components/create-agent-dialog.tsx
+++ b/web/features/agent-v2/roster/components/create-agent-dialog.tsx
@@ -49,8 +49,8 @@ function CreateAgentFormSession({
onCancel,
onSubmit,
}: CreateAgentFormSessionProps) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const [agentIcon, setAgentIcon] = useState<AgentIconSelection>(defaultAgentIcon)
const [iconPickerOpen, setIconPickerOpen] = useState(false)
@@ -99,7 +99,7 @@ function CreateAgentFormSession({
}
export function CreateAgentDialog({ open, onOpenChange }: CreateAgentDialogProps = {}) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2', 'common'])
const router = useRouter()
const [uncontrolledOpen, setUncontrolledOpen] = useState(false)
const nameInputRef = useRef<HTMLInputElement>(null)
diff --git a/web/features/agent-v2/roster/components/delete-agent-dialog.tsx b/web/features/agent-v2/roster/components/delete-agent-dialog.tsx
index 2dc67992da9..6cd4c14ed77 100644
--- a/web/features/agent-v2/roster/components/delete-agent-dialog.tsx
+++ b/web/features/agent-v2/roster/components/delete-agent-dialog.tsx
@@ -29,8 +29,8 @@ export function DeleteAgentDialog({
onOpenChange,
onDeleted,
}: DeleteAgentDialogProps) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const deleteAgentMutation = useMutation(consoleQuery.agent.byAgentId.delete.mutationOptions())
const handleDelete = () => {
diff --git a/web/features/agent-v2/roster/components/duplicate-agent-dialog.tsx b/web/features/agent-v2/roster/components/duplicate-agent-dialog.tsx
index 53d9469068b..f21899508a6 100644
--- a/web/features/agent-v2/roster/components/duplicate-agent-dialog.tsx
+++ b/web/features/agent-v2/roster/components/duplicate-agent-dialog.tsx
@@ -47,8 +47,8 @@ function DuplicateAgentFormSession({
onCancel,
onSubmit,
}: DuplicateAgentFormSessionProps) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const [initialValues] = useState(() => ({
fields: {
description: agent.description ?? '',
@@ -110,7 +110,7 @@ function DuplicateAgentFormSession({
}
export function DuplicateAgentDialog({ agent, open, onOpenChange }: DuplicateAgentDialogProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2', 'common'])
const queryClient = useQueryClient()
const latestAgent =
queryClient.getQueryData<AgentFormSource>(
diff --git a/web/features/agent-v2/roster/components/edit-agent-dialog.tsx b/web/features/agent-v2/roster/components/edit-agent-dialog.tsx
index 75467f043dc..0e436e42713 100644
--- a/web/features/agent-v2/roster/components/edit-agent-dialog.tsx
+++ b/web/features/agent-v2/roster/components/edit-agent-dialog.tsx
@@ -54,8 +54,8 @@ function EditAgentFormSession({
onCancel,
onSubmit,
}: EditAgentFormSessionProps) {
- const { t } = useTranslation('agentV2')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['agentV2'])
+ const { t: tCommon } = useTranslation(['common'])
const [initialValues] = useState(() => ({
fields: {
description: agent.description ?? '',
@@ -134,7 +134,7 @@ function EditAgentFormSession({
}
export function EditAgentDialog({ agent, open, onOpenChange }: EditAgentDialogProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2', 'common'])
const nameInputRef = useRef<HTMLInputElement>(null)
const updateAgentMutation = useMutation(consoleQuery.agent.byAgentId.put.mutationOptions())
diff --git a/web/features/agent-v2/roster/components/roster-sort-select.tsx b/web/features/agent-v2/roster/components/roster-sort-select.tsx
index 51aa03626eb..6d8b8d90eb9 100644
--- a/web/features/agent-v2/roster/components/roster-sort-select.tsx
+++ b/web/features/agent-v2/roster/components/roster-sort-select.tsx
@@ -14,7 +14,7 @@ import { rosterQueryParamNames, rosterSortByQueryParser } from '../query-params'
import { DEFAULT_ROSTER_SORT_BY, rosterSortOptions } from './roster-sort'
export function RosterSortSelect() {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const [value, setValue] = useQueryState(rosterQueryParamNames.sortBy, rosterSortByQueryParser)
const selectedOption =
rosterSortOptions.find((option) => option.value === value) ??
diff --git a/web/features/agent-v2/roster/components/roster-toolbar.tsx b/web/features/agent-v2/roster/components/roster-toolbar.tsx
index 73ee69b0e83..7d6bd5d4561 100644
--- a/web/features/agent-v2/roster/components/roster-toolbar.tsx
+++ b/web/features/agent-v2/roster/components/roster-toolbar.tsx
@@ -40,7 +40,7 @@ function RosterFilterItem({ count, label, value }: RosterFilterItemProps) {
}
function RosterStatusFilter({ publicationCounts }: RosterToolbarProps) {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const [filter, setFilter] = useQueryState(rosterQueryParamNames.filter, rosterFilterQueryParser)
return (
@@ -66,7 +66,7 @@ function RosterStatusFilter({ publicationCounts }: RosterToolbarProps) {
}
function RosterSearchFilter() {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const [keyword, setKeyword] = useQueryState(
rosterQueryParamNames.keyword,
rosterKeywordQueryParser,
@@ -86,7 +86,7 @@ function RosterSearchFilter() {
}
function RosterCreatedByMeFilter() {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const [createdByMe, setCreatedByMe] = useQueryState(
rosterQueryParamNames.createdByMe,
rosterCreatedByMeQueryParser,
diff --git a/web/features/agent-v2/roster/page.tsx b/web/features/agent-v2/roster/page.tsx
index 2cb68dab21c..9d37c6e91d1 100644
--- a/web/features/agent-v2/roster/page.tsx
+++ b/web/features/agent-v2/roster/page.tsx
@@ -34,7 +34,7 @@ const EMPTY_PUBLICATION_COUNTS: AgentPublicationCountsResponse = {
}
export default function RosterPage() {
- const { t } = useTranslation('agentV2')
+ const { t } = useTranslation(['agentV2'])
const docLink = useDocLink()
const [keyword] = useQueryState(rosterQueryParamNames.keyword, rosterKeywordQueryParser)
const [rosterFilter] = useQueryState(rosterQueryParamNames.filter, rosterFilterQueryParser)
diff --git a/web/features/home/banner/banner.tsx b/web/features/home/banner/banner.tsx
index e675ffa425a..32c1878eab4 100644
--- a/web/features/home/banner/banner.tsx
+++ b/web/features/home/banner/banner.tsx
@@ -77,7 +77,7 @@ function BannerCarouselContent({
onRotationControlPointerDown,
onApiChange,
}: BannerCarouselContentProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common', 'explore'])
const { api, selectedIndex } = useCarousel()
const trackedBannerKeysRef = useRefWithInit(() => new Set<string>())
const nextIndex = (selectedIndex + 1) % banners.length
@@ -206,7 +206,7 @@ type BannerProps = {
}
export function Banner({ banners }: BannerProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['explore'])
const locale = useLocale()
const { data: userProfile } = useSuspenseQuery({
...userProfileQueryOptions(),
diff --git a/web/features/home/continue-work/continue-work.tsx b/web/features/home/continue-work/continue-work.tsx
index 486065bcd75..94565ff3286 100644
--- a/web/features/home/continue-work/continue-work.tsx
+++ b/web/features/home/continue-work/continue-work.tsx
@@ -13,7 +13,7 @@ type ContinueWorkProps = {
}
export function ContinueWork({ apps, className }: ContinueWorkProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['explore'])
if (apps.length === 0) return null
diff --git a/web/features/home/continue-work/item.tsx b/web/features/home/continue-work/item.tsx
index 2f5167ec18a..5b291f3e51c 100644
--- a/web/features/home/continue-work/item.tsx
+++ b/web/features/home/continue-work/item.tsx
@@ -30,7 +30,7 @@ type ContinueWorkItemProps = {
}
export function ContinueWorkItem({ app }: ContinueWorkItemProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app', 'explore'])
const { formatTimeFromNow } = useFormatTimeFromNow()
const { data: currentUserId } = useSuspenseQuery({
...userProfileQueryOptions(),
diff --git a/web/features/home/home-content/home-content.tsx b/web/features/home/home-content/home-content.tsx
index 65ffe689b61..4314a1dbe44 100644
--- a/web/features/home/home-content/home-content.tsx
+++ b/web/features/home/home-content/home-content.tsx
@@ -53,7 +53,7 @@ const DSLConfirmModal = dynamic(
const HOME_STEP_BY_STEP_TOUR_TASK_ID = 'home' satisfies StepByStepTourTaskId
export function HomeContent() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['explore'])
const locale = useLocale()
const queryClient = useQueryClient()
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
diff --git a/web/features/home/home-content/templates-header.tsx b/web/features/home/home-content/templates-header.tsx
index 5e8b65fb228..b091a7179ac 100644
--- a/web/features/home/home-content/templates-header.tsx
+++ b/web/features/home/home-content/templates-header.tsx
@@ -19,7 +19,7 @@ export function HomeTemplatesHeader({
onCategoryChange: (category: string) => void
onKeywordsChange: (keywords: string) => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['explore'])
return (
<div className="sticky top-0 z-10 bg-background-body">
diff --git a/web/features/home/home-intro.tsx b/web/features/home/home-intro.tsx
index beb754f9945..ca3e6380512 100644
--- a/web/features/home/home-intro.tsx
+++ b/web/features/home/home-intro.tsx
@@ -15,7 +15,7 @@ export function HomeIntroSkeleton() {
}
export function HomeIntro() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['explore'])
const { data: userProfile } = useSuspenseQuery({
...userProfileQueryOptions(),
select: (data) => data.profile,
diff --git a/web/features/home/home-skeleton.tsx b/web/features/home/home-skeleton.tsx
index ea83ed4d568..10fdd983ceb 100644
--- a/web/features/home/home-skeleton.tsx
+++ b/web/features/home/home-skeleton.tsx
@@ -103,7 +103,7 @@ function HomeBannerSkeleton() {
}
export function HomeSkeleton({ showBanner }: { showBanner: boolean }) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div role="status" aria-label={t(($) => $.loading, { ns: 'common' })} className="contents">
diff --git a/web/features/home/template-card.tsx b/web/features/home/template-card.tsx
index 182572b7a1e..16c344261a6 100644
--- a/web/features/home/template-card.tsx
+++ b/web/features/home/template-card.tsx
@@ -18,7 +18,7 @@ type TemplateCardProps = {
}
export function TemplateCard({ app, canCreate, onCreate, onTry }: TemplateCardProps) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const { data: deploymentEdition } = useSuspenseQuery({
...systemFeaturesQueryOptions(),
select: ({ deployment_edition }) => deployment_edition,
diff --git a/web/features/new-rag/add-source-page.tsx b/web/features/new-rag/add-source-page.tsx
index 217f94b6d58..16cafdeddd4 100644
--- a/web/features/new-rag/add-source-page.tsx
+++ b/web/features/new-rag/add-source-page.tsx
@@ -124,7 +124,7 @@ function SourceTypeSelector({
value: SourceType
onChange: (value: SourceType) => void
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const options = [
{ icon: 'i-ri-global-line', key: 'websiteCrawl' as const },
{ icon: 'i-ri-file-text-line', key: 'onlineDocuments' as const },
@@ -171,7 +171,7 @@ function ProviderSelector({
provider: NewKnowledgeWebsiteProvider
onChange: (provider: NewKnowledgeWebsiteProvider) => void
}) {
- const { t } = useTranslation('datasetCreation')
+ const { t } = useTranslation(['datasetCreation'])
return (
<fieldset>
@@ -215,7 +215,7 @@ function ProviderFieldControl({
setValues: React.Dispatch<React.SetStateAction<Record<string, string>>>
values: Record<string, string>
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const generatedId = useId()
const inputId = `${generatedId}-input`
const descriptionId = field.description ? `${generatedId}-description` : undefined
@@ -283,7 +283,7 @@ function ConnectionForm({
onReconcile: () => Promise<Connection | undefined>
provider: Provider
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const connectButtonLabelId = useId()
const supportedAuthKinds = getSupportedAuthKinds(provider)
const [authKind, setAuthKind] = useState<ConnectionAuthKind>(supportedAuthKinds[0] ?? 'api-key')
@@ -445,7 +445,7 @@ function UnconfiguredProvider({
onReconcile: () => Promise<Connection | undefined>
provider: Provider
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const [configuring, setConfiguring] = useState(false)
if (configuring)
@@ -494,8 +494,8 @@ function ConnectionProblem({
onConnected: (connection: Connection) => void
onReconcile: () => Promise<Connection | undefined>
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const refreshButtonLabelId = useId()
const [pending, setPending] = useState(false)
const [error, setError] = useState(false)
@@ -560,7 +560,7 @@ function ProvisioningConnection({
}: {
onReconcile: () => Promise<Connection | undefined>
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const [pending, setPending] = useState(false)
const [error, setError] = useState(false)
@@ -606,7 +606,7 @@ export function AddSourcePage({
knowledgeSpaceId: string
sourceDraftKey?: string
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const router = useRouter()
const queryClient = useQueryClient()
const initialDraftRef = useRefWithInit<NewKnowledgeSourceDraft>(
diff --git a/web/features/new-rag/add-source-placeholder.tsx b/web/features/new-rag/add-source-placeholder.tsx
index f877e11d529..30fa9b16a6c 100644
--- a/web/features/new-rag/add-source-placeholder.tsx
+++ b/web/features/new-rag/add-source-placeholder.tsx
@@ -38,7 +38,7 @@ export function PendingWebsiteSetup({
draft: NewKnowledgeWebsiteSourceDraft
onDraftChange: (draft: NewKnowledgeWebsiteSourceDraft) => void
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const [optionsExpanded, setOptionsExpanded] = useState(false)
const [backendBoundaryVisible, setBackendBoundaryVisible] = useState(false)
const updateDraft = (nextDraft: NewKnowledgeWebsiteSourceDraft) => {
@@ -167,8 +167,8 @@ export function UnavailableConnectedSourceSetup({
draft: NewKnowledgeOnlineDocumentsSourceDraft | NewKnowledgeOnlineDriveSourceDraft
onDraftChange: (draft: NewKnowledgeSourceDraft) => void
}) {
- const { t } = useTranslation('dataset')
- const { t: tCreation } = useTranslation('datasetCreation')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCreation } = useTranslation(['datasetCreation'])
const sourceType = draft.sourceType
const providers = connectedProviders[sourceType]
const activeProvider = draft.provider
diff --git a/web/features/new-rag/components/add-source-exit-dialog.tsx b/web/features/new-rag/components/add-source-exit-dialog.tsx
index 036ff4298d1..07ee50ecc57 100644
--- a/web/features/new-rag/components/add-source-exit-dialog.tsx
+++ b/web/features/new-rag/components/add-source-exit-dialog.tsx
@@ -24,8 +24,8 @@ export function AddSourceExitDialog({
onConfirm: () => void
open: boolean
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
return (
<AlertDialog
diff --git a/web/features/new-rag/components/create-knowledge-dialog-parts.tsx b/web/features/new-rag/components/create-knowledge-dialog-parts.tsx
index 7d9f18f9ec4..798eef12441 100644
--- a/web/features/new-rag/components/create-knowledge-dialog-parts.tsx
+++ b/web/features/new-rag/components/create-knowledge-dialog-parts.tsx
@@ -24,7 +24,7 @@ export function StartMode({
title: string
value: NewKnowledgeStartMode
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const titleId = useId()
const descriptionId = useId()
const unavailableId = useId()
diff --git a/web/features/new-rag/components/create-knowledge-exit-dialog.tsx b/web/features/new-rag/components/create-knowledge-exit-dialog.tsx
index 4c346425fe2..991c0fd6528 100644
--- a/web/features/new-rag/components/create-knowledge-exit-dialog.tsx
+++ b/web/features/new-rag/components/create-knowledge-exit-dialog.tsx
@@ -22,8 +22,8 @@ export function CreateKnowledgeExitDialog({
onConfirm: () => void
reason: CreateKnowledgeExitReason | null
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const isPartial = reason === 'partial'
return (
diff --git a/web/features/new-rag/components/knowledge-space-card.tsx b/web/features/new-rag/components/knowledge-space-card.tsx
index d3f32d992ca..e59eb1e8be0 100644
--- a/web/features/new-rag/components/knowledge-space-card.tsx
+++ b/web/features/new-rag/components/knowledge-space-card.tsx
@@ -9,7 +9,7 @@ function getBuiltinIconName(iconRef: string | undefined) {
}
export function KnowledgeSpaceCard({ knowledgeSpace }: { knowledgeSpace: KnowledgeSpace }) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const { formatTimeFromNow } = useFormatTimeFromNow()
const unavailable = t(($) => $['cornerLabel.unavailable'])
const iconName = getBuiltinIconName(knowledgeSpace.iconRef)
diff --git a/web/features/new-rag/components/knowledge-view-switcher.tsx b/web/features/new-rag/components/knowledge-view-switcher.tsx
index 9a16a321b4e..aa01ca541e9 100644
--- a/web/features/new-rag/components/knowledge-view-switcher.tsx
+++ b/web/features/new-rag/components/knowledge-view-switcher.tsx
@@ -21,7 +21,7 @@ export type KnowledgeViewSwitcherProps = {
}
export function KnowledgeViewSwitcher({ value, onChange }: KnowledgeViewSwitcherProps) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const docLink = useDocLink()
const guideDismissed = useNewKnowledgeGuideDismissedValue()
const setGuideDismissed = useSetNewKnowledgeGuideDismissed()
diff --git a/web/features/new-rag/components/new-knowledge-list-states.tsx b/web/features/new-rag/components/new-knowledge-list-states.tsx
index 990f789502b..12233c1bf61 100644
--- a/web/features/new-rag/components/new-knowledge-list-states.tsx
+++ b/web/features/new-rag/components/new-knowledge-list-states.tsx
@@ -26,7 +26,7 @@ export const KNOWLEDGE_SPACE_GRID_CLASS_NAME =
'grid grid-cols-[repeat(auto-fill,minmax(min(100%,280px),1fr))] gap-2.5'
export function NewKnowledgeLoadingState() {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
return (
<div className={KNOWLEDGE_SPACE_GRID_CLASS_NAME} role="status" aria-label={t(($) => $.loading)}>
@@ -86,7 +86,7 @@ function EmptyAction({
recommended?: boolean
title: string
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const unavailable = t(($) => $['cornerLabel.unavailable'])
const recommendedLabel = t(($) => $['firstEmpty.recommended'])
const descriptionId = useId()
@@ -210,7 +210,7 @@ export function NewKnowledgeEmptyState({
canConnect: boolean
canCreate: boolean
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const canStart = canCreate
return (
diff --git a/web/features/new-rag/crawl-selection-form.tsx b/web/features/new-rag/crawl-selection-form.tsx
index 58ac95c344d..42ac7aa484a 100644
--- a/web/features/new-rag/crawl-selection-form.tsx
+++ b/web/features/new-rag/crawl-selection-form.tsx
@@ -143,7 +143,7 @@ function initialSyncPolicy(source: Source): SyncPolicy | undefined {
}
function PolicyLoading() {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
return (
<div
role="status"
@@ -192,7 +192,7 @@ function ReadyCrawlSelectionForm({
source: Source
workflowUncertain: boolean
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const router = useRouter()
const queryClient = useQueryClient()
const customIntervalErrorId = 'crawl-custom-interval-error'
@@ -601,7 +601,7 @@ export function CrawlSelectionForm({
source: Source
workflowUncertain?: boolean
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const policyQuery = useQuery(
consoleQuery.knowledgeFs.getKnowledgeSpacesByIdSourcesBySourceIdSyncPolicy.queryOptions({
context: { silent: true },
diff --git a/web/features/new-rag/create-knowledge-page.tsx b/web/features/new-rag/create-knowledge-page.tsx
index 17062ce875d..32d5bf88c80 100644
--- a/web/features/new-rag/create-knowledge-page.tsx
+++ b/web/features/new-rag/create-knowledge-page.tsx
@@ -82,8 +82,8 @@ async function uploadCreatedDocuments(knowledgeSpaceId: string, files: File[]) {
}
export function CreateKnowledgePage() {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
useDocumentTitle(t(($) => $['newKnowledge.createTitle']))
const router = useRouter()
const searchParams = useSearchParams()
diff --git a/web/features/new-rag/create-source-setup.tsx b/web/features/new-rag/create-source-setup.tsx
index d573329a702..eea265364bb 100644
--- a/web/features/new-rag/create-source-setup.tsx
+++ b/web/features/new-rag/create-source-setup.tsx
@@ -49,7 +49,7 @@ function ConnectedSourceConfiguration({
draft: NewKnowledgeSourceDraft
onDraftChange: (draft: NewKnowledgeSourceDraft) => void
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
return (
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
@@ -107,8 +107,8 @@ export function CreateSourceSetup({
onDraftChange: (draft: NewKnowledgeSourceDraft) => void
onSourceTypeChange: (sourceType: NewKnowledgeSourceDraft['sourceType']) => void
}) {
- const { t } = useTranslation('dataset')
- const { t: tCreation } = useTranslation('datasetCreation')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCreation } = useTranslation(['datasetCreation'])
const [optionsExpanded, setOptionsExpanded] = useState(false)
const [backendBoundaryVisible, setBackendBoundaryVisible] = useState(false)
const sourceType = draft.sourceType
diff --git a/web/features/new-rag/create-upload-queue.tsx b/web/features/new-rag/create-upload-queue.tsx
index 9a2523fc230..7dfdbe68ea8 100644
--- a/web/features/new-rag/create-upload-queue.tsx
+++ b/web/features/new-rag/create-upload-queue.tsx
@@ -62,8 +62,8 @@ export function CreateUploadQueue({
uploads: QueuedUpload[]
onChange: (uploads: QueuedUpload[]) => void
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const inputId = useId()
const [dragging, setDragging] = useState(false)
const previewUnavailable = uploads.some(
diff --git a/web/features/new-rag/document-chunk-detail.tsx b/web/features/new-rag/document-chunk-detail.tsx
index 2331d01deaa..e2748dbeba1 100644
--- a/web/features/new-rag/document-chunk-detail.tsx
+++ b/web/features/new-rag/document-chunk-detail.tsx
@@ -55,8 +55,8 @@ export function DocumentChunkDetail({
revision?: Exclude<LogicalDocumentRevision, null>
selectedChunkId?: string
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const selectedChunk = useMemo(
() => chunks.find((chunk) => chunk.id === selectedChunkId) ?? chunks[0],
[chunks, selectedChunkId],
diff --git a/web/features/new-rag/document-chunk-tree.tsx b/web/features/new-rag/document-chunk-tree.tsx
index 364ccf636af..3e8404d8efa 100644
--- a/web/features/new-rag/document-chunk-tree.tsx
+++ b/web/features/new-rag/document-chunk-tree.tsx
@@ -38,8 +38,8 @@ export function DocumentChunkTreePanel({
selectedChunkId?: string
tree: DocumentChunkTree
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const treeHeadingId = useId()
const loadMoreLabelId = useId()
const [collapsedChunkIds, setCollapsedChunkIds] = useState<Set<string>>(() => new Set())
diff --git a/web/features/new-rag/document-detail-header.tsx b/web/features/new-rag/document-detail-header.tsx
index 701dc2a2f1e..14ed8c2a37b 100644
--- a/web/features/new-rag/document-detail-header.tsx
+++ b/web/features/new-rag/document-detail-header.tsx
@@ -48,8 +48,8 @@ export function DocumentDetailHeader({
revisions: Array<Exclude<LogicalDocumentRevision, null>>
titleRef: RefObject<HTMLHeadingElement | null>
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const revisionTriggerRef = useRef<HTMLButtonElement>(null)
const loadMoreRevisionLabelId = useId()
const loadMoreRequestedRef = useRef(false)
diff --git a/web/features/new-rag/document-detail-page.tsx b/web/features/new-rag/document-detail-page.tsx
index 8e6456b42cf..14c58b2308f 100644
--- a/web/features/new-rag/document-detail-page.tsx
+++ b/web/features/new-rag/document-detail-page.tsx
@@ -37,7 +37,7 @@ function ErrorState({
onRetry?: () => void
title: string
}) {
- const { t: tCommon } = useTranslation('common')
+ const { t: tCommon } = useTranslation(['common'])
return (
<div className="flex min-h-80 flex-col items-center justify-center px-6 text-center">
<span aria-hidden className="i-ri-error-warning-line size-8 text-text-destructive" />
@@ -59,8 +59,8 @@ export function DocumentDetailPage({
documentId: string
knowledgeSpaceId: string
}) {
- const { i18n, t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { i18n, t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const permissionKeys = useAtomValue(datasetDefaultPermissionKeysAtom)
const [selectedRevision, setSelectedRevision] = useQueryState('revision', documentRevisionParser)
const titleRef = useRef<HTMLHeadingElement>(null)
diff --git a/web/features/new-rag/document-detail-status.tsx b/web/features/new-rag/document-detail-status.tsx
index 2a02459a776..723fc13283e 100644
--- a/web/features/new-rag/document-detail-status.tsx
+++ b/web/features/new-rag/document-detail-status.tsx
@@ -45,8 +45,8 @@ export function DocumentDetailStatus({
tasksError: boolean
titleRef: RefObject<HTMLHeadingElement | null>
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const permissionRetryRef = useRef<HTMLButtonElement>(null)
const permissionRecoveryWasNeededRef = useRef(false)
const pendingRecoveryActionRef = useRef<'check' | 'retry' | null>(null)
diff --git a/web/features/new-rag/document-list.tsx b/web/features/new-rag/document-list.tsx
index e6b72e7edda..f0bef7f13ed 100644
--- a/web/features/new-rag/document-list.tsx
+++ b/web/features/new-rag/document-list.tsx
@@ -49,7 +49,7 @@ function TaskTrigger({
tasksButtonLabel: string
tasksLiveStatus: string
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
return (
<>
<Button aria-label={tasksButtonLabel} data-has-error={hasTaskError} onClick={onOpenTasks}>
@@ -109,8 +109,8 @@ const DocumentRow = memo(
status: DocumentDisplayStatus
statusPending: boolean
}) => {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const titleId = `new-document-${document.id}`
const revision = document.activeRevision ?? document.active?.revision
const updatedTime = Date.parse(document.updatedAt)
@@ -248,7 +248,7 @@ export function DocumentsEmpty({
tasksLiveStatus: string
uploading: boolean
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const tasksVisible = activeTaskCount > 0 || Boolean(attentionTaskBadge) || hasTaskError
return (
@@ -377,8 +377,8 @@ export function DocumentsList({
tasksLiveStatus: string
uploading: boolean
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const { formatTimeFromNow } = useFormatTimeFromNow()
const [visibleDocumentLimit, setVisibleDocumentLimit] = useState(DOCUMENT_RENDER_BATCH_SIZE)
const loadMoreButtonRef = useRef<HTMLButtonElement>(null)
@@ -643,7 +643,7 @@ export function DocumentBulkActions({
reindexing: boolean
selectedCount: number
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
return (
<div className="pointer-events-none fixed inset-x-0 bottom-[calc(1.75rem+env(safe-area-inset-bottom,0px))] z-20 flex justify-center pr-[calc(1rem+env(safe-area-inset-right,0px))] pl-[calc(1rem+env(safe-area-inset-left,0px))]">
<div
diff --git a/web/features/new-rag/document-revision-content.tsx b/web/features/new-rag/document-revision-content.tsx
index 20feec08834..504d4bd6c37 100644
--- a/web/features/new-rag/document-revision-content.tsx
+++ b/web/features/new-rag/document-revision-content.tsx
@@ -35,8 +35,8 @@ export function DocumentRevisionContent({
revisionHistoryPending: boolean
retryRevisionHistory: () => void
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
if (effectiveRevision === undefined && revisionHistoryPending)
return (
diff --git a/web/features/new-rag/documents-page.tsx b/web/features/new-rag/documents-page.tsx
index ba1d686a6fe..0c00dd36017 100644
--- a/web/features/new-rag/documents-page.tsx
+++ b/web/features/new-rag/documents-page.tsx
@@ -145,8 +145,8 @@ function normalizedTaskSnapshot(task: DocumentProcessingTask): DocumentProcessin
}
export function DocumentsPage({ knowledgeSpaceId }: { knowledgeSpaceId: string }) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const queryClient = useQueryClient()
const datasetDefaultPermissionKeys = useAtomValue(datasetDefaultPermissionKeysAtom)
const workspacePermissionKeysLoading = useAtomValue(workspacePermissionKeysLoadingAtom)
diff --git a/web/features/new-rag/knowledge-space-shell.tsx b/web/features/new-rag/knowledge-space-shell.tsx
index 84c6f0c6702..2c1707c46f4 100644
--- a/web/features/new-rag/knowledge-space-shell.tsx
+++ b/web/features/new-rag/knowledge-space-shell.tsx
@@ -56,8 +56,8 @@ export function KnowledgeSpaceShell({
children: ReactNode
knowledgeSpaceId: string
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const pathname = usePathname()
const knowledgeSpaceQuery = useQuery({
...consoleQuery.knowledgeFs.getKnowledgeSpacesById.queryOptions({
diff --git a/web/features/new-rag/new-knowledge-list.tsx b/web/features/new-rag/new-knowledge-list.tsx
index 549238700c5..b057e121ce3 100644
--- a/web/features/new-rag/new-knowledge-list.tsx
+++ b/web/features/new-rag/new-knowledge-list.tsx
@@ -56,8 +56,8 @@ export function NewKnowledgeList({
view: 'legacy' | 'new'
onViewChange: (value: 'legacy' | 'new') => void
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const { data: apiBaseInfo } = useDatasetApiBaseUrl()
const [showExternalApiPanel, setShowExternalApiPanel] = useState(false)
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
diff --git a/web/features/new-rag/processing-tasks-drawer.tsx b/web/features/new-rag/processing-tasks-drawer.tsx
index 9a838c30501..3ebb99c1ec4 100644
--- a/web/features/new-rag/processing-tasks-drawer.tsx
+++ b/web/features/new-rag/processing-tasks-drawer.tsx
@@ -142,8 +142,8 @@ export function ProcessingTasksDrawer({
onRetryDocumentQuery: () => void
onRetryTaskQuery: () => void
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const { formatTimeFromNow } = useFormatTimeFromNow()
const cancelTask = useMutation(
consoleQuery.knowledgeFs.deleteKnowledgeSpacesByIdDocumentsByDocumentIdProcessingTasksByTaskId.mutationOptions(),
diff --git a/web/features/new-rag/sources-page.tsx b/web/features/new-rag/sources-page.tsx
index 60fcdc4c2d7..aa7169b306e 100644
--- a/web/features/new-rag/sources-page.tsx
+++ b/web/features/new-rag/sources-page.tsx
@@ -100,8 +100,8 @@ function SourceActions({
pendingAction?: SourceAction
source: Source
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const [removeDialogOpen, setRemoveDialogOpen] = useState(false)
const sourceUri = getOpenableSourceUri(source.uri)
@@ -226,8 +226,8 @@ function SourceRow({
onSourceChange: (source: Source) => void
source: Source
}) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const queryClient = useQueryClient()
const [pendingAction, setPendingAction] = useState<SourceAction>()
const providerName = metadataString(source.metadata, 'providerName')
@@ -402,7 +402,7 @@ function SourcesEmpty({
canAddSource: boolean
knowledgeSpaceId: string
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
return (
<div className="flex min-h-0 flex-1 flex-col items-center justify-center px-6 py-16 text-center">
@@ -437,8 +437,8 @@ function SourcesEmpty({
}
export function SourcesPage({ knowledgeSpaceId }: { knowledgeSpaceId: string }) {
- const { t } = useTranslation('dataset')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['dataset'])
+ const { t: tCommon } = useTranslation(['common'])
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
const canManageSources = hasPermission(workspacePermissionKeys, 'dataset.external.connect')
const [filter, setFilter] = useState<SourceFilter>('all')
diff --git a/web/features/new-rag/use-document-reindex.ts b/web/features/new-rag/use-document-reindex.ts
index 5b9a8f3d611..74e974d2560 100644
--- a/web/features/new-rag/use-document-reindex.ts
+++ b/web/features/new-rag/use-document-reindex.ts
@@ -30,7 +30,7 @@ export function useDocumentReindex({
knowledgeSpaceId: string
revisionsQueryKey: readonly unknown[]
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const queryClient = useQueryClient()
const refreshWorkspacePermissionKeysAfterMutationDenial = useSetAtom(
refreshWorkspacePermissionKeysAfterMutationDenialAtom,
diff --git a/web/features/new-rag/website-crawl-preview.tsx b/web/features/new-rag/website-crawl-preview.tsx
index 3e95a444aa5..f283aba844e 100644
--- a/web/features/new-rag/website-crawl-preview.tsx
+++ b/web/features/new-rag/website-crawl-preview.tsx
@@ -264,7 +264,7 @@ const CrawlPageList = memo(
)
function EmptyPreview() {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
return (
<div className="flex min-h-40 flex-col items-center justify-center rounded-xl border border-dashed border-divider-regular px-6 text-center">
<span className="flex size-10 items-center justify-center rounded-lg bg-background-section">
@@ -293,7 +293,7 @@ export function WebsiteCrawlPreview({
onDraftFinished?: () => void
providerName?: string
}) {
- const { t } = useTranslation('dataset')
+ const { t } = useTranslation(['dataset'])
const router = useRouter()
const rootUrlErrorId = useId()
const primaryActionLabelId = useId()
diff --git a/web/features/skills/detail/builder-panel.tsx b/web/features/skills/detail/builder-panel.tsx
index 11665b76019..171a78aaaa4 100644
--- a/web/features/skills/detail/builder-panel.tsx
+++ b/web/features/skills/detail/builder-panel.tsx
@@ -54,7 +54,7 @@ function isSkillBuilderProgressStage(stage: unknown): stage is SkillBuilderProgr
}
function SkillBuilderProgressStageLabel({ stage }: { stage: SkillBuilderProgressStage }) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
if (stage === 'reading_draft')
return <>{t(($) => $['skillManagement.detail.builder.progress.readingDraft'])}</>
@@ -76,7 +76,7 @@ function BuilderModelSelector({
selectedModel: SkillBuilderModel | undefined
onSelect: (model: SkillBuilderModel) => void
}) {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<div className="flex w-fit max-w-full min-w-0 items-center gap-px">
@@ -151,7 +151,7 @@ function SkillBuilderThinkingMessage({
reasoningContent?: string
seconds: number
}) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
const minutes = Math.floor(seconds / 60)
const remainingSeconds = seconds % 60
const duration = minutes > 0 ? `${minutes}m${remainingSeconds}s` : `${remainingSeconds}s`
@@ -296,7 +296,7 @@ export function SkillBuilderPanel({
selectedFile: SkillFileResponse | undefined
skillId: string
}) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
const queryClient = useQueryClient()
const titleId = useId()
const [prompt, setPrompt] = useState('')
diff --git a/web/features/skills/detail/file-editor.tsx b/web/features/skills/detail/file-editor.tsx
index 38170101705..93a5e4cf08c 100644
--- a/web/features/skills/detail/file-editor.tsx
+++ b/web/features/skills/detail/file-editor.tsx
@@ -137,7 +137,7 @@ export function FileEditor({
selectedVersionId: string | null
skillId: string
}) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
const queryClient = useQueryClient()
const { formatTimeFromNow } = useFormatTimeFromNow()
const initialContent =
diff --git a/web/features/skills/detail/file-tabs.tsx b/web/features/skills/detail/file-tabs.tsx
index 4a800c6eaf3..4be7178bf4c 100644
--- a/web/features/skills/detail/file-tabs.tsx
+++ b/web/features/skills/detail/file-tabs.tsx
@@ -21,7 +21,7 @@ export function FileTabs({
previewPath: string | undefined
selectedPath: string
}) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
return (
<div className="flex h-11 shrink-0 items-stretch overflow-hidden rounded-t-lg border-b-[0.5px] border-divider-subtle bg-components-panel-bg-alt">
diff --git a/web/features/skills/detail/file-tree-dnd.tsx b/web/features/skills/detail/file-tree-dnd.tsx
index 5f527f1e08d..d293b85e69c 100644
--- a/web/features/skills/detail/file-tree-dnd.tsx
+++ b/web/features/skills/detail/file-tree-dnd.tsx
@@ -38,8 +38,8 @@ export function SkillUploadStatusPanel({
onDismiss: () => void
onViewErrors: () => void
}) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
if (items.length === 0) return null
const uploadedCount = items.filter((item) => item.status === 'uploaded').length
diff --git a/web/features/skills/detail/file-tree-items.tsx b/web/features/skills/detail/file-tree-items.tsx
index 4207e7ab7b7..727b79cfbd6 100644
--- a/web/features/skills/detail/file-tree-items.tsx
+++ b/web/features/skills/detail/file-tree-items.tsx
@@ -144,8 +144,8 @@ function FileActionMenuItems({
onRename: () => void
onUploadFiles: () => void
}) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
const MenuItem = kind === 'context' ? ContextMenuItem : DropdownMenuItem
const MenuSeparator = kind === 'context' ? ContextMenuSeparator : DropdownMenuSeparator
const isDirectoryNode = node.type === 'directory'
@@ -268,7 +268,7 @@ function FileActions({
onRename: () => void
onUploadFiles: (files: File[], targetDirectory: string | undefined) => void
}) {
- const { t: tCommon } = useTranslation('common')
+ const { t: tCommon } = useTranslation(['common'])
const uploadInputRef = useRef<HTMLInputElement>(null)
return (
@@ -323,7 +323,7 @@ export function RootFileActionMenuItems({
onCreateFolder: () => void
onUploadFiles: () => void
}) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
const MenuItem = kind === 'context' ? ContextMenuItem : DropdownMenuItem
return (
@@ -405,7 +405,7 @@ export function FileTreeItem({
selectedPaths: string[]
selectedPath: string | undefined
}) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
const contextUploadInputRef = useRef<HTMLInputElement>(null)
const expandTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)
const isDragging = draggingPaths.includes(node.path)
diff --git a/web/features/skills/detail/file-tree.tsx b/web/features/skills/detail/file-tree.tsx
index 619abde7aaa..c18b91ea5b1 100644
--- a/web/features/skills/detail/file-tree.tsx
+++ b/web/features/skills/detail/file-tree.tsx
@@ -177,9 +177,9 @@ export function FileTree({
selectedPath: string | undefined
skillId: string
}) {
- const { t } = useTranslation('skill')
- const { t: tApp } = useTranslation('app')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill', 'common'])
+ const { t: tApp } = useTranslation(['app'])
+ const { t: tCommon } = useTranslation(['common'])
const queryClient = useQueryClient()
const sidebarRef = useRef<HTMLElement>(null)
const filesTitleId = useId()
diff --git a/web/features/skills/detail/markdown-editor.tsx b/web/features/skills/detail/markdown-editor.tsx
index 85d289c66fa..0e22edc5a0c 100644
--- a/web/features/skills/detail/markdown-editor.tsx
+++ b/web/features/skills/detail/markdown-editor.tsx
@@ -380,7 +380,7 @@ export function MarkdownModeSwitch({
mode: 'live' | 'source'
onChange: (mode: 'live' | 'source') => void
}) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
return (
<div className="absolute top-3 right-2 z-10 flex h-8 items-center rounded-md bg-components-segmented-control-bg-normal p-0.5">
@@ -1154,7 +1154,7 @@ export function VersionActionBar({
restoring: boolean
version: SkillVersionResponse
}) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
const { formatTime } = useTimestamp()
const publishedBy = version.published_by_name ?? version.published_by ?? '-'
const publishedAt = formatTime(
diff --git a/web/features/skills/detail/page.tsx b/web/features/skills/detail/page.tsx
index 5b9af3506b1..633706de11a 100644
--- a/web/features/skills/detail/page.tsx
+++ b/web/features/skills/detail/page.tsx
@@ -34,7 +34,7 @@ import { DetailSkeleton } from './shell'
import { RestoreVersionDialog, VersionPanel } from './version-panel'
export function SkillDetailPage({ skillId }: { skillId: string }) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
const queryClient = useQueryClient()
const { canEdit, canPublish, canDelete } = useSkillPermissions()
const [selectedPath, setSelectedPath] = useState<string>()
diff --git a/web/features/skills/detail/publish-bar.tsx b/web/features/skills/detail/publish-bar.tsx
index 95fba62e7d7..7534401bf5f 100644
--- a/web/features/skills/detail/publish-bar.tsx
+++ b/web/features/skills/detail/publish-bar.tsx
@@ -53,7 +53,7 @@ export function SkillPublishBar({
onPublish,
state,
}: SkillPublishBarProps) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
const canPublish = hasPublishPermission && (state === 'draft' || state === 'unpublished')
useHotkey(PUBLISH_SKILL_HOTKEY, onPublish, {
diff --git a/web/features/skills/detail/sidebar-actions.tsx b/web/features/skills/detail/sidebar-actions.tsx
index 1e6dd33c17d..9e1df110af8 100644
--- a/web/features/skills/detail/sidebar-actions.tsx
+++ b/web/features/skills/detail/sidebar-actions.tsx
@@ -50,8 +50,8 @@ function SkillDetailDeleteDialog({
onOpenChange: (open: boolean) => void
open: boolean
}) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
const [confirmDeleteInput, setConfirmDeleteInput] = useState('')
const queryClient = useQueryClient()
const router = useRouter()
@@ -208,8 +208,8 @@ export function SkillDetailSidebarActions({
detail: SkillDetailResponse
onRename: () => void
}) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
const queryClient = useQueryClient()
const [deleteOpen, setDeleteOpen] = useState(false)
const router = useRouter()
diff --git a/web/features/skills/detail/skill-display-name-editor.tsx b/web/features/skills/detail/skill-display-name-editor.tsx
index 54a38a1f519..0501b6a6f30 100644
--- a/web/features/skills/detail/skill-display-name-editor.tsx
+++ b/web/features/skills/detail/skill-display-name-editor.tsx
@@ -31,8 +31,8 @@ export function SkillDisplayNameEditor({
readonly: boolean
skillId: string
}) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
const queryClient = useQueryClient()
const inputRef = useRef<HTMLInputElement>(null)
const submittingRef = useRef(false)
diff --git a/web/features/skills/detail/skill-metadata.tsx b/web/features/skills/detail/skill-metadata.tsx
index af8c077bbcd..ad59d634dea 100644
--- a/web/features/skills/detail/skill-metadata.tsx
+++ b/web/features/skills/detail/skill-metadata.tsx
@@ -49,8 +49,8 @@ export function SkillTagsEditor({
readonly: boolean
skillId: string
}) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
const queryClient = useQueryClient()
const [addOpen, setAddOpen] = useState(false)
const [showTagManagement, setShowTagManagement] = useState(false)
@@ -301,7 +301,7 @@ export function SkillReferencesPanel({
testId?: string
visibleLimit?: number
}) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
const referencesQuery = useQuery({
...consoleQuery.workspaces.current.skills.bySkillId.references.get.queryOptions({
input: {
@@ -381,7 +381,7 @@ export function SkillReferencesList({
testId?: string
visibleLimit?: number
}) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
const [expanded, setExpanded] = useState(false)
const hasMoreReferences = visibleLimit != null && references.length > visibleLimit
const visibleReferences =
@@ -442,8 +442,8 @@ export function SkillPublishConfirmPanel({
referenceCount: number
skillId: string
}) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
if (!open) return null
return (
diff --git a/web/features/skills/detail/upload-dialogs.tsx b/web/features/skills/detail/upload-dialogs.tsx
index 0f1ac881868..76a13a41aaf 100644
--- a/web/features/skills/detail/upload-dialogs.tsx
+++ b/web/features/skills/detail/upload-dialogs.tsx
@@ -100,7 +100,7 @@ function UploadReviewRow({
item: SkillUploadReviewItem
onDecision: (id: string, decision: SkillUploadDecision) => void
}) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
const resolved = item.kind === 'ready' || (item.decision && item.decision !== 'skip')
const actions =
!item.decision && item.kind === 'conflict' ? (
@@ -149,8 +149,8 @@ export function SkillUploadReviewDialog({
onUpload: () => void
open: boolean
}) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
const skippedItems = items.filter(isUploadReviewItemSkipped)
const candidateItems = items.filter((item) => !isUploadReviewItemSkipped(item))
const unresolvedCount = candidateItems.filter((item) => !isUploadReviewResolved(item)).length
@@ -243,8 +243,8 @@ export function SkillUploadFailuresDialog({
onRetryItem: (id: string) => void
open: boolean
}) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
const failedItems = items.filter((item) => item.status === 'failed')
const retryableItems = failedItems.filter((item) => item.failureKind !== 'conflict')
return (
diff --git a/web/features/skills/detail/version-panel.tsx b/web/features/skills/detail/version-panel.tsx
index 086038f7a66..c092a2d6c04 100644
--- a/web/features/skills/detail/version-panel.tsx
+++ b/web/features/skills/detail/version-panel.tsx
@@ -54,8 +54,8 @@ export function RestoreVersionDialog({
open: boolean
versionTitle: string
}) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
return (
<AlertDialog open={open} onOpenChange={onOpenChange}>
@@ -114,7 +114,7 @@ function CurrentDraftItem({
isLast: boolean
onSelect: () => void
}) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
return (
<button
@@ -146,8 +146,8 @@ function VersionFilter({
value: VersionFilterValue
onChange: (value: VersionFilterValue) => void
}) {
- const { t } = useTranslation('skill')
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t } = useTranslation(['skill'])
+ const { t: tWorkflow } = useTranslation(['workflow'])
const [open, setOpen] = useState(false)
const isFiltering = value !== 'all'
@@ -222,8 +222,8 @@ function VersionRow({
skillId: string
version: SkillVersionResponse
}) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
const { formatTime } = useTimestamp()
const queryClient = useQueryClient()
const [renameOpen, setRenameOpen] = useState(false)
@@ -503,8 +503,8 @@ export function VersionPanel({
skillId: string
versions: SkillVersionResponse[]
}) {
- const { t } = useTranslation('skill')
- const { t: tWorkflow } = useTranslation('workflow')
+ const { t } = useTranslation(['skill'])
+ const { t: tWorkflow } = useTranslation(['workflow'])
const [filterValue, setFilterValue] = useState<VersionFilterValue>('all')
const titleId = useId()
const filteredVersions = versions.filter((version) => {
diff --git a/web/features/skills/page.tsx b/web/features/skills/page.tsx
index 5816390fc2d..bb0d9ae24a8 100644
--- a/web/features/skills/page.tsx
+++ b/web/features/skills/page.tsx
@@ -121,7 +121,7 @@ function SkillCardSkeletonCards() {
}
function SkillCardSkeleton() {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
return (
<>
@@ -155,8 +155,8 @@ function SkillPlaceholderState({
role,
title,
}: SkillPlaceholderStateProps) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
return (
<section
@@ -262,8 +262,8 @@ function DeleteSkillDialog({
skill: SkillResponse
onOpenChange: (open: boolean) => void
}) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
const [confirmDeleteInput, setConfirmDeleteInput] = useState('')
const queryClient = useQueryClient()
const deleteMutation = useMutation(
@@ -417,8 +417,8 @@ function SkillCard({
skill: SkillResponse
onOpenTagManagement: () => void
}) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
const { formatTimeFromNow } = useFormatTimeFromNow()
const queryClient = useQueryClient()
const router = useRouter()
@@ -681,7 +681,7 @@ function SkillsToolbar({
onImport: () => void
onOpenTagManagement: () => void
}) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
const [keyword, setKeyword] = useQueryState(skillQueryParamNames.keyword, skillKeywordQueryParser)
return (
<div className="flex min-w-0 items-center gap-2">
@@ -756,8 +756,8 @@ type SkillGridProps = {
}
function SkillGridRetryStatus({ state }: { state: SkillGridRetryState }) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
return (
<div
@@ -780,7 +780,7 @@ function SkillGridPagination({
{ kind: 'list' }
>['pagination']
}) {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
if (state.status === 'none') return null
if (state.status === 'error') return <SkillGridRetryStatus state={state} />
@@ -796,7 +796,7 @@ function SkillGridPagination({
}
function SkillGrid({ state }: SkillGridProps) {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
const isBusy =
state.status === 'pending' ||
(state.status === 'error' && state.isRetrying) ||
@@ -861,8 +861,8 @@ function ImportSkillDialogForm({
importing: boolean
onImport: (file: File) => void
}) {
- const { t } = useTranslation('skill')
- const { t: tCommon } = useTranslation('common')
+ const { t } = useTranslation(['skill'])
+ const { t: tCommon } = useTranslation(['common'])
const inputRef = useRef<HTMLInputElement>(null)
const dragDepthRef = useRef(0)
const descriptionId = useId()
@@ -1018,7 +1018,7 @@ function ImportSkillDialogForm({
}
export default function SkillsPage() {
- const { t } = useTranslation('skill')
+ const { t } = useTranslation(['skill'])
const router = useRouter()
const queryClient = useQueryClient()
const { canDelete, canEdit } = useSkillPermissions()
diff --git a/web/features/system-features/bootstrap-boundary.tsx b/web/features/system-features/bootstrap-boundary.tsx
index 8926894126a..0754d2d8746 100644
--- a/web/features/system-features/bootstrap-boundary.tsx
+++ b/web/features/system-features/bootstrap-boundary.tsx
@@ -9,7 +9,7 @@ import { isClient } from '@/utils/client'
import { systemFeaturesQueryOptions } from './client'
export function SystemFeaturesBootstrapBoundary({ children }: { children: ReactNode }) {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
const { data, error, isFetching, refetch } = useQuery({
...systemFeaturesQueryOptions(),
enabled: isClient,
diff --git a/web/features/tag-management/components/tag-filter.tsx b/web/features/tag-management/components/tag-filter.tsx
index eb78694782f..a50247b331d 100644
--- a/web/features/tag-management/components/tag-filter.tsx
+++ b/web/features/tag-management/components/tag-filter.tsx
@@ -43,7 +43,7 @@ export const TagFilter = ({
triggerClassName,
portalProps,
}: TagFilterProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [open, setOpen] = useState(false)
const [inputValue, setInputValue] = useState('')
diff --git a/web/features/tag-management/components/tag-item-editor.tsx b/web/features/tag-management/components/tag-item-editor.tsx
index 7b6bb8e8956..ccfb17939f0 100644
--- a/web/features/tag-management/components/tag-item-editor.tsx
+++ b/web/features/tag-management/components/tag-item-editor.tsx
@@ -22,7 +22,7 @@ type TagItemEditorProps = {
onTagsChange?: () => void
}
export const TagItemEditor = ({ tag, onTagsChange }: TagItemEditorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const updateTagMutation = useMutation(consoleQuery.tags.byTagId.patch.mutationOptions())
const deleteTagMutation = useMutation(consoleQuery.tags.byTagId.delete.mutationOptions())
const [isEditing, setIsEditing] = useState(false)
diff --git a/web/features/tag-management/components/tag-management-modal.tsx b/web/features/tag-management/components/tag-management-modal.tsx
index 0188aa5fbeb..9c424ad5d05 100644
--- a/web/features/tag-management/components/tag-management-modal.tsx
+++ b/web/features/tag-management/components/tag-management-modal.tsx
@@ -25,7 +25,7 @@ export const TagManagementModal = ({
onClose,
onTagsChange,
}: TagManagementModalProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
const canManageTags = hasPermission(workspacePermissionKeys, getTagManagePermissionKey(type))
const { data: tagList = [] } = useQuery(
diff --git a/web/features/tag-management/components/tag-search-content.tsx b/web/features/tag-management/components/tag-search-content.tsx
index d2686af242b..5c23abaacb7 100644
--- a/web/features/tag-management/components/tag-search-content.tsx
+++ b/web/features/tag-management/components/tag-search-content.tsx
@@ -45,7 +45,7 @@ export const TagSearchContentView = ({
showTagManagement = true,
canManageTags,
}: TagSearchContentViewProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const inputRef = useRef<HTMLInputElement>(null)
const filteredItems = useComboboxFilteredItems<TagComboboxItem>()
const realItemCount = filteredItems.filter((tag) => !isCreateTagOption(tag)).length
diff --git a/web/features/tag-management/components/tag-selector.tsx b/web/features/tag-management/components/tag-selector.tsx
index 35859accf66..71f2f85de39 100644
--- a/web/features/tag-management/components/tag-selector.tsx
+++ b/web/features/tag-management/components/tag-selector.tsx
@@ -72,7 +72,7 @@ export const TagSelector = ({
onTagsChange,
...rootProps
}: TagSelectorProps) => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [open, setOpen] = useState(false)
const [draftTagIds, setDraftTagIds] = useState(() => value.map((tag) => tag.id))
const [inputValue, setInputValue] = useState('')
diff --git a/web/hooks/use-import-dsl.ts b/web/hooks/use-import-dsl.ts
index b137dc6c554..8ec3fda87f5 100644
--- a/web/hooks/use-import-dsl.ts
+++ b/web/hooks/use-import-dsl.ts
@@ -26,7 +26,7 @@ type ResponseCallback = {
skipRedirectOnSuccess?: boolean
}
export const useImportDSL = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['app'])
const { handleCheckPluginDependencies } = usePluginDependencies()
const { push } = useRouter()
const { mutateAsync: importApp } = useMutation(consoleQuery.apps.imports.post.mutationOptions())
diff --git a/web/hooks/use-knowledge.ts b/web/hooks/use-knowledge.ts
index 43d3edacb05..fd58be4ab29 100644
--- a/web/hooks/use-knowledge.ts
+++ b/web/hooks/use-knowledge.ts
@@ -6,7 +6,7 @@ type IndexingTechnique = I18nKeysByPrefix<'dataset', 'indexingTechnique.'>
type IndexingMethod = I18nKeysByPrefix<'dataset', 'indexingMethod.'>
export const useKnowledge = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset'])
const formatIndexingTechnique = useCallback(
(indexingTechnique: IndexingTechnique) => {
diff --git a/web/hooks/use-metadata.ts b/web/hooks/use-metadata.ts
index e4ce0649635..6c01ba37e10 100644
--- a/web/hooks/use-metadata.ts
+++ b/web/hooks/use-metadata.ts
@@ -31,7 +31,7 @@ type MetadataMap = Record<
const fieldPrefix = 'metadata.field'
export const useMetadataMap = (): MetadataMap => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['dataset', 'datasetDocuments'])
const { formatTime: formatTimestamp } = useTimestamp()
return {
@@ -443,7 +443,7 @@ export const useMetadataMap = (): MetadataMap => {
const langPrefix = 'metadata.languageMap.'
export const useLanguages = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['datasetDocuments'])
return {
zh: t(($) => $[`${langPrefix}zh`], { ns: 'datasetDocuments' }),
en: t(($) => $[`${langPrefix}en`], { ns: 'datasetDocuments' }),
diff --git a/web/hooks/use-pay.tsx b/web/hooks/use-pay.tsx
index 8191a190d30..528643b33cf 100644
--- a/web/hooks/use-pay.tsx
+++ b/web/hooks/use-pay.tsx
@@ -19,7 +19,7 @@ type ConfirmType = {
}
const useAnthropicCheckPay = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [confirm, setConfirm] = useState<ConfirmType | null>(null)
const searchParams = useSearchParams()
const providerName = searchParams.get('provider_name')
@@ -44,7 +44,7 @@ const useAnthropicCheckPay = () => {
}
const useBillingPay = () => {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [confirm, setConfirm] = useState<ConfirmType | null>(null)
const searchParams = useSearchParams()
const paymentType = searchParams.get('payment_type')
@@ -99,7 +99,7 @@ const useCheckNotion = () => {
export const CheckModal = () => {
const router = useRouter()
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
const [showPayStatusModal, setShowPayStatusModal] = useState(true)
const anthropicConfirmInfo = useAnthropicCheckPay()
const notionConfirmInfo = useCheckNotion()
diff --git a/web/i18n/__tests__/route-loading.spec.tsx b/web/i18n/__tests__/route-loading.spec.tsx
index 348b62045b7..d917a090025 100644
--- a/web/i18n/__tests__/route-loading.spec.tsx
+++ b/web/i18n/__tests__/route-loading.spec.tsx
@@ -29,7 +29,7 @@ const makeResources = () => ({
})
let resources = makeResources()
function Label() {
- const { t } = useTranslation()
+ const { t } = useTranslation(['common'])
return (
<span>
{t(($) => $['operation.save'], { ns: 'common' })} /{' '}
@@ -117,7 +117,7 @@ describe('route translation loading', () => {
it('retains committed content and shared state until destination translations are ready', async () => {
function Destination() {
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['workflow'])
return <span>{t(($) => $['blocks.agent'], { ns: 'workflow' })}</span>
}
const user = userEvent.setup()
diff --git a/web/i18n/__tests__/server.spec.ts b/web/i18n/__tests__/server.spec.ts
index 6fc93525b51..c4b3cf45787 100644
--- a/web/i18n/__tests__/server.spec.ts
+++ b/web/i18n/__tests__/server.spec.ts
@@ -57,6 +57,21 @@ describe('server translations', () => {
expect(mocks.loadResource).toHaveBeenCalledExactlyOnceWith('en-US', 'login')
})
+ it('loads only the requested tuple and translates across its namespaces', async () => {
+ mocks.loadResource.mockImplementation(async (_locale: string, namespace: string) => ({
+ default:
+ namespace === 'common'
+ ? { 'operation.save': 'Save' }
+ : { 'marketplace.home.plugins': 'Plugins' },
+ }))
+ const { getTranslation } = await import('../server')
+ const { t } = await getTranslation('en-US', ['common', 'plugin'])
+
+ expect(t(($) => $['operation.save'])).toBe('Save')
+ expect(t(($) => $['marketplace.home.plugins'], { ns: 'plugin' })).toBe('Plugins')
+ expect(mocks.loadResource.mock.calls.map(([, ns]) => ns).sort()).toEqual(['common', 'plugin'])
+ })
+
it('loads resources once for concurrent consumers and reuses them after initialization', async () => {
const { getTranslation } = await import('../server')
const translations = await Promise.all([
diff --git a/web/i18n/__tests__/translation-adapters.spec.ts b/web/i18n/__tests__/translation-adapters.spec.ts
index b7a4f88e74e..a308737e5f4 100644
--- a/web/i18n/__tests__/translation-adapters.spec.ts
+++ b/web/i18n/__tests__/translation-adapters.spec.ts
@@ -24,18 +24,18 @@ vi.mock('@/i18n/server', () => ({
beforeEach(() => vi.clearAllMocks())
describe('translation adapter contracts', () => {
- it.each(['common', undefined] as const)(
+ it.each([{ ns: ['common'] }, { ns: ['common', 'plugin'] }, { ns: undefined }] as const)(
'forwards the client namespace %s unchanged',
- async (ns) => {
+ async ({ ns }) => {
const { useTranslation } = await import('../lib.client')
expect(useTranslation(ns)).toBe(mocks.translations)
expect(mocks.client).toHaveBeenCalledExactlyOnceWith(ns)
},
)
- it.each(['common', undefined] as const)(
+ it.each([{ ns: ['common'] }, { ns: ['common', 'plugin'] }, { ns: undefined }] as const)(
'loads the server namespace %s with the current locale',
- async (ns) => {
+ async ({ ns }) => {
const { useTranslation } = await import('../lib.server')
expect(await useTranslation(ns)).toBe(mocks.translations)
expect(mocks.locale).toHaveBeenCalledTimes(1)
diff --git a/web/i18n/lib.client.ts b/web/i18n/lib.client.ts
index cbc0f3f4358..fb077e829da 100644
--- a/web/i18n/lib.client.ts
+++ b/web/i18n/lib.client.ts
@@ -4,7 +4,10 @@ import type { Locale } from './locale'
import type { Namespace } from './resources'
import { useTranslation as useTranslationOriginal } from 'react-i18next'
-export function useTranslation<T extends Namespace | undefined = undefined>(ns?: T) {
+export function useTranslation<
+ const T extends readonly [Namespace, ...Namespace[]] | undefined = undefined,
+>(ns?: T) {
+ // oxlint-disable-next-line dify/require-i18n-namespace -- Forward the typed tuple while preserving the omitted namespace for locale-only callers.
return useTranslationOriginal(ns)
}
diff --git a/web/i18n/lib.server.ts b/web/i18n/lib.server.ts
index 61369542961..bb6f845bb84 100644
--- a/web/i18n/lib.server.ts
+++ b/web/i18n/lib.server.ts
@@ -2,12 +2,16 @@ import type { Namespace } from './resources'
import { use } from 'react'
import { getLocaleOnServer, getTranslation } from './server'
-async function getI18nConfig<T extends Namespace | undefined = undefined>(ns?: T) {
+async function getI18nConfig<
+ const T extends readonly [Namespace, ...Namespace[]] | undefined = undefined,
+>(ns?: T) {
const lang = await getLocaleOnServer()
return getTranslation(lang, ns)
}
-export function useTranslation<T extends Namespace | undefined = undefined>(ns?: T) {
+export function useTranslation<
+ const T extends readonly [Namespace, ...Namespace[]] | undefined = undefined,
+>(ns?: T) {
return use(getI18nConfig(ns))
}
diff --git a/web/i18n/server.ts b/web/i18n/server.ts
index 141ac477cbc..e10d83aebca 100644
--- a/web/i18n/server.ts
+++ b/web/i18n/server.ts
@@ -31,13 +31,15 @@ const getOrCreateI18next = cache(async (lng: Locale) => {
return instance
})
-export async function getTranslation<T extends Namespace>(lng: Locale, ns?: T) {
+export async function getTranslation<
+ const T extends Namespace | readonly [Namespace, ...Namespace[]],
+>(lng: Locale, ns?: T) {
const i18nextInstance = await getOrCreateI18next(lng)
- await i18nextInstance.loadNamespaces(ns ? [ns] : [...namespaces])
+ await i18nextInstance.loadNamespaces(typeof ns === 'string' ? [ns] : [...(ns ?? namespaces)])
return {
- t: i18nextInstance.getFixedT(lng, ns),
+ t: i18nextInstance.getFixedT<T>(lng, ns),
i18n: i18nextInstance,
}
}
diff --git a/web/plugins/eslint/index.js b/web/plugins/eslint/index.js
index bdfe2ba0548..6ede72704e2 100644
--- a/web/plugins/eslint/index.js
+++ b/web/plugins/eslint/index.js
@@ -4,6 +4,8 @@ import noExtraKeys from './rules/no-extra-keys.js'
import noFileWideDisable from './rules/no-file-wide-disable.js'
import preferTailwindIcons from './rules/prefer-tailwind-icons.js'
import requireDisableDirectiveDescription from './rules/require-disable-directive-description.js'
+import requireI18nNamespace from './rules/require-i18n-namespace.js'
+import requireTFunctionNamespace from './rules/require-t-function-namespace.js'
import requireTitleForTruncatedText from './rules/require-title-for-truncated-text.js'
/** @type {import('eslint').ESLint.Plugin} */
@@ -19,6 +21,8 @@ const plugin = {
'no-file-wide-disable': noFileWideDisable,
'prefer-tailwind-icons': preferTailwindIcons,
'require-disable-directive-description': requireDisableDirectiveDescription,
+ 'require-i18n-namespace': requireI18nNamespace,
+ 'require-t-function-namespace': requireTFunctionNamespace,
'require-title-for-truncated-text': requireTitleForTruncatedText,
},
}
diff --git a/web/plugins/eslint/rules/require-i18n-namespace.js b/web/plugins/eslint/rules/require-i18n-namespace.js
new file mode 100644
index 00000000000..19565947f33
--- /dev/null
+++ b/web/plugins/eslint/rules/require-i18n-namespace.js
@@ -0,0 +1,110 @@
+const translationModules = new Set(['react-i18next', '#i18n'])
+
+function unwrap(node) {
+ while (
+ node &&
+ [
+ 'TSAsExpression',
+ 'TSSatisfiesExpression',
+ 'TSNonNullExpression',
+ 'TSTypeAssertion',
+ 'ParenthesizedExpression',
+ 'ChainExpression',
+ ].includes(node.type)
+ )
+ node = node.expression
+ return node
+}
+
+function getVariable(sourceCode, node) {
+ let scope = sourceCode.getScope(node)
+ while (scope) {
+ const variable = scope.set.get(node.name)
+ if (variable) return variable
+ scope = scope.upper
+ }
+}
+
+function isTranslationHook(sourceCode, callee) {
+ callee = unwrap(callee)
+ let identifier = callee
+ let namespaceImport = false
+ if (callee.type === 'MemberExpression') {
+ const property = callee.computed ? callee.property.value : callee.property.name
+ if (property !== 'useTranslation') return false
+ identifier = unwrap(callee.object)
+ namespaceImport = true
+ }
+ if (identifier.type !== 'Identifier') return false
+ const definition = getVariable(sourceCode, identifier)?.defs[0]
+ if (
+ definition?.type !== 'ImportBinding' ||
+ !translationModules.has(definition.parent.source.value)
+ )
+ return false
+ if (namespaceImport) return definition.node.type === 'ImportNamespaceSpecifier'
+ return (
+ definition.node.type === 'ImportSpecifier' &&
+ (definition.node.imported.name ?? definition.node.imported.value) === 'useTranslation'
+ )
+}
+
+function isNamespaceArray(node) {
+ node = unwrap(node)
+ return node?.type === 'ArrayExpression' && node.elements.length > 0
+}
+
+function onlyReadsI18n(node) {
+ while (node.parent && unwrap(node.parent) === unwrap(node)) node = node.parent
+ const parent = node.parent
+ const isI18nProperty = (property, computed) =>
+ property.type === 'Literal' ? property.value === 'i18n' : !computed && property.name === 'i18n'
+ if (parent.type === 'MemberExpression' && parent.object === node)
+ return isI18nProperty(parent.property, parent.computed)
+ const pattern =
+ parent.type === 'VariableDeclarator' && parent.init === node
+ ? parent.id
+ : parent.type === 'AssignmentExpression' && parent.right === node
+ ? parent.left
+ : undefined
+ if (pattern?.type !== 'ObjectPattern' || pattern.properties.length !== 1) return false
+ const property = pattern.properties[0]
+ return property.type === 'Property' && isI18nProperty(property.key, property.computed)
+}
+
+/** @type {import('eslint').Rule.RuleModule} */
+export default {
+ meta: {
+ type: 'problem',
+ docs: {
+ description: 'Require an explicit namespace array unless only the i18n instance is read.',
+ },
+ schema: [],
+ messages: {
+ emptyNamespace: 'Declare the namespaces used by useTranslation as a non-empty inline array.',
+ },
+ },
+ create(context) {
+ const importedNames = new Set(
+ context.sourceCode.ast.body
+ .filter(
+ (node) => node.type === 'ImportDeclaration' && translationModules.has(node.source.value),
+ )
+ .flatMap((node) => node.specifiers.map((specifier) => specifier.local.name)),
+ )
+ if (!importedNames.size) return {}
+ return {
+ CallExpression(node) {
+ const callee = unwrap(node.callee)
+ const identifier = callee.type === 'MemberExpression' ? unwrap(callee.object) : callee
+ if (!importedNames.has(identifier.name)) return
+ if (
+ isTranslationHook(context.sourceCode, node.callee) &&
+ !isNamespaceArray(node.arguments[0]) &&
+ !onlyReadsI18n(node)
+ )
+ context.report({ node, messageId: 'emptyNamespace' })
+ },
+ }
+ },
+}
diff --git a/web/plugins/eslint/rules/require-i18n-namespace.test.js b/web/plugins/eslint/rules/require-i18n-namespace.test.js
new file mode 100644
index 00000000000..8ce8f425f32
--- /dev/null
+++ b/web/plugins/eslint/rules/require-i18n-namespace.test.js
@@ -0,0 +1,109 @@
+import { spawnSync } from 'node:child_process'
+import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
+import { createRequire } from 'node:module'
+import { tmpdir } from 'node:os'
+import { dirname, join } from 'node:path'
+import { expect, it } from 'vite-plus/test'
+
+function lintFixture(source, rules) {
+ const require = createRequire(import.meta.url)
+ const viteRequire = createRequire(require.resolve('vite-plus/package.json'))
+ const oxlintBin = join(dirname(dirname(viteRequire.resolve('oxlint'))), 'bin', 'oxlint')
+ const directory = mkdtempSync(join(tmpdir(), 'dify-i18n-namespace-'))
+ try {
+ writeFileSync(
+ join(directory, 'plugin.mjs'),
+ `export { default } from ${JSON.stringify(require.resolve('../index.js'))};`,
+ )
+ writeFileSync(
+ join(directory, '.oxlintrc.json'),
+ JSON.stringify({
+ categories: { correctness: 'off' },
+ jsPlugins: ['./plugin.mjs'],
+ options: { respectEslintDisableDirectives: false },
+ rules,
+ }),
+ )
+ writeFileSync(join(directory, 'fixture.tsx'), source)
+ const result = spawnSync(
+ process.execPath,
+ [oxlintBin, '--config', join(directory, '.oxlintrc.json'), '--format', 'json', 'fixture.tsx'],
+ {
+ cwd: directory,
+ encoding: 'utf8',
+ },
+ )
+ expect(result.error).toBeUndefined()
+ expect([0, 1], result.stderr + result.stdout).toContain(result.status)
+ return JSON.parse(result.stdout).diagnostics
+ } finally {
+ rmSync(directory, { recursive: true, force: true })
+ }
+}
+
+it('rejects missing, empty, string, and dynamic namespaces through named and namespace imports', () => {
+ const source = [
+ "import { useTranslation as translate } from 'react-i18next'",
+ "import { useTranslation } from '#i18n'",
+ "import * as i18n from 'react-i18next'",
+ 'translate()',
+ 'useTranslation(undefined, { useSuspense: false })',
+ 'translate(null)',
+ "translate('')",
+ 'translate([])',
+ 'translate([] as const)',
+ "i18n.useTranslation('')",
+ "i18n['useTranslation']()",
+ "translate('' satisfies string)",
+ "translate('common')",
+ 'function dynamic(namespace: string) { translate(namespace) }',
+ "const namespace = 'common'; translate(namespace)",
+ "const namespaces = ['common']; translate(namespaces)",
+ 'translate(getNamespaces())',
+ ].join('\n')
+ const diagnostics = lintFixture(source, { 'dify/require-i18n-namespace': 'error' })
+ expect(diagnostics.map(({ code, labels }) => ({ code, line: labels[0].span.line }))).toEqual(
+ [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17].map((line) => ({
+ code: 'dify(require-i18n-namespace)',
+ line,
+ })),
+ )
+})
+
+it('allows explicit namespace arrays without reporting unrelated or shadowed bindings', () => {
+ const source = [
+ "import { useTranslation as translate } from 'react-i18next'",
+ "import { useTranslation } from './unrelated'",
+ "import * as i18n from '#i18n'",
+ "translate(['common'])",
+ "translate(['common', 'workflow'] as const)",
+ "i18n.useTranslation(['common'])",
+ "i18n['useTranslation'](['common'])",
+ 'function shadowed(translate: Function) { translate() }',
+ 'function shadowedObject(i18n: any) { i18n.useTranslation() }',
+ 'useTranslation()',
+ 'const unrelated = { useTranslation() {} }',
+ 'unrelated.useTranslation()',
+ ].join('\n')
+ expect(lintFixture(source, { 'dify/require-i18n-namespace': 'error' })).toEqual([])
+})
+
+it('allows reading only i18n but still requires namespaces when t or the rest is extracted', () => {
+ const source = [
+ "import { useTranslation } from 'react-i18next'",
+ 'const { i18n } = useTranslation(); const { "i18n": quoted } = useTranslation()',
+ 'const { i18n: instance } = useTranslation()',
+ "const { ['i18n']: computed } = useTranslation()",
+ 'const language = useTranslation().i18n.language',
+ "const language2 = useTranslation()['i18n'].language",
+ 'const { i18n: wrapped } = (useTranslation() as any)!',
+ 'let assigned; ({ i18n: assigned } = useTranslation())',
+ 'const { t } = useTranslation()',
+ 'const { i18n: mixed, t: translate } = useTranslation()',
+ 'const { i18n: withRest, ...rest } = useTranslation()',
+ 'const translate2 = useTranslation().t',
+ 'const { t: i18nAlias } = useTranslation()',
+ ].join('\n')
+ const diagnostics = lintFixture(source, { 'dify/require-i18n-namespace': 'error' })
+ expect(diagnostics.map(({ labels }) => labels[0].span.line)).toEqual([9, 10, 11, 12, 13])
+})
diff --git a/web/plugins/eslint/rules/require-t-function-namespace.js b/web/plugins/eslint/rules/require-t-function-namespace.js
new file mode 100644
index 00000000000..b6f675c42cd
--- /dev/null
+++ b/web/plugins/eslint/rules/require-t-function-namespace.js
@@ -0,0 +1,77 @@
+function getVariable(sourceCode, node) {
+ let scope = sourceCode.getScope(node)
+ while (scope) {
+ const variable = scope.set.get(node.name)
+ if (variable) return variable
+ scope = scope.upper
+ }
+}
+
+function isTFunction(sourceCode, name) {
+ const qualified = name.type === 'TSQualifiedName'
+ if (qualified && name.right.name !== 'TFunction') return false
+ const identifier = qualified ? name.left : name
+ if (identifier.type !== 'Identifier') return false
+ const definition = getVariable(sourceCode, identifier)?.defs[0]
+ if (definition?.type !== 'ImportBinding' || definition.parent.source.value !== 'i18next')
+ return false
+ if (qualified) return definition.node.type === 'ImportNamespaceSpecifier'
+ return (
+ definition.node.type === 'ImportSpecifier' &&
+ (definition.node.imported.name ?? definition.node.imported.value) === 'TFunction'
+ )
+}
+
+function isNamespaceTuple(node) {
+ if (node?.type === 'TSTypeOperator' && node.operator === 'readonly') node = node.typeAnnotation
+ return (
+ node?.type === 'TSTupleType' &&
+ node.elementTypes.length > 0 &&
+ node.elementTypes.every(
+ (element) =>
+ element.type === 'TSLiteralType' &&
+ typeof element.literal.value === 'string' &&
+ element.literal.value.length > 0,
+ )
+ )
+}
+
+/** @type {import('eslint').Rule.RuleModule} */
+export default {
+ meta: {
+ type: 'problem',
+ docs: { description: 'Require explicit namespace tuples for i18next TFunction types.' },
+ schema: [],
+ messages: {
+ namespaceTuple:
+ "Declare TFunction namespaces as a non-empty tuple of string literals, e.g. TFunction<['common', 'workflow']>.",
+ },
+ },
+ create(context) {
+ const importedNames = new Set(
+ context.sourceCode.ast.body
+ .filter((node) => node.type === 'ImportDeclaration' && node.source.value === 'i18next')
+ .flatMap((node) => node.specifiers.map((specifier) => specifier.local.name)),
+ )
+ const check = (node) => {
+ if (!isNamespaceTuple(node.typeArguments?.params[0]))
+ context.report({ node, messageId: 'namespaceTuple' })
+ }
+ return {
+ TSTypeReference(node) {
+ const identifier =
+ node.typeName.type === 'TSQualifiedName' ? node.typeName.left : node.typeName
+ if (importedNames.has(identifier.name) && isTFunction(context.sourceCode, node.typeName))
+ check(node)
+ },
+ TSImportType(node) {
+ if (
+ node.source.value === 'i18next' &&
+ node.qualifier?.type === 'Identifier' &&
+ node.qualifier.name === 'TFunction'
+ )
+ check(node)
+ },
+ }
+ },
+}
diff --git a/web/plugins/eslint/rules/require-t-function-namespace.test.js b/web/plugins/eslint/rules/require-t-function-namespace.test.js
new file mode 100644
index 00000000000..55b7ad6e319
--- /dev/null
+++ b/web/plugins/eslint/rules/require-t-function-namespace.test.js
@@ -0,0 +1,88 @@
+import { spawnSync } from 'node:child_process'
+import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
+import { createRequire } from 'node:module'
+import { tmpdir } from 'node:os'
+import { dirname, join } from 'node:path'
+import { expect, it } from 'vite-plus/test'
+
+function lintFixture(source, rules) {
+ const require = createRequire(import.meta.url)
+ const viteRequire = createRequire(require.resolve('vite-plus/package.json'))
+ const oxlintBin = join(dirname(dirname(viteRequire.resolve('oxlint'))), 'bin', 'oxlint')
+ const directory = mkdtempSync(join(tmpdir(), 'dify-t-function-namespace-'))
+ try {
+ writeFileSync(
+ join(directory, 'plugin.mjs'),
+ `export { default } from ${JSON.stringify(require.resolve('../index.js'))};`,
+ )
+ writeFileSync(
+ join(directory, '.oxlintrc.json'),
+ JSON.stringify({
+ categories: { correctness: 'off' },
+ jsPlugins: ['./plugin.mjs'],
+ options: { respectEslintDisableDirectives: false },
+ rules,
+ }),
+ )
+ writeFileSync(join(directory, 'fixture.tsx'), source)
+ const result = spawnSync(
+ process.execPath,
+ [oxlintBin, '--config', join(directory, '.oxlintrc.json'), '--format', 'json', 'fixture.tsx'],
+ {
+ cwd: directory,
+ encoding: 'utf8',
+ },
+ )
+ expect(result.error).toBeUndefined()
+ expect([0, 1], result.stderr + result.stdout).toContain(result.status)
+ return JSON.parse(result.stdout).diagnostics
+ } finally {
+ rmSync(directory, { recursive: true, force: true })
+ }
+}
+
+it('rejects missing, broad, and non-tuple namespaces through imported TFunction types', () => {
+ const source = [
+ "import type { TFunction, TFunction as Translate, Namespace } from 'i18next'",
+ "import type * as I18n from 'i18next'",
+ 'type Missing = TFunction',
+ 'type Broad = Translate<Namespace>',
+ "type Single = TFunction<'common'>",
+ 'type Empty = TFunction<[]>',
+ 'type Array = TFunction<string[]>',
+ 'type BroadElement = TFunction<[Namespace]>',
+ "type EmptyElement = TFunction<['']>",
+ 'type Qualified = I18n.TFunction',
+ "type Inline = import('i18next').TFunction<'common'>",
+ 'type Any = TFunction<any>',
+ "type Alias = ['common']; type Indirect = TFunction<Alias>",
+ "type Rest = TFunction<['common', ...string[]]>",
+ "type Union = TFunction<['common' | 'workflow']>",
+ ].join('\n')
+ const diagnostics = lintFixture(source, { 'dify/require-t-function-namespace': 'error' })
+ expect(diagnostics.map(({ code, labels }) => ({ code, line: labels[0].span.line }))).toEqual(
+ Array.from({ length: 13 }, (_, index) => ({
+ code: 'dify(require-t-function-namespace)',
+ line: index + 3,
+ })),
+ )
+})
+
+it('allows explicit tuples and preserves unrelated or shadowed type bindings', () => {
+ const source = [
+ "import type { TFunction, TFunction as Translate } from 'i18next'",
+ "import type * as I18n from 'i18next'",
+ "import type { TFunction as Other } from './other'",
+ "type Single = TFunction<['common']>",
+ "type Multiple = Translate<['common', 'workflow']>",
+ "type Readonly = I18n.TFunction<readonly ['common', 'workflow']>",
+ "type Prefix = TFunction<['common'], 'operation'>",
+ "type Inline = import('i18next').TFunction<['common']>",
+ 'type Unrelated = Other',
+ 'type Shadowed<TFunction> = TFunction',
+ 'type ShadowedAlias<Translate> = Translate',
+ 'namespace Nested { type TFunction = string; type Local = TFunction }',
+ "type OtherInline = import('./other').TFunction",
+ ].join('\n')
+ expect(lintFixture(source, { 'dify/require-t-function-namespace': 'error' })).toEqual([])
+})
diff --git a/web/test/__tests__/i18n-mock.spec.ts b/web/test/__tests__/i18n-mock.spec.ts
index 772387696d5..b70cd0b9c88 100644
--- a/web/test/__tests__/i18n-mock.spec.ts
+++ b/web/test/__tests__/i18n-mock.spec.ts
@@ -56,7 +56,7 @@ describe('createReactI18nextMock', () => {
it('should preserve flat dotted keys selected with bracket notation', () => {
// Arrange
const { useTranslation } = createReactI18nextMock()
- const { t } = useTranslation('app')
+ const { t } = useTranslation(['app'])
// Act
const result = t(($) => $['accessControlDialog.title'])
@@ -68,7 +68,7 @@ describe('createReactI18nextMock', () => {
it('should preserve nested keys selected with property access', () => {
// Arrange
const { useTranslation } = createReactI18nextMock()
- const { t } = useTranslation('common')
+ const { t } = useTranslation(['common'])
// Act
const result = t(($) => $['operation.close'])