chore: add translation function

This commit is contained in:
JimmFly
2023-01-31 15:29:04 +08:00
parent 61b8299e3e
commit 65f4f05c04
5 changed files with 17 additions and 18 deletions

View File

@@ -15,7 +15,7 @@ export const NotfoundPage = () => {
router.push('/workspace'); router.push('/workspace');
}} }}
> >
Back Home {t('Back Home')}
</Button> </Button>
</p> </p>
</NotFoundTitle> </NotFoundTitle>

View File

@@ -53,13 +53,10 @@ export const CreateWorkspaceModal = ({ open, onClose }: ModalProps) => {
</Header> </Header>
<Content> <Content>
<ContentTitle>{t('New Workspace')}</ContentTitle> <ContentTitle>{t('New Workspace')}</ContentTitle>
<p> <p>{t('Workspace description')}</p>
Workspace is your virtual space to capture, create and plan as
just one person or together as a team.
</p>
<Input <Input
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
placeholder={'Set a Workspace name'} placeholder={t('Set a Workspace name')}
onChange={value => { onChange={value => {
setWorkspaceName(value); setWorkspaceName(value);
}} }}

View File

@@ -2,6 +2,7 @@ import { styled } from '@/styles';
import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal'; import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal';
import { GoogleLoginButton } from './LoginOptionButton'; import { GoogleLoginButton } from './LoginOptionButton';
import { useAppState } from '@/providers/app-state-provider'; import { useAppState } from '@/providers/app-state-provider';
import { useTranslation } from '@affine/i18n';
interface LoginModalProps { interface LoginModalProps {
open: boolean; open: boolean;
onClose: () => void; onClose: () => void;
@@ -9,6 +10,7 @@ interface LoginModalProps {
export const LoginModal = ({ open, onClose }: LoginModalProps) => { export const LoginModal = ({ open, onClose }: LoginModalProps) => {
const { login } = useAppState(); const { login } = useAppState();
const { t } = useTranslation();
return ( return (
<Modal open={open} onClose={onClose} data-testid="login-modal"> <Modal open={open} onClose={onClose} data-testid="login-modal">
<ModalWrapper width={560} height={292}> <ModalWrapper width={560} height={292}>
@@ -20,8 +22,8 @@ export const LoginModal = ({ open, onClose }: LoginModalProps) => {
/> />
</Header> </Header>
<Content> <Content>
<ContentTitle>{'Sign in'}</ContentTitle> <ContentTitle>{t('Sign in')}</ContentTitle>
<SignDes>Set up an AFFINE account to sync data</SignDes> <SignDes>{t('Set up an AFFiNE account to sync data')}</SignDes>
<span <span
onClick={async () => { onClick={async () => {
await login(); await login();

View File

@@ -3,6 +3,7 @@ import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal';
import { Button } from '@/ui/button'; import { Button } from '@/ui/button';
import { Check, UnCheck } from './icon'; import { Check, UnCheck } from './icon';
import { useState } from 'react'; import { useState } from 'react';
import { useTranslation } from '@affine/i18n';
interface LoginModalProps { interface LoginModalProps {
open: boolean; open: boolean;
onClose: (wait: boolean) => void; onClose: (wait: boolean) => void;
@@ -10,6 +11,7 @@ interface LoginModalProps {
export const LogoutModal = ({ open, onClose }: LoginModalProps) => { export const LogoutModal = ({ open, onClose }: LoginModalProps) => {
const [localCache, setLocalCache] = useState(false); const [localCache, setLocalCache] = useState(false);
const { t } = useTranslation();
return ( return (
<Modal open={open} onClose={onClose} data-testid="logout-modal"> <Modal open={open} onClose={onClose} data-testid="logout-modal">
<ModalWrapper width={560} height={292}> <ModalWrapper width={560} height={292}>
@@ -21,8 +23,8 @@ export const LogoutModal = ({ open, onClose }: LoginModalProps) => {
/> />
</Header> </Header>
<Content> <Content>
<ContentTitle>{'Sign out?'}</ContentTitle> <ContentTitle>{t('Sign out')}?</ContentTitle>
<SignDes>Set up an AFFINE account to sync data</SignDes> <SignDes>{t('Set up an AFFiNE account to sync data')}</SignDes>
<StyleTips> <StyleTips>
{localCache ? ( {localCache ? (
<StyleCheck <StyleCheck
@@ -41,7 +43,7 @@ export const LogoutModal = ({ open, onClose }: LoginModalProps) => {
<UnCheck></UnCheck> <UnCheck></UnCheck>
</StyleCheck> </StyleCheck>
)} )}
Retain local cached data {t('Retain local cached data')}
</StyleTips> </StyleTips>
<div> <div>
<Button <Button
@@ -51,7 +53,7 @@ export const LogoutModal = ({ open, onClose }: LoginModalProps) => {
onClose(true); onClose(true);
}} }}
> >
Wait for Sync {t('Wait for Sync')}
</Button> </Button>
<Button <Button
type="danger" type="danger"
@@ -60,7 +62,7 @@ export const LogoutModal = ({ open, onClose }: LoginModalProps) => {
onClose(false); onClose(false);
}} }}
> >
Force Sign Out {t('Force Sign Out')}
</Button> </Button>
</div> </div>
</Content> </Content>

View File

@@ -59,9 +59,7 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => {
<StyledModalHeaderLeft> <StyledModalHeaderLeft>
<StyledModalTitle>{t('My Workspaces')}</StyledModalTitle> <StyledModalTitle>{t('My Workspaces')}</StyledModalTitle>
<Tooltip <Tooltip
content={t( content={t('Workspace description')}
'A workspace is your virtual space to capture, create and plan as just one person or together as a team.'
)}
placement="top-start" placement="top-start"
disablePortal={true} disablePortal={true}
> >
@@ -108,8 +106,8 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => {
</Wrapper> </Wrapper>
<StyleWorkspaceInfo> <StyleWorkspaceInfo>
<StyleWorkspaceTitle>New workspace</StyleWorkspaceTitle> <StyleWorkspaceTitle>{t('New Workspace')}</StyleWorkspaceTitle>
<p>Crete or import</p> <p>{t('Create Or Import')}</p>
</StyleWorkspaceInfo> </StyleWorkspaceInfo>
</StyledCard> </StyledCard>
</StyledModalContent> </StyledModalContent>