From 65f4f05c04a94c4b5e43b5e4535049f8520d8edd Mon Sep 17 00:00:00 2001 From: JimmFly Date: Tue, 31 Jan 2023 15:29:04 +0800 Subject: [PATCH] chore: add translation function --- packages/app/src/components/404/index.tsx | 2 +- .../app/src/components/create-workspace/index.tsx | 7 ++----- packages/app/src/components/login-modal/index.tsx | 6 ++++-- packages/app/src/components/logout-modal/index.tsx | 12 +++++++----- .../app/src/components/workspace-modal/index.tsx | 8 +++----- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/packages/app/src/components/404/index.tsx b/packages/app/src/components/404/index.tsx index 36f1b90a34..0a06467afa 100644 --- a/packages/app/src/components/404/index.tsx +++ b/packages/app/src/components/404/index.tsx @@ -15,7 +15,7 @@ export const NotfoundPage = () => { router.push('/workspace'); }} > - Back Home + {t('Back Home')}

diff --git a/packages/app/src/components/create-workspace/index.tsx b/packages/app/src/components/create-workspace/index.tsx index 9a26b56863..11aa3de52b 100644 --- a/packages/app/src/components/create-workspace/index.tsx +++ b/packages/app/src/components/create-workspace/index.tsx @@ -53,13 +53,10 @@ export const CreateWorkspaceModal = ({ open, onClose }: ModalProps) => { {t('New Workspace')} -

- Workspace is your virtual space to capture, create and plan as - just one person or together as a team. -

+

{t('Workspace description')}

{ setWorkspaceName(value); }} diff --git a/packages/app/src/components/login-modal/index.tsx b/packages/app/src/components/login-modal/index.tsx index f6dedd7cd8..8c15c24417 100644 --- a/packages/app/src/components/login-modal/index.tsx +++ b/packages/app/src/components/login-modal/index.tsx @@ -2,6 +2,7 @@ import { styled } from '@/styles'; import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal'; import { GoogleLoginButton } from './LoginOptionButton'; import { useAppState } from '@/providers/app-state-provider'; +import { useTranslation } from '@affine/i18n'; interface LoginModalProps { open: boolean; onClose: () => void; @@ -9,6 +10,7 @@ interface LoginModalProps { export const LoginModal = ({ open, onClose }: LoginModalProps) => { const { login } = useAppState(); + const { t } = useTranslation(); return ( @@ -20,8 +22,8 @@ export const LoginModal = ({ open, onClose }: LoginModalProps) => { /> - {'Sign in'} - Set up an AFFINE account to sync data + {t('Sign in')} + {t('Set up an AFFiNE account to sync data')} { await login(); diff --git a/packages/app/src/components/logout-modal/index.tsx b/packages/app/src/components/logout-modal/index.tsx index 0aaee3968e..b317f1183c 100644 --- a/packages/app/src/components/logout-modal/index.tsx +++ b/packages/app/src/components/logout-modal/index.tsx @@ -3,6 +3,7 @@ import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal'; import { Button } from '@/ui/button'; import { Check, UnCheck } from './icon'; import { useState } from 'react'; +import { useTranslation } from '@affine/i18n'; interface LoginModalProps { open: boolean; onClose: (wait: boolean) => void; @@ -10,6 +11,7 @@ interface LoginModalProps { export const LogoutModal = ({ open, onClose }: LoginModalProps) => { const [localCache, setLocalCache] = useState(false); + const { t } = useTranslation(); return ( @@ -21,8 +23,8 @@ export const LogoutModal = ({ open, onClose }: LoginModalProps) => { /> - {'Sign out?'} - Set up an AFFINE account to sync data + {t('Sign out')}? + {t('Set up an AFFiNE account to sync data')} {localCache ? ( { )} - Retain local cached data + {t('Retain local cached data')}
diff --git a/packages/app/src/components/workspace-modal/index.tsx b/packages/app/src/components/workspace-modal/index.tsx index 93b1bb7279..4ebce59edf 100644 --- a/packages/app/src/components/workspace-modal/index.tsx +++ b/packages/app/src/components/workspace-modal/index.tsx @@ -59,9 +59,7 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => { {t('My Workspaces')} @@ -108,8 +106,8 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => { - New workspace -

Crete or import

+ {t('New Workspace')} +

{t('Create Or Import')}