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 = (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 = ({ periodMapping, onSelect, queryDateFormat }) => { - const { t } = useTranslation() + const { t } = useTranslation(['appLog', 'common']) const items = React.useMemo(() => { 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 = ({ isCustomRange, ranges, onSelect }) => { - const { t } = useTranslation() + const { t } = useTranslation(['appLog']) const items = useMemo(() => { 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 = ({ onConfigUpdated, onConfigRemoved, }) => { - const { t } = useTranslation() + const { t } = useTranslation(['app']) const [currentProvider, setCurrentProvider] = useState( 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 = ({ 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 = ({ 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 = (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 (
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 (
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() 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.start) const [code, setCode] = useState('') 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 (
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>(() => 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() const [createdApiKey, setCreatedApiKey] = useState() 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 ( 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('all') const [selected, setSelected] = useState([]) 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) => { 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(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 = { 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 (
@@ -39,7 +39,7 @@ export function WebAppAccessControlEntry({ disabled, onClick, }: WebAppAccessControlEntryProps) { - const { t } = useTranslation() + const { t } = useTranslation(['app']) return (
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 = ({ type, content, onChange }) => { - const { t } = useTranslation() + const { t } = useTranslation(['appAnnotation']) const avatar = type === EditItemType.Query ? ( 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 = ({ 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 = ({ 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 = ({ file, updateFile }) => { - const { t } = useTranslation() + const { t } = useTranslation(['appAnnotation', 'common', 'datasetCreation']) const [dragging, setDragging] = useState(false) const dropRef = useRef(null) const dragRef = useRef(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 = ({ 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 = ({ 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
) const EditItem: FC = ({ 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 = ({ 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) => { } const EmptyElement: FC = () => { - const { t } = useTranslation() + const { t } = useTranslation(['appAnnotation']) return (
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 = ({ appId, queryParams, setQueryParams, children }) => { const { data, isLoading } = useAnnotationsCount(appId) - const { t } = useTranslation() + const { t } = useTranslation(['common']) if (isLoading || !data) return null return (
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 = ({ onClearAll, onExportJsonl, }) => { - const { t } = useTranslation() + const { t } = useTranslation(['appAnnotation']) const locale = useLocale() const annotationUnavailable = list.length === 0 @@ -132,7 +132,7 @@ const OperationsMenu: FC = ({ } const HeaderOptions: FC = ({ appId, onAdd, onAdded, controlUpdateList }) => { - const { t } = useTranslation() + const { t } = useTranslation(['appAnnotation', 'common']) const locale = useLocale() const [list, setList] = useState([]) 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) => { const { appDetail } = props - const { t } = useTranslation() + const { t } = useTranslation(['appAnnotation', 'common']) const docLink = useDocLink() const [isShowEdit, setIsShowEdit] = useState(false) const [annotationConfig, setAnnotationConfig] = useState(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(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 = ({ 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 (
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 = ({ 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(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 (
  • @@ -102,7 +102,7 @@ function MemberItem({ ...userProfileQueryOptions(), select: (data) => data.profile, }) - const { t } = useTranslation() + const { t } = useTranslation(['common']) return (
  • 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 (
    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 (
    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 & { } 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 = ({ 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 = (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 = ({ 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 ( 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(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(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(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 (