diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/__tests__/layout-main.spec.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/__tests__/layout-main.spec.tsx index dc96a55564d..f1b7601641e 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/__tests__/layout-main.spec.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/__tests__/layout-main.spec.tsx @@ -95,7 +95,7 @@ describe('AppDetailLayout', () => { ['/app/app-1/logs', 'common.appMenus.logs', AppModeEnum.WORKFLOW], ['/app/app-1/annotations', 'common.appMenus.annotations', AppModeEnum.CHAT], ['/app/app-1/overview', 'common.appMenus.overview', AppModeEnum.WORKFLOW], - ['/app/app-1/access-config', 'common.settings.resourceAccess', AppModeEnum.WORKFLOW], + ['/app/app-1/access-config', 'navigation.settings.resourceAccess', AppModeEnum.WORKFLOW], ])('identifies the current detail page for %s', async (pathname, pageTitle, mode) => { mockPathname = pathname mockFetchAppDetailDirect.mockResolvedValue( diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx index 479e907f6e7..e24b7c5ce14 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx @@ -43,9 +43,9 @@ const appDetailPageTitle = (pathname: string, t: ReturnType $['appMenus.annotations'], { ns: 'common' }) if (pathname.endsWith('/overview')) return t(($) => $['appMenus.overview'], { ns: 'common' }) if (pathname.endsWith('/access-config')) - return t(($) => $['settings.resourceAccess'], { ns: 'common' }) + return t(($) => $['settings.resourceAccess'], { ns: 'navigation' }) - return t(($) => $['menus.appDetail'], { ns: 'common' }) + return t(($) => $['menus.appDetail'], { ns: 'navigation' }) } const AppDetailLayout: FC = (props) => { @@ -53,7 +53,7 @@ const AppDetailLayout: FC = (props) => { children, appId, // get appId in path } = props - const { t } = useTranslation(['common']) + const { t } = useTranslation(['common', 'navigation']) const router = useRouter() const pathname = usePathname() const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions()) @@ -95,7 +95,9 @@ const AppDetailLayout: FC = (props) => { : false const shouldBlockAccessPointAccess = pathname.endsWith('/access-point') && !canViewAccessPoint - useDocumentTitle(`${pageTitle} · ${appName || t(($) => $['menus.appDetail'], { ns: 'common' })}`) + useDocumentTitle( + `${pageTitle} · ${appName || t(($) => $['menus.appDetail'], { ns: 'navigation' })}`, + ) useEffect(() => { let ignore = false 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 b1cb5f7f490..80a52c7027e 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(['app', 'common']) + const { t } = useTranslation(['app', 'common', 'modelProvider']) const isEdit = !!payload const isAdd = !isEdit const [isSaving, setIsSaving] = useState(false) @@ -825,7 +825,7 @@ const ProviderConfigModal: FC = ({ aria-hidden className="mr-1 i-custom-vender-solid-security-lock-01 size-3 text-text-tertiary" /> - {t(($) => $['modelProvider.encrypted.front'], { ns: 'common' })} + {t(($) => $['modelProvider.encrypted.front'], { ns: 'modelProvider' })} = ({ > PKCS1_OAEP - {t(($) => $['modelProvider.encrypted.back'], { ns: 'common' })} + {t(($) => $['modelProvider.encrypted.back'], { ns: 'modelProvider' })} diff --git a/web/app/(commonLayout)/apps/page.tsx b/web/app/(commonLayout)/apps/page.tsx index d664642ed87..ba1f6051e03 100644 --- a/web/app/(commonLayout)/apps/page.tsx +++ b/web/app/(commonLayout)/apps/page.tsx @@ -2,7 +2,7 @@ import { Apps } from '@/app/components/apps' import { getRouteMetadata } from '@/app/route-metadata' export function generateMetadata() { - return getRouteMetadata('common', ($) => $['menus.apps']) + return getRouteMetadata('navigation', ($) => $['menus.apps']) } export default function AppsPage() { diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/__tests__/layout-main.spec.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/__tests__/layout-main.spec.tsx index c2446b91582..c2b54e3906c 100644 --- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/__tests__/layout-main.spec.tsx +++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/__tests__/layout-main.spec.tsx @@ -99,7 +99,7 @@ describe('DatasetDetailLayout', () => { ['/datasets/dataset-1/pipeline', 'common.datasetMenus.pipeline'], ['/datasets/dataset-1/hitTesting', 'common.datasetMenus.hitTesting'], ['/datasets/dataset-1/settings', 'common.datasetMenus.settings'], - ['/datasets/dataset-1/access-config', 'common.settings.resourceAccess'], + ['/datasets/dataset-1/access-config', 'navigation.settings.resourceAccess'], ['/datasets/dataset-1/api', 'common.appMenus.apiAccess'], ])('identifies the current detail page for %s', async (pathname, pageTitle) => { mockUsePathname.mockReturnValue(pathname) diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx index 950e51e13f4..84dab601d1b 100644 --- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx +++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx @@ -51,10 +51,10 @@ const datasetDetailPageTitle = (pathname: string, t: ReturnType $['datasetMenus.hitTesting'], { ns: 'common' }) if (pathname.endsWith('/settings')) return t(($) => $['datasetMenus.settings'], { ns: 'common' }) if (pathname.endsWith('/access-config')) - return t(($) => $['settings.resourceAccess'], { ns: 'common' }) + return t(($) => $['settings.resourceAccess'], { ns: 'navigation' }) if (pathname.endsWith('/api')) return t(($) => $['appMenus.apiAccess'], { ns: 'common' }) - return t(($) => $['menus.datasets'], { ns: 'common' }) + return t(($) => $['menus.datasets'], { ns: 'navigation' }) } const isDocumentDetailPath = (pathname: string) => @@ -86,7 +86,7 @@ const getDatasetRedirectionPath = ( const DatasetDetailLayout: FC = (props) => { const { children, datasetId } = props - const { t } = useTranslation(['common', 'datasetPipeline']) + const { t } = useTranslation(['common', 'datasetPipeline', 'navigation']) const router = useRouter() const pathname = usePathname() const isLoadingCurrentWorkspace = useAtomValue(currentWorkspaceLoadingAtom) @@ -132,7 +132,7 @@ const DatasetDetailLayout: FC = (props) => { ((isAccessConfigPath && !datasetACLCapabilities.canAccessConfig) || (isHitTestingPath && !datasetACLCapabilities.canRetrievalRecall)) const pageTitle = datasetDetailPageTitle(pathname, t) - const documentTitle = `${pageTitle} · ${datasetRes?.name || t(($) => $['menus.datasets'], { ns: 'common' })}` + const documentTitle = `${pageTitle} · ${datasetRes?.name || t(($) => $['menus.datasets'], { ns: 'navigation' })}` useEffect(() => { if (shouldRedirect) router.replace('/datasets') diff --git a/web/app/(commonLayout)/datasets/connect/page.tsx b/web/app/(commonLayout)/datasets/connect/page.tsx index 86dc5c4ef8b..a6952b40bf7 100644 --- a/web/app/(commonLayout)/datasets/connect/page.tsx +++ b/web/app/(commonLayout)/datasets/connect/page.tsx @@ -2,7 +2,10 @@ import ExternalKnowledgeBaseConnector from '@/app/components/datasets/external-k import { getRouteMetadata } from '@/app/route-metadata' export function generateMetadata() { - return getRouteMetadata('common', ($) => $['stepByStepTour.guides.knowledge.empty.connect.title']) + return getRouteMetadata( + 'onboarding', + ($) => $['stepByStepTour.guides.knowledge.empty.connect.title'], + ) } const ExternalKnowledgeBaseCreation = () => { diff --git a/web/app/(commonLayout)/datasets/create-from-pipeline/page.tsx b/web/app/(commonLayout)/datasets/create-from-pipeline/page.tsx index de4c7faa656..ada52b1d72b 100644 --- a/web/app/(commonLayout)/datasets/create-from-pipeline/page.tsx +++ b/web/app/(commonLayout)/datasets/create-from-pipeline/page.tsx @@ -3,7 +3,7 @@ import { getRouteMetadata } from '@/app/route-metadata' export function generateMetadata() { return getRouteMetadata( - 'common', + 'onboarding', ($) => $['stepByStepTour.guides.knowledge.empty.pipeline.title'], ) } diff --git a/web/app/(commonLayout)/datasets/create/page.tsx b/web/app/(commonLayout)/datasets/create/page.tsx index 8b7852c9340..4f6ebd070e3 100644 --- a/web/app/(commonLayout)/datasets/create/page.tsx +++ b/web/app/(commonLayout)/datasets/create/page.tsx @@ -2,7 +2,10 @@ import DatasetUpdateForm from '@/app/components/datasets/create' import { getRouteMetadata } from '@/app/route-metadata' export function generateMetadata() { - return getRouteMetadata('common', ($) => $['stepByStepTour.guides.knowledge.empty.create.title']) + return getRouteMetadata( + 'onboarding', + ($) => $['stepByStepTour.guides.knowledge.empty.create.title'], + ) } const DatasetCreation = () => { diff --git a/web/app/(commonLayout)/integrations/[[...slug]]/layout.tsx b/web/app/(commonLayout)/integrations/[[...slug]]/layout.tsx index bf996fa6214..eb5720c25f0 100644 --- a/web/app/(commonLayout)/integrations/[[...slug]]/layout.tsx +++ b/web/app/(commonLayout)/integrations/[[...slug]]/layout.tsx @@ -15,8 +15,8 @@ const getIntegrationSectionTitle = async (section: IntegrationSection) => { if (section === 'mcp') return 'MCP' if (section === 'workflow-tool') { - const { t } = await getTranslation(locale, 'workflow') - return t(($) => $['common.workflowAsTool'], { ns: 'workflow' }) + const { t } = await getTranslation(locale, 'navigation') + return t(($) => $['common.workflowAsTool'], { ns: 'navigation' }) } if (section === 'trigger' || section === 'agent-strategy' || section === 'extension') { const { t } = await getTranslation(locale, 'plugin') @@ -25,12 +25,13 @@ const getIntegrationSectionTitle = async (section: IntegrationSection) => { return t(($) => $['categorySingle.extension'], { ns: 'plugin' }) } - const { t } = await getTranslation(locale, 'common') - if (section === 'provider') return t(($) => $['settings.provider'], { ns: 'common' }) - if (section === 'builtin') return t(($) => $['toolsPage.toolPlugin'], { ns: 'common' }) - if (section === 'custom-tool') return t(($) => $['settings.swaggerAPIAsTool'], { ns: 'common' }) - if (section === 'data-source') return t(($) => $['settings.dataSource'], { ns: 'common' }) - return t(($) => $['settings.customEndpoint'], { ns: 'common' }) + const { t } = await getTranslation(locale, 'navigation') + if (section === 'provider') return t(($) => $['settings.provider'], { ns: 'navigation' }) + if (section === 'builtin') return t(($) => $['toolsPage.toolPlugin'], { ns: 'navigation' }) + if (section === 'custom-tool') + return t(($) => $['settings.swaggerAPIAsTool'], { ns: 'navigation' }) + if (section === 'data-source') return t(($) => $['settings.dataSource'], { ns: 'navigation' }) + return t(($) => $['settings.customEndpoint'], { ns: 'navigation' }) } export async function generateMetadata({ @@ -39,8 +40,8 @@ export async function generateMetadata({ const { slug } = await params const target = getIntegrationRouteTargetBySlug(slug) const locale = await getLocaleOnServer() - const { t } = await getTranslation(locale, 'common') - const integrationsTitle = t(($) => $['mainNav.integrations'], { ns: 'common' }) + const { t } = await getTranslation(locale, 'navigation') + const integrationsTitle = t(($) => $['mainNav.integrations'], { ns: 'navigation' }) if (target.type !== 'section') return { title: integrationsTitle } diff --git a/web/app/(commonLayout)/marketplace/document-title.tsx b/web/app/(commonLayout)/marketplace/document-title.tsx index 1aaae53c76f..35d9deeb887 100644 --- a/web/app/(commonLayout)/marketplace/document-title.tsx +++ b/web/app/(commonLayout)/marketplace/document-title.tsx @@ -4,8 +4,8 @@ import { useTranslation } from 'react-i18next' import useDocumentTitle from '@/hooks/use-document-title' const MarketplaceDocumentTitle = () => { - const { t } = useTranslation(['common']) - useDocumentTitle(t(($) => $['mainNav.marketplace'], { ns: 'common' })) + const { t } = useTranslation(['navigation']) + useDocumentTitle(t(($) => $['mainNav.marketplace'], { ns: 'navigation' })) return null } diff --git a/web/app/(commonLayout)/page.tsx b/web/app/(commonLayout)/page.tsx index 4ab822cfe32..c41be50008a 100644 --- a/web/app/(commonLayout)/page.tsx +++ b/web/app/(commonLayout)/page.tsx @@ -2,7 +2,7 @@ import { getRouteMetadata } from '@/app/route-metadata' import { HomePage } from '@/features/home/page' export function generateMetadata() { - return getRouteMetadata('common', ($) => $['mainNav.home']) + return getRouteMetadata('navigation', ($) => $['mainNav.home']) } export default function Page() { diff --git a/web/app/(shareLayout)/webapp-reset-password/set-password/__tests__/page.spec.tsx b/web/app/(shareLayout)/webapp-reset-password/set-password/__tests__/page.spec.tsx index f35c7269e7c..186b7dcf613 100644 --- a/web/app/(shareLayout)/webapp-reset-password/set-password/__tests__/page.spec.tsx +++ b/web/app/(shareLayout)/webapp-reset-password/set-password/__tests__/page.spec.tsx @@ -42,10 +42,10 @@ describe('Webapp Reset Password Set Password Page', () => { expect(mockUseDocumentTitle).toHaveBeenCalledWith('login.changePassword') - fireEvent.change(screen.getByLabelText('common.account.newPassword'), { + fireEvent.change(screen.getByLabelText('accountSettings.account.newPassword'), { target: { value: 'ValidPass123!' }, }) - fireEvent.change(screen.getByLabelText('common.account.confirmPassword'), { + fireEvent.change(screen.getByLabelText('accountSettings.account.confirmPassword'), { target: { value: 'ValidPass123!' }, }) fireEvent.click(screen.getByRole('button', { name: 'login.changePasswordBtn' })) 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 0eecd9a7571..4f83db7e096 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(['common', 'login']) + const { t } = useTranslation(['common', 'login', 'accountSettings']) const router = useRouter() const searchParams = useSearchParams() const token = decodeURIComponent(searchParams.get('token') || '') @@ -60,7 +60,7 @@ const ChangePasswordForm = () => { return false } if (password !== confirmPassword) { - showErrorMessage(t(($) => $['account.notEqual'], { ns: 'common' })) + showErrorMessage(t(($) => $['account.notEqual'], { ns: 'accountSettings' })) return false } return true @@ -104,7 +104,7 @@ const ChangePasswordForm = () => {
- {t(($) => $['account.newPassword'], { ns: 'common' })} + {t(($) => $['account.newPassword'], { ns: 'accountSettings' })} { - {t(($) => $['account.confirmPassword'], { ns: 'common' })} + {t(($) => $['account.confirmPassword'], { ns: 'accountSettings' })} { render() await user.click( - screen.getByRole('button', { name: 'common.account.changeEmail.sendVerifyCode' }), + screen.getByRole('button', { name: 'accountSettings.account.changeEmail.sendVerifyCode' }), ) const originCode = await screen.findByRole('textbox', { - name: 'common.account.changeEmail.codeLabel', + name: 'accountSettings.account.changeEmail.codeLabel', }) await user.type(originCode, '123456{Enter}') expect(verifyEmail).toHaveBeenCalledWith({ @@ -47,12 +47,12 @@ describe('EmailChangeModal', () => { }) const email = await screen.findByRole('textbox', { - name: 'common.account.changeEmail.emailLabel', + name: 'accountSettings.account.changeEmail.emailLabel', }) await user.type(email, 'new@example.com') await waitFor(() => expect( - screen.getByRole('button', { name: 'common.account.changeEmail.sendVerifyCode' }), + screen.getByRole('button', { name: 'accountSettings.account.changeEmail.sendVerifyCode' }), ).toBeEnabled(), ) await user.type(email, '{Enter}') @@ -63,7 +63,7 @@ describe('EmailChangeModal', () => { }) const newCode = await screen.findByRole('textbox', { - name: 'common.account.changeEmail.codeLabel', + name: 'accountSettings.account.changeEmail.codeLabel', }) expect(newCode).toHaveValue('') await user.type(newCode, '654321{Enter}') @@ -84,22 +84,24 @@ describe('EmailChangeModal', () => { render() await user.click( - screen.getByRole('button', { name: 'common.account.changeEmail.sendVerifyCode' }), + screen.getByRole('button', { name: 'accountSettings.account.changeEmail.sendVerifyCode' }), ) await user.type( - await screen.findByRole('textbox', { name: 'common.account.changeEmail.codeLabel' }), + await screen.findByRole('textbox', { name: 'accountSettings.account.changeEmail.codeLabel' }), '123456{Enter}', ) const email = await screen.findByRole('textbox', { - name: 'common.account.changeEmail.emailLabel', + name: 'accountSettings.account.changeEmail.emailLabel', }) await user.type(email, 'used@example.com') - await screen.findByText('common.account.changeEmail.existingEmail') + await screen.findByText('accountSettings.account.changeEmail.existingEmail') expect(email).toBeInvalid() - expect(email).toHaveAccessibleDescription('common.account.changeEmail.existingEmail') + expect(email).toHaveAccessibleDescription('accountSettings.account.changeEmail.existingEmail') await user.clear(email) expect(email).not.toBeInvalid() - expect(screen.queryByText('common.account.changeEmail.existingEmail')).not.toBeInTheDocument() + expect( + screen.queryByText('accountSettings.account.changeEmail.existingEmail'), + ).not.toBeInTheDocument() }) }) diff --git a/web/app/account/(commonLayout)/account-page/__tests__/index.spec.tsx b/web/app/account/(commonLayout)/account-page/__tests__/index.spec.tsx index 1471c40a596..a03fe5430e7 100644 --- a/web/app/account/(commonLayout)/account-page/__tests__/index.spec.tsx +++ b/web/app/account/(commonLayout)/account-page/__tests__/index.spec.tsx @@ -68,7 +68,7 @@ describe('AccountPage', () => { renderPage() await user.click(screen.getByRole('button', { name: 'common.operation.edit' })) - const nameInput = await screen.findByRole('textbox', { name: 'common.account.name' }) + const nameInput = await screen.findByRole('textbox', { name: 'accountSettings.account.name' }) await user.clear(nameInput) await user.type(nameInput, 'Alice Cooper') await user.click(screen.getByRole('button', { name: 'common.operation.save' })) 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 f62e3c9ce4f..fcd82bf552b 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(['common']) + const { t } = useTranslation(['common', 'accountSettings']) const router = useRouter() const [step, setStep] = useState(STEP.start) const [code, setCode] = useState('') @@ -245,16 +245,16 @@ const EmailChangeModal = ({ onClose, email }: Props) => { {step === STEP.start && ( <> - {t(($) => $['account.changeEmail.title'], { ns: 'common' })} + {t(($) => $['account.changeEmail.title'], { ns: 'accountSettings' })}
- {t(($) => $['account.changeEmail.authTip'], { ns: 'common' })} + {t(($) => $['account.changeEmail.authTip'], { ns: 'accountSettings' })}
$['account.changeEmail.content1']} - ns="common" + ns="accountSettings" components={{ email: , }} @@ -265,7 +265,7 @@ const EmailChangeModal = ({ onClose, email }: Props) => {
- {t(($) => $['account.changeEmail.resendTip'], { ns: 'common' })} + + {t(($) => $['account.changeEmail.resendTip'], { ns: 'accountSettings' })} + {time > 0 && ( - {t(($) => $['account.changeEmail.resendCount'], { ns: 'common', count: time })} + {t(($) => $['account.changeEmail.resendCount'], { + ns: 'accountSettings', + count: time, + })} )} {!time && ( @@ -329,7 +336,7 @@ const EmailChangeModal = ({ onClose, email }: Props) => { onClick={sendCodeToOriginEmail} className="cursor-pointer rounded-sm system-xs-medium text-text-accent-secondary outline-hidden focus-visible:ring-2 focus-visible:ring-state-accent-solid" > - {t(($) => $['account.changeEmail.resend'], { ns: 'common' })} + {t(($) => $['account.changeEmail.resend'], { ns: 'accountSettings' })} )}
@@ -338,21 +345,21 @@ const EmailChangeModal = ({ onClose, email }: Props) => { {step === STEP.newEmail && ( <> - {t(($) => $['account.changeEmail.newEmail'], { ns: 'common' })} + {t(($) => $['account.changeEmail.newEmail'], { ns: 'accountSettings' })}
- {t(($) => $['account.changeEmail.content3'], { ns: 'common' })} + {t(($) => $['account.changeEmail.content3'], { ns: 'accountSettings' })}
- {t(($) => $['account.changeEmail.emailLabel'], { ns: 'common' })} + {t(($) => $['account.changeEmail.emailLabel'], { ns: 'accountSettings' })} $['account.changeEmail.emailPlaceholder'], { - ns: 'common', + ns: 'accountSettings', })} value={mail} onValueChange={(value) => handleNewEmailValueChange(value)} @@ -361,12 +368,12 @@ const EmailChangeModal = ({ onClose, email }: Props) => { /> {newEmailExited && ( - {t(($) => $['account.changeEmail.existingEmail'], { ns: 'common' })} + {t(($) => $['account.changeEmail.existingEmail'], { ns: 'accountSettings' })} )} {unAvailableEmail && ( - {t(($) => $['account.changeEmail.unAvailableEmail'], { ns: 'common' })} + {t(($) => $['account.changeEmail.unAvailableEmail'], { ns: 'accountSettings' })} )} @@ -377,7 +384,7 @@ const EmailChangeModal = ({ onClose, email }: Props) => { variant="primary" type="submit" > - {t(($) => $['account.changeEmail.sendVerifyCode'], { ns: 'common' })} + {t(($) => $['account.changeEmail.sendVerifyCode'], { ns: 'accountSettings' })}
- {t(($) => $['account.changeEmail.resendTip'], { ns: 'common' })} + + {t(($) => $['account.changeEmail.resendTip'], { ns: 'accountSettings' })} + {time > 0 && ( - {t(($) => $['account.changeEmail.resendCount'], { ns: 'common', count: time })} + {t(($) => $['account.changeEmail.resendCount'], { + ns: 'accountSettings', + count: time, + })} )} {!time && ( @@ -441,7 +458,7 @@ const EmailChangeModal = ({ onClose, email }: Props) => { onClick={sendCodeToNewEmail} className="cursor-pointer rounded-sm system-xs-medium text-text-accent-secondary outline-hidden focus-visible:ring-2 focus-visible:ring-state-accent-solid" > - {t(($) => $['account.changeEmail.resend'], { ns: 'common' })} + {t(($) => $['account.changeEmail.resend'], { ns: 'accountSettings' })} )}
diff --git a/web/app/account/(commonLayout)/account-page/index.tsx b/web/app/account/(commonLayout)/account-page/index.tsx index fd8a8c99018..672b647713d 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(['common', 'login']) + const { t } = useTranslation(['common', 'login', 'accountSettings']) const editNameInputId = useId() const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions()) const { data: appList } = useQuery( @@ -111,7 +111,7 @@ export default function AccountPage() { return false } if (password !== confirmPassword) { - showErrorMessage(t(($) => $['account.notEqual'], { ns: 'common' })) + showErrorMessage(t(($) => $['account.notEqual'], { ns: 'accountSettings' })) return false } @@ -168,7 +168,7 @@ export default function AccountPage() { <>

- {t(($) => $['account.myAccount'], { ns: 'common' })} + {t(($) => $['account.myAccount'], { ns: 'accountSettings' })}

@@ -187,7 +187,9 @@ export default function AccountPage() {
-
{t(($) => $['account.name'], { ns: 'common' })}
+
+ {t(($) => $['account.name'], { ns: 'accountSettings' })} +
{userProfile.name} @@ -202,7 +204,9 @@ export default function AccountPage() {
-
{t(($) => $['account.email'], { ns: 'common' })}
+
+ {t(($) => $['account.email'], { ns: 'accountSettings' })} +
{userProfile.email} @@ -222,30 +226,30 @@ export default function AccountPage() {
- {t(($) => $['account.password'], { ns: 'common' })} + {t(($) => $['account.password'], { ns: 'accountSettings' })}
- {t(($) => $['account.passwordTip'], { ns: 'common' })} + {t(($) => $['account.passwordTip'], { ns: 'accountSettings' })}
)}
- {t(($) => $['account.langGeniusAccount'], { ns: 'common' })} + {t(($) => $['account.langGeniusAccount'], { ns: 'accountSettings' })}
- {t(($) => $['account.langGeniusAccountTip'], { ns: 'common' })} + {t(($) => $['account.langGeniusAccountTip'], { ns: 'accountSettings' })}
{!!apps.length && ( $['account.showAppLength'], { ns: 'common', length: apps.length })}`} + title={`${t(($) => $['account.showAppLength'], { ns: 'accountSettings', length: apps.length })}`} items={apps.map((app) => ({ ...app, key: app.id, name: app.name }))} renderItem={renderAppItem} wrapperClassName="mt-2" @@ -256,7 +260,7 @@ export default function AccountPage() { className="mt-2 text-components-button-destructive-secondary-text" onClick={() => setShowDeleteAccountModal(true)} > - {t(($) => $['account.delete'], { ns: 'common' })} + {t(($) => $['account.delete'], { ns: 'accountSettings' })} )}
@@ -266,10 +270,10 @@ export default function AccountPage() { >
- {t(($) => $['account.editName'], { ns: 'common' })} + {t(($) => $['account.editName'], { ns: 'accountSettings' })}
{userProfile.is_password_set - ? t(($) => $['account.resetPassword'], { ns: 'common' }) - : t(($) => $['account.setPassword'], { ns: 'common' })} + ? t(($) => $['account.resetPassword'], { ns: 'accountSettings' }) + : t(($) => $['account.setPassword'], { ns: 'accountSettings' })}
{userProfile.is_password_set && ( - {t(($) => $['account.currentPassword'], { ns: 'common' })} + {t(($) => $['account.currentPassword'], { ns: 'accountSettings' })} {userProfile.is_password_set - ? t(($) => $['account.newPassword'], { ns: 'common' }) - : t(($) => $['account.password'], { ns: 'common' })} + ? t(($) => $['account.newPassword'], { ns: 'accountSettings' }) + : t(($) => $['account.password'], { ns: 'accountSettings' })} - {t(($) => $['account.confirmPassword'], { ns: 'common' })} + {t(($) => $['account.confirmPassword'], { ns: 'accountSettings' })} { render() - const input = screen.getByRole('textbox', { name: 'common.account.deleteLabel' }) + const input = screen.getByRole('textbox', { name: 'accountSettings.account.deleteLabel' }) const submitButton = screen.getByRole('button', { - name: 'common.account.sendVerificationButton', + name: 'accountSettings.account.sendVerificationButton', }) await user.type(input, 'someone@example.com{Enter}') diff --git a/web/app/account/(commonLayout)/delete-account/components/__tests__/feed-back.spec.tsx b/web/app/account/(commonLayout)/delete-account/components/__tests__/feed-back.spec.tsx index 2a5649f7fff..cb2ba95c48b 100644 --- a/web/app/account/(commonLayout)/delete-account/components/__tests__/feed-back.spec.tsx +++ b/web/app/account/(commonLayout)/delete-account/components/__tests__/feed-back.spec.tsx @@ -52,7 +52,7 @@ describe('FeedBack', () => { render() - const feedback = screen.getByRole('textbox', { name: 'common.account.feedbackLabel' }) + const feedback = screen.getByRole('textbox', { name: 'accountSettings.account.feedbackLabel' }) await user.type(feedback, 'The workspace is no longer needed.') await user.click(screen.getByRole('button', { name: 'common.operation.submit' })) diff --git a/web/app/account/(commonLayout)/delete-account/components/__tests__/verify-email.spec.tsx b/web/app/account/(commonLayout)/delete-account/components/__tests__/verify-email.spec.tsx index 1602a02bbb5..ca591fa0036 100644 --- a/web/app/account/(commonLayout)/delete-account/components/__tests__/verify-email.spec.tsx +++ b/web/app/account/(commonLayout)/delete-account/components/__tests__/verify-email.spec.tsx @@ -31,18 +31,18 @@ describe('VerifyEmail', () => { render() - const input = screen.getByLabelText('common.account.verificationLabel') + const input = screen.getByLabelText('accountSettings.account.verificationLabel') const submitButton = screen.getByRole('button', { - name: 'common.account.permanentlyDeleteButton', + name: 'accountSettings.account.permanentlyDeleteButton', }) expect(submitButton).toBeEnabled() await user.click(submitButton) - const errors = await screen.findAllByText('common.account.verificationPlaceholder') + const errors = await screen.findAllByText('accountSettings.account.verificationPlaceholder') expect(errors).toHaveLength(1) expect(input).toHaveAttribute('aria-invalid', 'true') - expect(input).toHaveAccessibleDescription('common.account.verificationPlaceholder') + expect(input).toHaveAccessibleDescription('accountSettings.account.verificationPlaceholder') expect(input).toHaveFocus() expect(mockConfirmDeleteAccount).not.toHaveBeenCalled() 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 384996e0b81..62d5820eb92 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(['common']) + const { t } = useTranslation(['common', 'accountSettings']) const { data: userProfileEmail } = useSuspenseQuery({ ...userProfileQueryOptions(), select: (data) => data.profile.email, @@ -44,20 +44,22 @@ export default function CheckEmail(props: DeleteAccountProps) { }} >
- {t(($) => $['account.deleteTip'], { ns: 'common' })} + {t(($) => $['account.deleteTip'], { ns: 'accountSettings' })}
- {t(($) => $['account.deletePrivacyLinkTip'], { ns: 'common' })} + {t(($) => $['account.deletePrivacyLinkTip'], { ns: 'accountSettings' })} - {t(($) => $['account.deletePrivacyLink'], { ns: 'common' })} + {t(($) => $['account.deletePrivacyLink'], { ns: 'accountSettings' })}
- {t(($) => $['account.deleteLabel'], { ns: 'common' })} + {t(($) => $['account.deleteLabel'], { ns: 'accountSettings' })} $['account.deletePlaceholder'], { ns: 'common' }) as string} + placeholder={ + t(($) => $['account.deletePlaceholder'], { ns: 'accountSettings' }) as string + } value={userInputEmail} onValueChange={setUserInputEmail} /> @@ -70,7 +72,7 @@ export default function CheckEmail(props: DeleteAccountProps) { loading={isSendingEmail} variant="primary" > - {t(($) => $['account.sendVerificationButton'], { ns: 'common' })} + {t(($) => $['account.sendVerificationButton'], { ns: 'accountSettings' })}