diff --git a/packages/component/src/components/share-menu/SharePage.tsx b/packages/component/src/components/share-menu/SharePage.tsx index 8bf7cd31ef..a4e7dfd7a2 100644 --- a/packages/component/src/components/share-menu/SharePage.tsx +++ b/packages/component/src/components/share-menu/SharePage.tsx @@ -1,4 +1,5 @@ import { getEnvironment } from '@affine/env'; +import { Trans, useTranslation } from '@affine/i18n'; import type { LocalWorkspace } from '@affine/workspace/type'; import { WorkspaceFlavour } from '@affine/workspace/type'; import { useBlockSuiteWorkspacePageIsPublic } from '@toeverything/hooks/use-blocksuite-workspace-page-is-public'; @@ -6,6 +7,7 @@ import type { FC } from 'react'; import { useState } from 'react'; import { useCallback, useMemo } from 'react'; +import { toast } from '../..'; import { PublicLinkDisableModal } from './disable-public-link'; import { descriptionStyle, @@ -21,18 +23,17 @@ import { } from './styles'; export const LocalSharePage: FC = props => { + const { t } = useTranslation(); return (
-
- Sharing page publicly requires AFFiNE Cloud service. -
+
{t('Shared Pages Description')}
{ props.onEnableAffineCloud(props.workspace as LocalWorkspace); }} > - Enable AFFiNE Cloud + {t('Enable AFFiNE Cloud')}
); @@ -43,6 +44,7 @@ export const AffineSharePage: FC = props => { props.currentPage ); const [showDisable, setShowDisable] = useState(false); + const { t } = useTranslation(); const sharingUrl = useMemo(() => { const env = getEnvironment(); if (env.isBrowser) { @@ -56,12 +58,13 @@ export const AffineSharePage: FC = props => { }, [setIsPublic]); const onClickCopyLink = useCallback(() => { navigator.clipboard.writeText(sharingUrl); - }, [sharingUrl]); + toast(t('Copied link to clipboard')); + }, [sharingUrl, t]); return (
- Create a link you can easily share with anyone. + {t('Create Shared Link Description')}
= props => { data-testid="affine-share-create-link" onClick={onClickCreateLink} > - Create + {t('Create')} )} {isPublic && ( @@ -82,24 +85,27 @@ export const AffineSharePage: FC = props => { data-testid="affine-share-copy-link" onClick={onClickCopyLink} > - Copy Link + {t('Copy Link')} )}
- The entire Workspace is published on the web and can be edited via - { - props.onOpenWorkspaceSettings(props.workspace); - }} - > - Workspace Settings. - + + The entire Workspace is published on the web and can be edited via + { + props.onOpenWorkspaceSettings(props.workspace); + }} + > + Workspace Settings + + . +
{isPublic && ( <> setShowDisable(true)}> - Disable Public Link + {t('Disable Public Link')} > = props => { + const { t } = useTranslation(); return (
- Invite others to join the Workspace or publish it to web. + {t('Share Menu Public Workspace Description1')}
> = props => { props.onOpenWorkspaceSettings(props.workspace); }} > - Open Workspace Settings + {t('Open Workspace Settings')}
); @@ -26,12 +28,13 @@ const ShareLocalWorkspace: FC> = props => { const ShareAffineWorkspace: FC> = props => { const isPublicWorkspace = props.workspace.public; + const { t } = useTranslation(); return (
{isPublicWorkspace - ? `Current workspace has been published to the web as a public workspace.` - : `Invite others to join the Workspace or publish it to web`} + ? t('Share Menu Public Workspace Description2') + : t('Share Menu Public Workspace Description1')}
> = props => { props.onOpenWorkspaceSettings(props.workspace); }} > - Open Workspace Settings + {t('Open Workspace Settings')}
); diff --git a/packages/i18n/src/resources/en.json b/packages/i18n/src/resources/en.json index f4ae78c873..6014f2ed35 100644 --- a/packages/i18n/src/resources/en.json +++ b/packages/i18n/src/resources/en.json @@ -208,7 +208,14 @@ "Shared Pages": "Shared Pages", "Disable Public Sharing": "Disable Public Sharing", "Disable": "Disable", + "Disable Public Link": "Disable Public Link", "Disable Public Link ?": "Disable Public Link ?", "Disable Public Link Description": "Disabling this public link will prevent anyone with the link from accessing this page.", - "Export Shared Pages Description": "Download a static copy of your page to share with others." + "Export Shared Pages Description": "Download a static copy of your page to share with others.", + "Shared Pages Description": "Sharing page publicly requires AFFiNE Cloud service.", + "Create Shared Link Description": "Create a link you can easily share with anyone.", + "Shared Pages In Public Workspace Description": "The entire Workspace is published on the web and can be edited via <1>Workspace Settings.", + "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." }