There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
chore: add translation (#2001)
JimmFly346484ed4452
diff --git a/apps/web/src/components/pure/help-island/index.tsx b/apps/web/src/components/pure/help-island/index.tsxindex cddb89265d..51fb0ebca5 100644--- a/apps/web/src/components/pure/help-island/index.tsx+++ b/apps/web/src/components/pure/help-island/index.tsx@@ -58,7 +58,7 @@ export const HelpIsland = ({style={{ height: spread ? `${showList.length * 44}px` : 0 }}>{showList.includes('whatNew') && (- <Tooltip content={t("Discover what's new")} placement="left-end">+ <Tooltip content={t("Discover what's new!")} placement="left-end"><StyledIconWrapperdata-testid="right-bottom-change-log-icon"onClick={() => {diff --git a/apps/web/src/layouts/workspace-layout.tsx b/apps/web/src/layouts/workspace-layout.tsxindex c9364f0720..6fb1d58e59 100644--- a/apps/web/src/layouts/workspace-layout.tsx+++ b/apps/web/src/layouts/workspace-layout.tsx@@ -153,21 +153,22 @@ export const CurrentWorkspaceContext = ({useRouterWithWorkspaceIdDefense(router);const metadata = useAtomValue(rootWorkspacesMetadataAtom);const exist = metadata.find(m => m.id === workspaceId);+ const { t } = useTranslation();if (!router.isReady) {- return <PageLoading text="Router is loading" />;+ return <PageLoading text={t('Router is Loading')} />;}if (!workspaceId) {- return <PageLoading text="Finding workspace id" />;+ return <PageLoading text={t('Finding Workspace ID')} />;}if (!exist) {- return <PageLoading text="Workspace not found" />;+ return <PageLoading text={t('Workspace Not Found')} />;}return <>{children}</>;};export const WorkspaceLayout: FC<PropsWithChildren> =function WorkspacesSuspense({ children }) {- const { i18n } = useTranslation();+ const { i18n, t } = useTranslation();useEffect(() => {document.documentElement.lang = i18n.language;// todo(himself65): this is a hack, we should use a better way to set the language@@ -236,7 +237,9 @@ export const WorkspaceLayout: FC<PropsWithChildren> =</CurrentWorkspaceContext></AllWorkspaceContext><CurrentWorkspaceContext>- <Suspense fallback={<PageLoading text="Finding current workspace" />}>+ <Suspense+ fallback={<PageLoading text={t('Finding Current Workspace')} />}+ ><WorkspaceLayoutInner>{children}</WorkspaceLayoutInner></Suspense></CurrentWorkspaceContext>@@ -251,6 +254,7 @@ export const WorkspaceLayoutInner: FC<PropsWithChildren> = ({ children }) => {const router = useRouter();const { jumpToPage } = useRouterHelper(router);const [isLoading, setIsLoading] = useState(true);+ const { t } = useTranslation();useEffect(() => {logger.info('currentWorkspace: ', currentWorkspace);@@ -437,8 +441,12 @@ export const WorkspaceLayoutInner: FC<PropsWithChildren> = ({ children }) => {</StyledSpacer><MainContainerWrapper resizing={resizing} style={{ width: mainWidth }}><MainContainer className="main-container">- <Suspense fallback={<PageLoading text="Page is Loading" />}>- {isLoading ? <PageLoading text="Page is Loading" /> : children}+ <Suspense fallback={<PageLoading text={t('Page is Loading')} />}>+ {isLoading ? (+ <PageLoading text={t('Page is Loading')} />+ ) : (+ children+ )}</Suspense><StyledToolWrapper>{/* fixme(himself65): remove this */}diff --git a/apps/web/src/pages/index.tsx b/apps/web/src/pages/index.tsxindex 01977d62d7..f5490b54d7 100644--- a/apps/web/src/pages/index.tsx+++ b/apps/web/src/pages/index.tsx@@ -1,7 +1,8 @@import { DebugLogger } from '@affine/debug';+import { useTranslation } from '@affine/i18n';import type { NextPage } from 'next';import { useRouter } from 'next/router';-import React, { Suspense, useEffect } from 'react';+import { Suspense, useEffect } from 'react';import { PageLoading } from '../components/pure/loading';import { useLastWorkspaceId } from '../hooks/affine/use-last-leave-workspace-id';@@ -62,8 +63,9 @@ const IndexPageInner = () => {};const IndexPage: NextPage = () => {+ const { t } = useTranslation();return (- <Suspense fallback={<PageLoading text="Loading all workspaces" />}>+ <Suspense fallback={<PageLoading text={t('Loading All Workspaces')} />}><IndexPageInner /></Suspense>);diff --git a/apps/web/src/pages/workspace/[workspaceId]/[pageId].tsx b/apps/web/src/pages/workspace/[workspaceId]/[pageId].tsxindex fb74348073..afe722d277 100644--- a/apps/web/src/pages/workspace/[workspaceId]/[pageId].tsx+++ b/apps/web/src/pages/workspace/[workspaceId]/[pageId].tsx@@ -1,3 +1,4 @@+import { useTranslation } from '@affine/i18n';import { rootCurrentPageIdAtom } from '@affine/workspace/atom';import { WorkspaceFlavour } from '@affine/workspace/type';import { assertExists } from '@blocksuite/store';@@ -40,6 +41,7 @@ const WorkspaceDetail: React.FC = () => {const { openPage } = useRouterHelper(router);const currentPageId = useAtomValue(rootCurrentPageIdAtom);const [currentWorkspace] = useCurrentWorkspace();+ const { t } = useTranslation();assertExists(currentWorkspace);const blockSuiteWorkspace = currentWorkspace.blockSuiteWorkspace;const { setPageMeta, getPageMeta } = usePageMetaHelper(blockSuiteWorkspace);@@ -84,7 +86,7 @@ const WorkspaceDetail: React.FC = () => {}}, [currentWorkspace]);if (!currentPageId) {- return <PageLoading text="Loading page." />;+ return <PageLoading text={t('Loading Page')} />;}if (currentWorkspace.flavour === WorkspaceFlavour.AFFINE) {const PageDetail = WorkspacePlugins[currentWorkspace.flavour].UI.PageDetail;@@ -110,15 +112,16 @@ const WorkspaceDetailPage: NextPageWithLayout = () => {const router = useRouter();const currentWorkspace = useAtomValue(rootCurrentWorkspaceAtom);const currentPageId = useAtomValue(rootCurrentPageIdAtom);+ const { t } = useTranslation();useRouterAndWorkspaceWithPageIdDefense(router);const page = useBlockSuiteWorkspacePage(currentWorkspace.blockSuiteWorkspace,currentPageId);if (!router.isReady) {- return <PageLoading text="Router is loading" />;+ return <PageLoading text={t('Router is Loading')} />;} else if (!currentPageId || !page) {- return <PageLoading text="Page is loading" />;+ return <PageLoading text={t('Page is Loading')} />;}return <WorkspaceDetail />;};diff --git a/packages/i18n/src/resources/en.json b/packages/i18n/src/resources/en.jsonindex 286036d9aa..a885ff99ef 100644--- a/packages/i18n/src/resources/en.json+++ b/packages/i18n/src/resources/en.json@@ -219,5 +219,12 @@"Shared Pages In Public Workspace Description": "The entire Workspace is published on the web and can be edited via <1>Workspace Settings</1>.","Open Workspace Settings": "Open Workspace Settings","Share Menu Public Workspace Description1": "Invite others to join the Workspace or publish it to web.",- "Share Menu Public Workspace Description2": "Current workspace has been published to the web as a public workspace."+ "Share Menu Public Workspace Description2": "Current workspace has been published to the web as a public workspace.",+ "Router is Loading": "Router is Loading",+ "Finding Workspace ID": "Finding Workspace ID",+ "Workspace Not Found": "Workspace Not Found",+ "Finding Current Workspace": "Finding Current Workspace",+ "Page is Loading": "Page is Loading",+ "Loading All Workspaces": "Loading All Workspaces",+ "Loading Page": "Loading Page"}