chore: add translation (#1946)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { getEnvironment } from '@affine/env';
|
import { getEnvironment } from '@affine/env';
|
||||||
|
import { Trans, useTranslation } from '@affine/i18n';
|
||||||
import type { LocalWorkspace } from '@affine/workspace/type';
|
import type { LocalWorkspace } from '@affine/workspace/type';
|
||||||
import { WorkspaceFlavour } from '@affine/workspace/type';
|
import { WorkspaceFlavour } from '@affine/workspace/type';
|
||||||
import { useBlockSuiteWorkspacePageIsPublic } from '@toeverything/hooks/use-blocksuite-workspace-page-is-public';
|
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 { useState } from 'react';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
|
import { toast } from '../..';
|
||||||
import { PublicLinkDisableModal } from './disable-public-link';
|
import { PublicLinkDisableModal } from './disable-public-link';
|
||||||
import {
|
import {
|
||||||
descriptionStyle,
|
descriptionStyle,
|
||||||
@@ -21,18 +23,17 @@ import {
|
|||||||
} from './styles';
|
} from './styles';
|
||||||
|
|
||||||
export const LocalSharePage: FC<ShareMenuProps> = props => {
|
export const LocalSharePage: FC<ShareMenuProps> = props => {
|
||||||
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div className={menuItemStyle}>
|
<div className={menuItemStyle}>
|
||||||
<div className={descriptionStyle}>
|
<div className={descriptionStyle}>{t('Shared Pages Description')}</div>
|
||||||
Sharing page publicly requires AFFiNE Cloud service.
|
|
||||||
</div>
|
|
||||||
<StyledButton
|
<StyledButton
|
||||||
data-testid="share-menu-enable-affine-cloud-button"
|
data-testid="share-menu-enable-affine-cloud-button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.onEnableAffineCloud(props.workspace as LocalWorkspace);
|
props.onEnableAffineCloud(props.workspace as LocalWorkspace);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Enable AFFiNE Cloud
|
{t('Enable AFFiNE Cloud')}
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -43,6 +44,7 @@ export const AffineSharePage: FC<ShareMenuProps> = props => {
|
|||||||
props.currentPage
|
props.currentPage
|
||||||
);
|
);
|
||||||
const [showDisable, setShowDisable] = useState(false);
|
const [showDisable, setShowDisable] = useState(false);
|
||||||
|
const { t } = useTranslation();
|
||||||
const sharingUrl = useMemo(() => {
|
const sharingUrl = useMemo(() => {
|
||||||
const env = getEnvironment();
|
const env = getEnvironment();
|
||||||
if (env.isBrowser) {
|
if (env.isBrowser) {
|
||||||
@@ -56,12 +58,13 @@ export const AffineSharePage: FC<ShareMenuProps> = props => {
|
|||||||
}, [setIsPublic]);
|
}, [setIsPublic]);
|
||||||
const onClickCopyLink = useCallback(() => {
|
const onClickCopyLink = useCallback(() => {
|
||||||
navigator.clipboard.writeText(sharingUrl);
|
navigator.clipboard.writeText(sharingUrl);
|
||||||
}, [sharingUrl]);
|
toast(t('Copied link to clipboard'));
|
||||||
|
}, [sharingUrl, t]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={menuItemStyle}>
|
<div className={menuItemStyle}>
|
||||||
<div className={descriptionStyle}>
|
<div className={descriptionStyle}>
|
||||||
Create a link you can easily share with anyone.
|
{t('Create Shared Link Description')}
|
||||||
</div>
|
</div>
|
||||||
<div className={inputButtonRowStyle}>
|
<div className={inputButtonRowStyle}>
|
||||||
<StyledInput
|
<StyledInput
|
||||||
@@ -74,7 +77,7 @@ export const AffineSharePage: FC<ShareMenuProps> = props => {
|
|||||||
data-testid="affine-share-create-link"
|
data-testid="affine-share-create-link"
|
||||||
onClick={onClickCreateLink}
|
onClick={onClickCreateLink}
|
||||||
>
|
>
|
||||||
Create
|
{t('Create')}
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
)}
|
)}
|
||||||
{isPublic && (
|
{isPublic && (
|
||||||
@@ -82,24 +85,27 @@ export const AffineSharePage: FC<ShareMenuProps> = props => {
|
|||||||
data-testid="affine-share-copy-link"
|
data-testid="affine-share-copy-link"
|
||||||
onClick={onClickCopyLink}
|
onClick={onClickCopyLink}
|
||||||
>
|
>
|
||||||
Copy Link
|
{t('Copy Link')}
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className={descriptionStyle}>
|
<div className={descriptionStyle}>
|
||||||
The entire Workspace is published on the web and can be edited via
|
<Trans i18nKey="Shared Pages In Public Workspace Description">
|
||||||
<StyledLinkSpan
|
The entire Workspace is published on the web and can be edited via
|
||||||
onClick={() => {
|
<StyledLinkSpan
|
||||||
props.onOpenWorkspaceSettings(props.workspace);
|
onClick={() => {
|
||||||
}}
|
props.onOpenWorkspaceSettings(props.workspace);
|
||||||
>
|
}}
|
||||||
Workspace Settings.
|
>
|
||||||
</StyledLinkSpan>
|
Workspace Settings
|
||||||
|
</StyledLinkSpan>
|
||||||
|
.
|
||||||
|
</Trans>
|
||||||
</div>
|
</div>
|
||||||
{isPublic && (
|
{isPublic && (
|
||||||
<>
|
<>
|
||||||
<StyledDisableButton onClick={() => setShowDisable(true)}>
|
<StyledDisableButton onClick={() => setShowDisable(true)}>
|
||||||
Disable Public Link
|
{t('Disable Public Link')}
|
||||||
</StyledDisableButton>
|
</StyledDisableButton>
|
||||||
<PublicLinkDisableModal
|
<PublicLinkDisableModal
|
||||||
page={props.currentPage}
|
page={props.currentPage}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { useTranslation } from '@affine/i18n';
|
||||||
import type { AffineWorkspace, LocalWorkspace } from '@affine/workspace/type';
|
import type { AffineWorkspace, LocalWorkspace } from '@affine/workspace/type';
|
||||||
import { WorkspaceFlavour } from '@affine/workspace/type';
|
import { WorkspaceFlavour } from '@affine/workspace/type';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
@@ -7,10 +8,11 @@ import type { ShareMenuProps } from './ShareMenu';
|
|||||||
import { StyledButton } from './styles';
|
import { StyledButton } from './styles';
|
||||||
|
|
||||||
const ShareLocalWorkspace: FC<ShareMenuProps<LocalWorkspace>> = props => {
|
const ShareLocalWorkspace: FC<ShareMenuProps<LocalWorkspace>> = props => {
|
||||||
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div className={menuItemStyle}>
|
<div className={menuItemStyle}>
|
||||||
<div className={descriptionStyle}>
|
<div className={descriptionStyle}>
|
||||||
Invite others to join the Workspace or publish it to web.
|
{t('Share Menu Public Workspace Description1')}
|
||||||
</div>
|
</div>
|
||||||
<StyledButton
|
<StyledButton
|
||||||
data-testid="share-menu-enable-affine-cloud-button"
|
data-testid="share-menu-enable-affine-cloud-button"
|
||||||
@@ -18,7 +20,7 @@ const ShareLocalWorkspace: FC<ShareMenuProps<LocalWorkspace>> = props => {
|
|||||||
props.onOpenWorkspaceSettings(props.workspace);
|
props.onOpenWorkspaceSettings(props.workspace);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Open Workspace Settings
|
{t('Open Workspace Settings')}
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -26,12 +28,13 @@ const ShareLocalWorkspace: FC<ShareMenuProps<LocalWorkspace>> = props => {
|
|||||||
|
|
||||||
const ShareAffineWorkspace: FC<ShareMenuProps<AffineWorkspace>> = props => {
|
const ShareAffineWorkspace: FC<ShareMenuProps<AffineWorkspace>> = props => {
|
||||||
const isPublicWorkspace = props.workspace.public;
|
const isPublicWorkspace = props.workspace.public;
|
||||||
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div className={menuItemStyle}>
|
<div className={menuItemStyle}>
|
||||||
<div className={descriptionStyle}>
|
<div className={descriptionStyle}>
|
||||||
{isPublicWorkspace
|
{isPublicWorkspace
|
||||||
? `Current workspace has been published to the web as a public workspace.`
|
? t('Share Menu Public Workspace Description2')
|
||||||
: `Invite others to join the Workspace or publish it to web`}
|
: t('Share Menu Public Workspace Description1')}
|
||||||
</div>
|
</div>
|
||||||
<StyledButton
|
<StyledButton
|
||||||
data-testid="share-menu-publish-to-web-button"
|
data-testid="share-menu-publish-to-web-button"
|
||||||
@@ -39,7 +42,7 @@ const ShareAffineWorkspace: FC<ShareMenuProps<AffineWorkspace>> = props => {
|
|||||||
props.onOpenWorkspaceSettings(props.workspace);
|
props.onOpenWorkspaceSettings(props.workspace);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Open Workspace Settings
|
{t('Open Workspace Settings')}
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -208,7 +208,14 @@
|
|||||||
"Shared Pages": "Shared Pages",
|
"Shared Pages": "Shared Pages",
|
||||||
"Disable Public Sharing": "Disable Public Sharing",
|
"Disable Public Sharing": "Disable Public Sharing",
|
||||||
"Disable": "Disable",
|
"Disable": "Disable",
|
||||||
|
"Disable Public Link": "Disable Public Link",
|
||||||
"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.",
|
"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</1>.",
|
||||||
|
"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."
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user