From 9fe4b066f9a3b5af14883d3e1697b70016e36407 Mon Sep 17 00:00:00 2001 From: JimmFly Date: Tue, 10 Jan 2023 14:29:18 +0800 Subject: [PATCH 1/2] chore: update i18n keys --- packages/app/src/components/header/Header.tsx | 4 +- packages/app/src/components/header/utils.tsx | 15 ++--- .../src/components/invite-members/index.tsx | 10 ++-- .../src/components/loading/PageLoading.tsx | 6 +- .../login-modal/LoginOptionButton.tsx | 14 +++-- .../app/src/components/login-modal/index.tsx | 7 ++- .../app/src/components/mobile-modal/index.tsx | 13 ++-- .../app/src/components/page-list/Empty.tsx | 11 +++- .../app/src/components/page-list/index.tsx | 4 +- .../app/src/components/quick-search/Input.tsx | 8 ++- .../src/components/workspace-modal/index.tsx | 17 +++--- .../workspace-setting/ExportPage.tsx | 11 +++- .../workspace-setting/MembersPage.tsx | 28 +++++---- .../workspace-setting/PublishPage.tsx | 28 ++++----- .../components/workspace-setting/SyncPage.tsx | 2 + .../workspace-setting/general/General.tsx | 16 ++--- .../general/delete/Delete.tsx | 34 +++++++---- .../workspace-setting/general/leave/Leave.tsx | 11 ++-- .../components/workspace-slider-bar/index.tsx | 2 +- packages/app/src/libs/i18n/resources/en.json | 59 ++++++++++++++++++- .../src/pages/workspace/[workspaceId]/all.tsx | 1 + .../workspace/[workspaceId]/favorite.tsx | 5 +- .../pages/workspace/[workspaceId]/trash.tsx | 6 +- 23 files changed, 210 insertions(+), 102 deletions(-) diff --git a/packages/app/src/components/header/Header.tsx b/packages/app/src/components/header/Header.tsx index 9db8149d5e..41fced5907 100644 --- a/packages/app/src/components/header/Header.tsx +++ b/packages/app/src/components/header/Header.tsx @@ -7,7 +7,7 @@ import { StyledCloseButton, } from './styles'; import CloseIcon from '@mui/icons-material/Close'; -import { getWarningMessage, shouldShowWarning } from './utils'; +import { useWarningMessage, shouldShowWarning } from './utils'; import EditorOptionMenu from './header-right-items/EditorOptionMenu'; import TrashButtonGroup from './header-right-items/TrashButtonGroup'; import ThemeModeSwitch from './header-right-items/theme-mode-switch'; @@ -22,7 +22,7 @@ const BrowserWarning = ({ }) => { return ( - {getWarningMessage()} + {useWarningMessage()} diff --git a/packages/app/src/components/header/utils.tsx b/packages/app/src/components/header/utils.tsx index dd9ff50127..30f67418bd 100644 --- a/packages/app/src/components/header/utils.tsx +++ b/packages/app/src/components/header/utils.tsx @@ -1,4 +1,5 @@ import getIsMobile from '@/utils/get-is-mobile'; +import { Trans, useTranslation } from 'react-i18next'; // Inspire by https://stackoverflow.com/a/4900484/8415727 const getChromeVersion = () => { const raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./); @@ -19,20 +20,20 @@ export const shouldShowWarning = () => { ); }; -export const getWarningMessage = () => { +export const useWarningMessage = () => { + const { t } = useTranslation(); if (!getIsChrome()) { return ( - We recommend the Chrome browser for optimal experience. + + We recommend the Chrome browser for optimal + experience. + ); } if (getChromeVersion() < minimumChromeVersion) { - return ( - - Please upgrade to the latest version of Chrome for the best experience. - - ); + return {t('upgradeBrowser')}; } return ''; }; diff --git a/packages/app/src/components/invite-members/index.tsx b/packages/app/src/components/invite-members/index.tsx index 6fb020fc52..6190649a9b 100644 --- a/packages/app/src/components/invite-members/index.tsx +++ b/packages/app/src/components/invite-members/index.tsx @@ -7,6 +7,7 @@ import { useState } from 'react'; // import { getDataCenter } from '@affine/datacenter'; import { Avatar } from '@mui/material'; import { setMember } from '@/hooks/mock-data/mock'; +import { useTranslation } from 'react-i18next'; interface LoginModalProps { open: boolean; onClose: () => void; @@ -54,6 +55,7 @@ export const InviteMembers = ({ const [showTip, setShowTip] = useState(false); // eslint-disable-next-line @typescript-eslint/no-explicit-any const [userData, setUserData] = useState({}); + const { t } = useTranslation(); const inputChange = (value: string) => { setShowMember(true); if (gmailReg.test(value)) { @@ -101,7 +103,7 @@ export const InviteMembers = ({ /> - Invite members + {t('Invite Members')} { setShowMember(false); }} - placeholder="Search mail (Gmail support only)" + placeholder={t('Invite placeholder')} > {showMember ? ( {showTip ? ( - Non-Gmail is not supported + {t('Non-Gmail is not supported')} ) : ( {userData?.avatar_url ? ( @@ -154,7 +156,7 @@ export const InviteMembers = ({ // }); }} > - Invite + {t('Invite')} diff --git a/packages/app/src/components/loading/PageLoading.tsx b/packages/app/src/components/loading/PageLoading.tsx index 025eba7687..0369d19b6f 100644 --- a/packages/app/src/components/loading/PageLoading.tsx +++ b/packages/app/src/components/loading/PageLoading.tsx @@ -1,5 +1,6 @@ import { styled } from '@/styles'; import Loading from './Loading'; +import { useTranslation } from 'react-i18next'; // Used for the full page loading const StyledLoadingContainer = styled('div')(() => { @@ -17,12 +18,13 @@ const StyledLoadingContainer = styled('div')(() => { }; }); -export const PageLoading = ({ text = 'Loading...' }: { text?: string }) => { +export const PageLoading = ({ text }: { text?: string }) => { + const { t } = useTranslation(); return (
-

{text}

+

{text ? text : t('Loading')}

); diff --git a/packages/app/src/components/login-modal/LoginOptionButton.tsx b/packages/app/src/components/login-modal/LoginOptionButton.tsx index c1384bc8eb..3da3010127 100644 --- a/packages/app/src/components/login-modal/LoginOptionButton.tsx +++ b/packages/app/src/components/login-modal/LoginOptionButton.tsx @@ -3,9 +3,10 @@ import { styled } from '@/styles'; import { Button } from '@/ui/button'; // import { useModal } from '@/providers/GlobalModalProvider'; import { GoogleIcon, StayLogOutIcon } from './Icons'; - +import { useTranslation } from 'react-i18next'; export const GoogleLoginButton = () => { // const { triggerLoginModal } = useModal(); + const { t } = useTranslation(); return ( { @@ -24,8 +25,10 @@ export const GoogleLoginButton = () => { - Continue with Google - Set up an AFFiNE account to sync data + {t('Continue with Google')} + + {t('Set up an AFFiNE account to sync data')} + @@ -33,6 +36,7 @@ export const GoogleLoginButton = () => { }; export const StayLogOutButton = () => { + const { t } = useTranslation(); return ( @@ -40,8 +44,8 @@ export const StayLogOutButton = () => { - Stay logged out - All changes are saved locally + {t('Stay logged out')} + {t('All changes are saved locally')} diff --git a/packages/app/src/components/login-modal/index.tsx b/packages/app/src/components/login-modal/index.tsx index f398383196..1af4aab2ae 100644 --- a/packages/app/src/components/login-modal/index.tsx +++ b/packages/app/src/components/login-modal/index.tsx @@ -3,13 +3,14 @@ import { styled } from '@/styles'; import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal'; import { TextButton } from '@/ui/button'; import { GoogleLoginButton, StayLogOutButton } from './LoginOptionButton'; - +import { useTranslation } from 'react-i18next'; interface LoginModalProps { open: boolean; onClose: () => void; } export const LoginModal = ({ open, onClose }: LoginModalProps) => { + const { t } = useTranslation(); return ( @@ -23,12 +24,12 @@ export const LoginModal = ({ open, onClose }: LoginModalProps) => { /> - Currently not logged in + {t('NotLoggedIn')}
- }>Clear local data + }>{t('ClearData')}
diff --git a/packages/app/src/components/mobile-modal/index.tsx b/packages/app/src/components/mobile-modal/index.tsx index ff9796359b..9142a5f170 100644 --- a/packages/app/src/components/mobile-modal/index.tsx +++ b/packages/app/src/components/mobile-modal/index.tsx @@ -3,8 +3,10 @@ import Modal, { ModalCloseButton, ModalWrapper } from '@/ui/modal'; import getIsMobile from '@/utils/get-is-mobile'; import { StyledButton, StyledContent, StyledTitle } from './styles'; import bg from './bg.png'; +import { useTranslation } from 'react-i18next'; export const MobileModal = () => { const [showModal, setShowModal] = useState(getIsMobile()); + const { t } = useTranslation(); return ( { }} /> - Ooops! + {t('Ooops!')} -

Looks like you are browsing on a mobile device.

-

- We are still working on mobile support and recommend you use a - desktop device. -

+

{t('mobile device')}

+

{t('mobile device description')}

{ setShowModal(false); }} > - Got it + {t('Got it')}
diff --git a/packages/app/src/components/page-list/Empty.tsx b/packages/app/src/components/page-list/Empty.tsx index ef13e1b117..f7a4e838b4 100644 --- a/packages/app/src/components/page-list/Empty.tsx +++ b/packages/app/src/components/page-list/Empty.tsx @@ -1,6 +1,9 @@ import React from 'react'; import { Empty } from '@/ui/empty'; -export const PageListEmpty = () => { +import { useTranslation } from 'react-i18next'; +export const PageListEmpty = (props: { listType: string }) => { + const { listType } = props; + const { t } = useTranslation(); return (
{ height={300} sx={{ marginTop: '100px', marginBottom: '30px' }} /> -

Tips: Click Add to Favourites/Trash and the page will appear here.

-

(Designer is grappling with designing)

+ {listType === 'all' &&

{t('emptyAllPages')}

} + {listType === 'favorite' &&

{t('emptyFavourite')}

} + {listType === 'trash' &&

{t('emptyTrash')}

} +

{t('still designed')}

); }; diff --git a/packages/app/src/components/page-list/index.tsx b/packages/app/src/components/page-list/index.tsx index 429ee6bbb9..1423406d58 100644 --- a/packages/app/src/components/page-list/index.tsx +++ b/packages/app/src/components/page-list/index.tsx @@ -67,16 +67,18 @@ export const PageList = ({ pageList, showFavoriteTag = false, isTrash = false, + listType, }: { pageList: PageMeta[]; showFavoriteTag?: boolean; isTrash?: boolean; + listType?: 'all' | 'trash' | 'favorite'; }) => { const router = useRouter(); const { currentWorkspaceId } = useAppState(); const { t } = useTranslation(); if (pageList.length === 0) { - return ; + return ; } return ( diff --git a/packages/app/src/components/quick-search/Input.tsx b/packages/app/src/components/quick-search/Input.tsx index 69d47a16a1..960f764c2c 100644 --- a/packages/app/src/components/quick-search/Input.tsx +++ b/packages/app/src/components/quick-search/Input.tsx @@ -9,6 +9,7 @@ import { SearchIcon } from '@blocksuite/icons'; import { StyledInputContent, StyledLabel } from './style'; import { Command } from 'cmdk'; import { useAppState } from '@/providers/app-state-provider'; +import { useTranslation } from 'react-i18next'; export const Input = (props: { query: string; setQuery: Dispatch>; @@ -17,6 +18,7 @@ export const Input = (props: { const [isComposition, setIsComposition] = useState(false); const [inputValue, setInputValue] = useState(''); const inputRef = useRef(null); + const { t } = useTranslation(); const { currentWorkspaceId, workspaceList, currentWorkspace } = useAppState(); const isPublish = workspaceList.find( meta => String(meta.id) === String(currentWorkspaceId) @@ -80,8 +82,10 @@ export const Input = (props: { }} placeholder={ isPublish - ? `Search in ${currentWorkspace?.meta.name}` - : 'Quick Search...' + ? t('Quick search placeholder2', { + workspace = currentWorkspace?.meta.name, + }) + : t('Quick search placeholder') } /> diff --git a/packages/app/src/components/workspace-modal/index.tsx b/packages/app/src/components/workspace-modal/index.tsx index 641d8fbd30..40142a256d 100644 --- a/packages/app/src/components/workspace-modal/index.tsx +++ b/packages/app/src/components/workspace-modal/index.tsx @@ -16,7 +16,7 @@ import { WorkspaceAvatar } from '@/components/workspace-avatar'; import { useAppState } from '@/providers/app-state-provider'; import { useRouter } from 'next/router'; import { useUserHelper } from '@/hooks/use-user-helper'; - +import { useTranslation } from 'react-i18next'; interface WorkspaceModalProps { open: boolean; onClose: () => void; @@ -28,6 +28,7 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => { const { workspaceList, currentWorkspace } = useAppState(); const { login, user } = useUserHelper(); const router = useRouter(); + const { t } = useTranslation(); return (
@@ -36,7 +37,7 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => { style={{ padding: '10px', display: 'flex', flexDirection: 'column' }} >
- My Workspaces + {t('My Workspaces')} {/* */} { marginRight: '10px', }} /> - Create Or Import + {t('Create Or Import')}

- Tips:Workspace is your virtual space to capture, create and plan - as just one person or together as a team. + {t('Tips')} + {t('Workspace description')}

@@ -135,10 +136,10 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => { ) : ( )}
diff --git a/packages/app/src/components/workspace-setting/ExportPage.tsx b/packages/app/src/components/workspace-setting/ExportPage.tsx index 85d2b52799..fc95c119f2 100644 --- a/packages/app/src/components/workspace-setting/ExportPage.tsx +++ b/packages/app/src/components/workspace-setting/ExportPage.tsx @@ -1,6 +1,6 @@ import { styled } from '@/styles'; import { Workspace } from '@affine/datacenter'; - +import { Trans } from 'react-i18next'; export const ExportPageTitleContainer = styled('div')(() => { return { display: 'flex', @@ -12,8 +12,13 @@ export const ExportPageTitleContainer = styled('div')(() => { export const ExportPage = ({ workspace }: { workspace: Workspace }) => { return ( - Export Workspace{' '} - {workspace.name} Is Comming + + Export Workspace + + {{ workspace: workspace.name }} + + Is Comming + ); }; diff --git a/packages/app/src/components/workspace-setting/MembersPage.tsx b/packages/app/src/components/workspace-setting/MembersPage.tsx index ea0b68536b..fb303b69b5 100644 --- a/packages/app/src/components/workspace-setting/MembersPage.tsx +++ b/packages/app/src/components/workspace-setting/MembersPage.tsx @@ -27,6 +27,7 @@ import { Workspace } from '@affine/datacenter'; import { useTemporaryHelper } from '@/providers/temporary-helper-provider'; import { StyledMemberWarp } from './general/style'; import { useConfirm } from '@/providers/ConfirmProvider'; +import { useTranslation } from 'react-i18next'; // import { useAppState } from '@/providers/app-state-provider'; export const MembersPage = ({ workspace }: { workspace: Workspace }) => { @@ -36,6 +37,7 @@ export const MembersPage = ({ workspace }: { workspace: Workspace }) => { ]); const { user, login, updateWorkspaceMeta } = useTemporaryHelper(); const { confirm } = useConfirm(); + const { t } = useTranslation(); // const refreshMembers = useCallback(() => { // getDataCenter() // .then(dc => @@ -66,9 +68,11 @@ export const MembersPage = ({ workspace }: { workspace: Workspace }) => { <> - Users({members.length}) + {t('Users')} ({members.length}) - Access level + + {t('Access level')} + {members.length ? ( @@ -92,7 +96,7 @@ export const MembersPage = ({ workspace }: { workspace: Workspace }) => { ? 'Member' : 'Workspace Owner' : 'Pending'} */} - Pending + {t('Pending')} { }} icon={} > - Delete + {t('Delete')} } @@ -154,7 +158,7 @@ export const MembersPage = ({ workspace }: { workspace: Workspace }) => { type="primary" shape="circle" > - Invite Members + {t('Invite Members')} { @@ -172,19 +176,17 @@ export const MembersPage = ({ workspace }: { workspace: Workspace }) => { ) : ( -
- Collaborating with other members requires AFFiNE Cloud service. -
+
{t('Collaboration Description')}
diff --git a/packages/app/src/components/workspace-setting/PublishPage.tsx b/packages/app/src/components/workspace-setting/PublishPage.tsx index e3c36b9343..26961a221e 100644 --- a/packages/app/src/components/workspace-setting/PublishPage.tsx +++ b/packages/app/src/components/workspace-setting/PublishPage.tsx @@ -13,12 +13,13 @@ import { useConfirm } from '@/providers/ConfirmProvider'; // import { useAppState } from '@/providers/app-state-provider3'; import { useWorkspaceHelper } from '@/hooks/use-workspace-helper'; import { Workspace } from '@affine/datacenter'; +import { useTranslation } from 'react-i18next'; export const PublishPage = ({ workspace }: { workspace: Workspace }) => { const shareUrl = window.location.host + '/workspace/' + workspace.id + '?share=true'; const { publishWorkspace } = useWorkspaceHelper(); - + const { t } = useTranslation(); const { confirm } = useConfirm(); const togglePublic = (flag: boolean) => { @@ -32,11 +33,11 @@ export const PublishPage = ({ workspace }: { workspace: Workspace }) => { const enableAffineCloud = () => { confirm({ - title: 'Enable AFFiNE Cloud?', - content: `If enabled, the data in this workspace will be backed up and synchronized via AFFiNE Cloud.`, + title: `${t('Enable AFFiNE Cloud')}?`, + content: t('Enable AFFiNE Cloud Description'), confirmText: - workspace.provider === 'local' ? 'Enable' : 'Sign in and Enable', - cancelText: 'Skip', + workspace.provider === 'local' ? t('Enable') : t('Sign in and Enable'), + cancelText: t('Skip'), }).then(confirm => { if (confirm) { // if (user) { @@ -56,22 +57,21 @@ export const PublishPage = ({ workspace }: { workspace: Workspace }) => { {workspace?.isPublish ? ( <> - Publishing to web requires AFFiNE Cloud service . + {t('Publishing')} - Share with link + {t('Share with link')} ) : ( - After publishing to the web, everyone can view the content of - this workspace through the link. + {'Publishing Description'} )} @@ -83,7 +83,7 @@ export const PublishPage = ({ workspace }: { workspace: Workspace }) => { type="primary" shape="circle" > - Stop publishing + {t('Stop publishing')} ) : ( )}
@@ -101,7 +101,7 @@ export const PublishPage = ({ workspace }: { workspace: Workspace }) => { <> - Publishing to web requires AFFiNE Cloud service. + {t('Publishing')} @@ -112,7 +112,7 @@ export const PublishPage = ({ workspace }: { workspace: Workspace }) => { type="primary" shape="circle" > - Enable AFFiNE Cloud + {t('Enable AFFiNE Cloud')} diff --git a/packages/app/src/components/workspace-setting/SyncPage.tsx b/packages/app/src/components/workspace-setting/SyncPage.tsx index 1c3cdaea8f..00bbeb9785 100644 --- a/packages/app/src/components/workspace-setting/SyncPage.tsx +++ b/packages/app/src/components/workspace-setting/SyncPage.tsx @@ -8,9 +8,11 @@ import { Button } from '@/ui/button'; import { Menu, MenuItem } from '@/ui/menu'; import { useTemporaryHelper } from '@/providers/temporary-helper-provider'; import { Workspace } from '@affine/datacenter'; +import { Trans, useTranslation } from 'react-i18next'; export const SyncPage = ({ workspace }: { workspace: Workspace }) => { console.log('workspace: ', workspace); const { currentWorkspace, updateWorkspaceMeta } = useTemporaryHelper(); + const { t } = useTranslation(); return (
diff --git a/packages/app/src/components/workspace-setting/general/General.tsx b/packages/app/src/components/workspace-setting/general/General.tsx index 87278ce734..6dee18e82e 100644 --- a/packages/app/src/components/workspace-setting/general/General.tsx +++ b/packages/app/src/components/workspace-setting/general/General.tsx @@ -17,6 +17,7 @@ import { Upload } from '@/components/file-upload'; import { WorkspaceAvatar } from '@/components/workspace-avatar'; import { useTemporaryHelper } from '@/providers/temporary-helper-provider'; import { Workspace } from '@affine/datacenter'; +import { useTranslation } from 'react-i18next'; export const GeneralPage = ({ workspace }: { workspace: Workspace }) => { // const { refreshWorkspacesMeta } = useAppState(); const { updateWorkspaceMeta } = useTemporaryHelper(); @@ -24,6 +25,7 @@ export const GeneralPage = ({ workspace }: { workspace: Workspace }) => { const [showLeave, setShowLeave] = useState(false); const [uploading, setUploading] = useState(false); const [workspaceName, setWorkspaceName] = useState(''); + const { t } = useTranslation(); // const debouncedRefreshWorkspacesMeta = debounce(() => { // refreshWorkspacesMeta(); // }, 100); @@ -68,7 +70,7 @@ export const GeneralPage = ({ workspace }: { workspace: Workspace }) => { return workspace ? (
- Workspace Icon + {t('Workspace Icon')}
{ accept="image/gif,image/jpeg,image/jpg,image/png,image/svg" fileChange={fileChange} > - + {/* TODO: add upload logic */} - Workspace Name + {t('Workspace Name')} { '' )} */} - Workspace Type + {t('Workspace Type')} {workspace.provider} @@ -130,7 +132,7 @@ export const GeneralPage = ({ workspace }: { workspace: Workspace }) => { {isOwner ? ( <> { ) : ( <> void; @@ -31,6 +31,7 @@ export const WorkspaceDelete = ({ workspace, }: WorkspaceDeleteProps) => { const [deleteStr, setDeleteStr] = useState(''); + const { t } = useTranslation(); const router = useRouter(); const handlerInputChange = (workspaceName: string) => { @@ -55,31 +56,40 @@ export const WorkspaceDelete = ({ - Delete Workspace + {t('Delete Workspace')} {workspace.provider === 'local' ? ( - Deleting ( - {workspace.name}) cannot - be undone, please proceed with caution. along with all its content. + + Deleting ( + + {{ workspace: workspace.name }} + + ) cannot be undone, please proceed with caution. along with all + its content. + ) : ( - Deleting ( - {workspace.name}) will - delete both local and cloud data, this operation cannot be undone, - please proceed with caution. + + Deleting ( + + {{ workspace: workspace.name }} + + ) will delete both local and cloud data, this operation cannot be + undone, please proceed with caution. + )} diff --git a/packages/app/src/components/workspace-setting/general/leave/Leave.tsx b/packages/app/src/components/workspace-setting/general/leave/Leave.tsx index e34b4ac257..730c1cedbf 100644 --- a/packages/app/src/components/workspace-setting/general/leave/Leave.tsx +++ b/packages/app/src/components/workspace-setting/general/leave/Leave.tsx @@ -7,6 +7,7 @@ import { } from './style'; import { ModalCloseButton } from '@/ui/modal'; import { Button } from '@/ui/button'; +import { useTranslation } from 'react-i18next'; // import { getDataCenter } from '@affine/datacenter'; // import { useAppState } from '@/providers/app-state-provider'; @@ -22,6 +23,7 @@ export const WorkspaceLeave = ({ onClose, workspaceId, }: WorkspaceDeleteProps) => { + const { t } = useTranslation(); console.log('workspaceId: ', workspaceId); // const router = useRouter(); // const { refreshWorkspacesMeta } = useAppState(); @@ -37,14 +39,13 @@ export const WorkspaceLeave = ({ - Leave Workspace + {t('Leave Workspace')} - After you leave, you will not be able to access all the contents of - this workspace. + {t('Leave Workspace Description')} diff --git a/packages/app/src/components/workspace-slider-bar/index.tsx b/packages/app/src/components/workspace-slider-bar/index.tsx index c40dc31c11..18862017d5 100644 --- a/packages/app/src/components/workspace-slider-bar/index.tsx +++ b/packages/app/src/components/workspace-slider-bar/index.tsx @@ -157,7 +157,7 @@ export const WorkSpaceSliderBar = () => { setShowWorkspaceSetting(true); }} > - Setting + {t('Settings')} Chrome browser for optimal experience.", + "upgradeBrowser": "Please upgrade to the latest version of Chrome for the best experience.", + "Invite Members": "Invite Members", + "Invite placeholder": "Search mail (Gmail support only)", + "Non-Gmail": "Non-Gmail is not supported", + "Invite": "Invite", + "Loading": "Loading...", + "NotLoggedIn": "Currently not logged in", + "ClearData": "Clear local data", + "Continue with Google": "Continue with Google", + "Set up an AFFiNE account to sync data": "Set up an AFFiNE account to sync data", + "Stay logged out": "Stay logged out", + "All changes are saved locally": "All changes are saved locally", + "Ooops!": "Ooops!", + "mobile device": "Looks like you are browsing on a mobile device.", + "mobile device description": "We are still working on mobile support and recommend you use a desktop device.", + "Got it": "Got it", + "emptyAllPages": "This workspace is empty. Create a new page to begin editing.", + "emptyFavourite": "Click Add to Favourites and the page will appear here.", + "emptyTrash": "Click Add to Trash and the page will appear here.", + "still designed": "(This page is still being designed.)", + "My Workspaces": "My Workspaces", + "Create Or Import": "Create Or Import", + "Tips": "Tips: ", + "login success": "Login success", + "Sign in": "Sign in AFFiNE Cloud", + "Sign out": "Sign out of AFFiNE Cloud", + "Delete Workspace": "Delete Workspace", + "Delete Workspace Description": "Deleting (<1>{{workspace}}) cannot be undone, please proceed with caution. along with all its content.", + "Delete Workspace Description2": "Deleting (<1>{{workspace}}) will delete both local and cloud data, this operation cannot be undone, please proceed with caution.", + "Delete Workspace placeholder": "Please type “Delete” to confirm", + "Leave Workspace": "Leave Workspace", + "Leave Workspace Description": "After you leave, you will not be able to access all the contents of this workspace.", + "Leave": "Leave", + "Workspace Icon": "Workspace Icon", + "Workspace Name": "Workspace Name", + "Workspace Type": "Workspace Type", + "Export Workspace": "Export Workspace <1>{{workspace}} Is Coming", + "Users": "Users", + "Access level": "Access level", + "Pending": "Pending", + "Collaboration Description": "Collaborating with other members requires AFFiNE Cloud service.", + "Enable AFFiNE Cloud": "Enable AFFiNE Cloud", + "Enable AFFiNE Cloud Description": "If enabled, the data in this workspace will be backed up and synchronised via AFFiNE Cloud.", + "Enable": "Enable", + "Sign in and Enable": "Sign in and Enable", + "Skip": "Skip", + "Publishing": "Publishing to web requires AFFiNE Cloud service.", + "Share with link": "Share with link", + "Copy Link": "Copy Link", + "Publishing Description": "After publishing to the web, everyone can view the content of this workspace through the link.", + "Stop publishing": "Stop publishing", + "Publish to web": "Publish to web", + "Sync Description": "{{workspaceName}} is Local Workspace. All data is stored on the current device. You can enable AFFiNE Cloud for this workspace to keep data in sync with the cloud." } diff --git a/packages/app/src/pages/workspace/[workspaceId]/all.tsx b/packages/app/src/pages/workspace/[workspaceId]/all.tsx index 18f6e2a64b..6464a903bb 100644 --- a/packages/app/src/pages/workspace/[workspaceId]/all.tsx +++ b/packages/app/src/pages/workspace/[workspaceId]/all.tsx @@ -14,6 +14,7 @@ const All = () => { !p.trash)} showFavoriteTag={true} + listType="all" /> ); diff --git a/packages/app/src/pages/workspace/[workspaceId]/favorite.tsx b/packages/app/src/pages/workspace/[workspaceId]/favorite.tsx index d787f34e1b..689bd3ead4 100644 --- a/packages/app/src/pages/workspace/[workspaceId]/favorite.tsx +++ b/packages/app/src/pages/workspace/[workspaceId]/favorite.tsx @@ -13,7 +13,10 @@ export const Favorite = () => { }> {t('Favourites')} - p.favorite && !p.trash)} /> + p.favorite && !p.trash)} + listType="favorite" + /> ); }; diff --git a/packages/app/src/pages/workspace/[workspaceId]/trash.tsx b/packages/app/src/pages/workspace/[workspaceId]/trash.tsx index 2343b39138..e2baa990af 100644 --- a/packages/app/src/pages/workspace/[workspaceId]/trash.tsx +++ b/packages/app/src/pages/workspace/[workspaceId]/trash.tsx @@ -11,7 +11,11 @@ export const Trash = () => { return ( <> }>{t('Trash')} - p.trash)} isTrash={true} /> + p.trash)} + isTrash={true} + listType="trash" + /> ); }; From 57749561757cd6df1ff2e87b25f275390a02da23 Mon Sep 17 00:00:00 2001 From: JimmFly Date: Tue, 10 Jan 2023 14:53:27 +0800 Subject: [PATCH 2/2] chore: update i18n keys --- .../components/workspace-setting/SyncPage.tsx | 23 +++++++++++-------- .../workspace-setting/WorkspaceSetting.tsx | 16 +++++++------ packages/app/src/libs/i18n/resources/en.json | 9 +++++++- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/packages/app/src/components/workspace-setting/SyncPage.tsx b/packages/app/src/components/workspace-setting/SyncPage.tsx index 00bbeb9785..0cb0069d2d 100644 --- a/packages/app/src/components/workspace-setting/SyncPage.tsx +++ b/packages/app/src/components/workspace-setting/SyncPage.tsx @@ -20,9 +20,7 @@ export const SyncPage = ({ workspace }: { workspace: Workspace }) => { {currentWorkspace?.type === 'local' ? ( <> - {currentWorkspace.name} is Local Workspace. All data is stored on - the current device. You can enable AFFiNE Cloud for this workspace - to keep data in sync with the cloud. + {t('Sync Description', { workspaceName: currentWorkspace.name })} @@ -35,15 +33,20 @@ export const SyncPage = ({ workspace }: { workspace: Workspace }) => { type="primary" shape="circle" > - Enable AFFiNE Cloud + {t('Enable AFFiNE Cloud')} ) : ( <> - {currentWorkspace && currentWorkspace.name} is Cloud - Workspace. All data will be synchronized and saved to the AFFiNE + + + {{ workspaceName: currentWorkspace && currentWorkspace.name }} + + is Cloud Workspace. All data will be synchronized and saved to + the AFFiNE + { }} icon={} > - Download core data to device + {t('Download data to device', { CoreOrAll: 'core' })} { @@ -63,14 +66,16 @@ export const SyncPage = ({ workspace }: { workspace: Workspace }) => { }} icon={} > - Download all data to device + {t('Download data to device', { CoreOrAll: 'all' })} } placement="bottom-end" disablePortal={true} > - + diff --git a/packages/app/src/components/workspace-setting/WorkspaceSetting.tsx b/packages/app/src/components/workspace-setting/WorkspaceSetting.tsx index c0213c2cca..64ffd5b8f9 100644 --- a/packages/app/src/components/workspace-setting/WorkspaceSetting.tsx +++ b/packages/app/src/components/workspace-setting/WorkspaceSetting.tsx @@ -21,6 +21,7 @@ import { PublishPage } from './PublishPage'; import { ExportPage } from './ExportPage'; import { SyncPage } from './SyncPage'; import { useAppState } from '@/providers/app-state-provider'; +import { useTranslation } from 'react-i18next'; enum ActiveTab { 'general' = 'general', @@ -41,6 +42,7 @@ type WorkspaceSettingProps = { }; const WorkspaceSettingTab = ({ activeTab, onTabChange }: SettingTabProps) => { + const { t } = useTranslation(); return ( { - General + {t('General')} { - Sync + {t('Sync')} { - Collaboration + {t('Collaboration')} { - Publish + {t('Publish')} { - Export + {t('Export')} ); @@ -114,7 +116,7 @@ export const WorkspaceSetting = ({ const handleTabChange = (tab: ActiveTab) => { setActiveTab(tab); }; - + const { t } = useTranslation(); const { currentMetaWorkSpace } = useAppState(); const handleClickClose = () => { onClose && onClose(); @@ -133,7 +135,7 @@ export const WorkspaceSetting = ({ {isOwner ? ( - Workspace Settings + {t('Workspace Settings')} {{workspaceName}} is Cloud Workspace. All data will be synchronized and saved to the AFFiNE", + "Download data to device": "Download {{CoreOrAll}} data to device", + "General": "General", + "Sync": "Sync", + "Collaboration": "Collaboration", + "Publish": "Publish", + "Workspace Settings": "Workspace Settings" }