From e501026d28f7c00ec120239d90a7faffaecee78d Mon Sep 17 00:00:00 2001
From: JimmFly
Date: Tue, 31 Jan 2023 15:29:35 +0800
Subject: [PATCH 2/5] feat: update i18n keys
---
packages/i18n/src/resources/en.json | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/packages/i18n/src/resources/en.json b/packages/i18n/src/resources/en.json
index 9b543416dd..e01cdc7b49 100644
--- a/packages/i18n/src/resources/en.json
+++ b/packages/i18n/src/resources/en.json
@@ -69,7 +69,7 @@
"Remove from favourites": "Remove from favourites",
"Removed from Favourites": "Removed from Favourites",
"New Workspace": "New Workspace",
- "Workspace description": "Workspace is your virtual space to capture, create and plan as just one person or together as a team.",
+ "Workspace description": "A workspace is your virtual space to capture, create and plan as just one person or together as a team.",
"Create": "Create",
"Select": "Select",
"Text": "Text (coming soon)",
@@ -108,10 +108,10 @@
"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",
+ "Create Or Import": "Create or Import",
"Tips": "Tips: ",
"login success": "Login success",
- "Sign out": "Sign out of AFFiNE Cloud",
+ "Sign out": "Sign out",
"Delete Workspace": "Delete Workspace",
"Delete Workspace Description2": "Deleting (<1>{{workspace}}1>) will delete both local and cloud data, this operation cannot be undone, please proceed with caution.",
"Delete Workspace placeholder": "Please type “Delete” to confirm",
@@ -143,11 +143,15 @@
"Workspace Settings": "Workspace Settings",
"Export Workspace": "Export Workspace <1>{{workspace}}1> is coming soon",
"Leave Workspace Description": "After you leave, you will no longer be able to access the contents of this workspace.",
- "Sign in": "Sign in to AFFiNE Cloud",
+ "Sign in": "Sign in AFFiNE Cloud",
"Sync Description": "{{workspaceName}} is a 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.",
"Sync Description2": "<1>{{workspaceName}}1> is a Cloud Workspace. All data will be synchronised and saved to AFFiNE Cloud.",
"Delete Workspace Description": "Deleting (<1>{{workspace}}1>) cannot be undone, please proceed with caution. All contents will be lost.",
"core": "core",
"all": "all",
- "A workspace is your virtual space to capture, create and plan as just one person or together as a team.": "A workspace is your virtual space to capture, create and plan as just one person or together as a team."
+ "Back Home": "Back Home",
+ "Set a Workspace name": "Set a Workspace name",
+ "Retain local cached data": "Retain local cached data",
+ "Wait for Sync": "Wait for Sync",
+ "Force Sign Out": "Force Sign Out"
}
From a9bbaed22cbb165a748678a0ac378b088a2dbc8b Mon Sep 17 00:00:00 2001
From: JimmFly
Date: Tue, 31 Jan 2023 18:34:18 +0800
Subject: [PATCH 3/5] chore: add translation function
---
.../src/components/workspace-modal/Footer.tsx | 4 +-
.../workspace-modal/WorkspaceCard.tsx | 14 ++--
.../workspace-setting/PublishPage.tsx | 15 ++--
.../components/workspace-setting/SyncPage.tsx | 51 +++++++------
.../workspace-setting/general/General.tsx | 8 +--
.../workspace-setting/member/MembersPage.tsx | 20 +++---
.../src/components/workspace-setting/style.ts | 30 ++++----
.../app/src/hooks/use-workspace-helper.ts | 12 ++--
.../pages/workspace/[workspaceId]/setting.tsx | 72 ++++++++++---------
9 files changed, 123 insertions(+), 103 deletions(-)
diff --git a/packages/app/src/components/workspace-modal/Footer.tsx b/packages/app/src/components/workspace-modal/Footer.tsx
index ea38de2a9c..c27b004e8b 100644
--- a/packages/app/src/components/workspace-modal/Footer.tsx
+++ b/packages/app/src/components/workspace-modal/Footer.tsx
@@ -4,6 +4,7 @@ import { WorkspaceAvatar } from '@/components/workspace-avatar';
import { IconButton } from '@/ui/button';
import { useAppState } from '@/providers/app-state-provider';
import { StyledFooter, StyleUserInfo, StyleSignIn } from './styles';
+import { useTranslation } from '@affine/i18n';
export const Footer = ({
onLogin,
@@ -13,6 +14,7 @@ export const Footer = ({
onLogout: () => void;
}) => {
const { user } = useAppState();
+ const { t } = useTranslation();
return (
@@ -48,7 +50,7 @@ export const Footer = ({
- Sign in to sync with AFFINE Cloud
+ {t('Sign in')}
)}
diff --git a/packages/app/src/components/workspace-modal/WorkspaceCard.tsx b/packages/app/src/components/workspace-modal/WorkspaceCard.tsx
index 1a6032d65f..9bc523e2fb 100644
--- a/packages/app/src/components/workspace-modal/WorkspaceCard.tsx
+++ b/packages/app/src/components/workspace-modal/WorkspaceCard.tsx
@@ -9,6 +9,7 @@ import { WorkspaceUnit } from '@affine/datacenter';
import { useAppState } from '@/providers/app-state-provider';
import { StyleWorkspaceInfo, StyleWorkspaceTitle, StyledCard } from './styles';
import { Wrapper } from '@/ui/layout';
+import { useTranslation } from '@affine/i18n';
export const WorkspaceCard = ({
workspaceData,
@@ -18,7 +19,7 @@ export const WorkspaceCard = ({
onClick: (data: WorkspaceUnit) => void;
}) => {
const { currentWorkspace, isOwner } = useAppState();
-
+ const { t } = useTranslation();
return (
{
@@ -38,29 +39,30 @@ export const WorkspaceCard = ({
workspaceData.provider === 'local' ? (
- Local Workspace
+ {t('Local Workspace')}
) : (
- Cloud Workspace
+ {t('Cloud Workspace')}
)
) : (
- Joined Workspace
+ {t('Joined Workspace')}
)}
{workspaceData.provider === 'local' && (
- All data can be accessed offline
+ {t('Available Offline')}
)}
{workspaceData.published && (
- Published to Web
+
+ {t('Published to Web')}
)}
diff --git a/packages/app/src/components/workspace-setting/PublishPage.tsx b/packages/app/src/components/workspace-setting/PublishPage.tsx
index a30b72bdf7..677b8a4909 100644
--- a/packages/app/src/components/workspace-setting/PublishPage.tsx
+++ b/packages/app/src/components/workspace-setting/PublishPage.tsx
@@ -1,5 +1,5 @@
import {
- StyledCopyButtonContainer,
+ StyledButtonContainer,
StyledPublishContent,
StyledPublishCopyContainer,
StyledPublishExplanation,
@@ -24,13 +24,13 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
try {
await publishWorkspace(workspace.id.toString(), flag);
} catch (e) {
- toast('Failed to publish workspace');
+ toast(t('Failed to publish workspace'));
}
};
const copyUrl = () => {
navigator.clipboard.writeText(shareUrl);
- toast('Copied url to clipboard');
+ toast(t('Copied link to clipboard'));
};
return (
@@ -43,8 +43,7 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
{workspace.published ? (
<>
- The current workspace has been published to the web, everyone
- can view the contents of this workspace through the link.
+ {t('Published Description')}
@@ -52,11 +51,11 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
{t('Share with link')}
-
+
-
+
>
) : (
@@ -103,7 +102,7 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
<>
- Publishing to web requires AFFiNE Cloud service.
+ {t('Publishing')}
diff --git a/packages/app/src/components/workspace-setting/SyncPage.tsx b/packages/app/src/components/workspace-setting/SyncPage.tsx
index 6969461a38..0632b304c0 100644
--- a/packages/app/src/components/workspace-setting/SyncPage.tsx
+++ b/packages/app/src/components/workspace-setting/SyncPage.tsx
@@ -1,9 +1,9 @@
import {
- StyleAsync,
+ StyledButtonContainer,
StyledPublishContent,
StyledPublishExplanation,
StyledWorkspaceName,
- StyledWorkspaceType,
+ StyledEmail,
} from './style';
import { DownloadIcon } from '@blocksuite/icons';
import { Button } from '@/ui/button';
@@ -26,27 +26,38 @@ export const SyncPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
workspaceUnit={workspace}
style={{ marginRight: '12px' }}
/>
- {workspace.name};
- is a Local Workspace.
+ {workspace.name}
+ {t('is a 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('Local Workspace Description')}
+
-
+
>
) : (
<>
-
- {{ workspaceName: workspace.name ?? 'Affine' }}
- is Cloud Workspace. All data will be synchronised and saved to
- the AFFiNE
-
+
+ {workspace.name}
+ {t('is a Cloud Workspace')}
-
+
+
+ All data will be synchronised and saved to the AFFiNE account
+
+ {{
+ email: '{' + workspace.owner?.email + '}.',
+ }}
+
+
+