mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 14:28:51 +08:00
chore: update i18n keys
This commit is contained in:
@@ -5,6 +5,7 @@ import { useState } from 'react';
|
|||||||
import Input from '@/ui/input';
|
import Input from '@/ui/input';
|
||||||
import { useTemporaryHelper } from '@/providers/temporary-helper-provider';
|
import { useTemporaryHelper } from '@/providers/temporary-helper-provider';
|
||||||
import { KeyboardEvent } from 'react';
|
import { KeyboardEvent } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
interface ICloseParams {
|
interface ICloseParams {
|
||||||
workspaceId?: string;
|
workspaceId?: string;
|
||||||
}
|
}
|
||||||
@@ -27,12 +28,13 @@ export const CreateWorkspaceModal = ({ open, onClose }: ModalProps) => {
|
|||||||
handleCreateWorkspace();
|
handleCreateWorkspace();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Modal open={open} onClose={onClose}>
|
<Modal open={open} onClose={onClose}>
|
||||||
<ModalWrapper width={620} height={334} style={{ padding: '10px' }}>
|
<ModalWrapper width={620} height={334} style={{ padding: '10px' }}>
|
||||||
<Header>
|
<Header>
|
||||||
<ContentTitle>New Workspace</ContentTitle>
|
<ContentTitle>{t('New Workspace')}</ContentTitle>
|
||||||
<ModalCloseButton
|
<ModalCloseButton
|
||||||
top={6}
|
top={6}
|
||||||
right={6}
|
right={6}
|
||||||
@@ -42,10 +44,7 @@ export const CreateWorkspaceModal = ({ open, onClose }: ModalProps) => {
|
|||||||
/>
|
/>
|
||||||
</Header>
|
</Header>
|
||||||
<Content>
|
<Content>
|
||||||
<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}
|
||||||
onChange={value => {
|
onChange={value => {
|
||||||
@@ -57,7 +56,7 @@ export const CreateWorkspaceModal = ({ open, onClose }: ModalProps) => {
|
|||||||
handleCreateWorkspace();
|
handleCreateWorkspace();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Create
|
{t('Create')}
|
||||||
</Button>
|
</Button>
|
||||||
</Content>
|
</Content>
|
||||||
</ModalWrapper>
|
</ModalWrapper>
|
||||||
|
|||||||
@@ -19,73 +19,77 @@ import Slide from '@mui/material/Slide';
|
|||||||
import useCurrentPageMeta from '@/hooks/use-current-page-meta';
|
import useCurrentPageMeta from '@/hooks/use-current-page-meta';
|
||||||
import { useAppState } from '@/providers/app-state-provider';
|
import { useAppState } from '@/providers/app-state-provider';
|
||||||
import useHistoryUpdated from '@/hooks/use-history-update';
|
import useHistoryUpdated from '@/hooks/use-history-update';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
const toolbarList1 = [
|
const useToolbarList1 = () => {
|
||||||
{
|
const { t } = useTranslation();
|
||||||
flavor: 'select',
|
return [
|
||||||
icon: <SelectIcon />,
|
{
|
||||||
toolTip: 'Select',
|
flavor: 'select',
|
||||||
disable: false,
|
icon: <SelectIcon />,
|
||||||
callback: () => {
|
toolTip: t('Select'),
|
||||||
window.dispatchEvent(
|
disable: false,
|
||||||
new CustomEvent('affine.switch-mouse-mode', {
|
callback: () => {
|
||||||
detail: {
|
window.dispatchEvent(
|
||||||
type: 'default',
|
new CustomEvent('affine.switch-mouse-mode', {
|
||||||
},
|
detail: {
|
||||||
})
|
type: 'default',
|
||||||
);
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
flavor: 'text',
|
||||||
flavor: 'text',
|
icon: <TextIcon />,
|
||||||
icon: <TextIcon />,
|
toolTip: t('Text'),
|
||||||
toolTip: 'Text (coming soon)',
|
disable: true,
|
||||||
disable: true,
|
},
|
||||||
},
|
{
|
||||||
{
|
flavor: 'shape',
|
||||||
flavor: 'shape',
|
icon: <ShapeIcon />,
|
||||||
icon: <ShapeIcon />,
|
toolTip: t('Shape'),
|
||||||
toolTip: 'Shape',
|
disable: false,
|
||||||
disable: false,
|
callback: () => {
|
||||||
callback: () => {
|
window.dispatchEvent(
|
||||||
window.dispatchEvent(
|
new CustomEvent('affine.switch-mouse-mode', {
|
||||||
new CustomEvent('affine.switch-mouse-mode', {
|
detail: {
|
||||||
detail: {
|
type: 'shape',
|
||||||
type: 'shape',
|
color: 'black',
|
||||||
color: 'black',
|
shape: 'rectangle',
|
||||||
shape: 'rectangle',
|
},
|
||||||
},
|
})
|
||||||
})
|
);
|
||||||
);
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
flavor: 'sticky',
|
||||||
|
icon: <StickerIcon />,
|
||||||
|
toolTip: t('Sticky'),
|
||||||
|
disable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
flavor: 'pen',
|
||||||
|
icon: <PenIcon />,
|
||||||
|
toolTip: t('Pen'),
|
||||||
|
disable: true,
|
||||||
},
|
},
|
||||||
},
|
|
||||||
{
|
|
||||||
flavor: 'sticky',
|
|
||||||
icon: <StickerIcon />,
|
|
||||||
toolTip: 'Sticky (coming soon)',
|
|
||||||
disable: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
flavor: 'pen',
|
|
||||||
icon: <PenIcon />,
|
|
||||||
toolTip: 'Pen (coming soon)',
|
|
||||||
disable: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
flavor: 'connector',
|
flavor: 'connector',
|
||||||
icon: <ConnectorIcon />,
|
icon: <ConnectorIcon />,
|
||||||
toolTip: 'Connector (coming soon)',
|
toolTip: t('Connector'),
|
||||||
disable: true,
|
disable: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
};
|
||||||
|
|
||||||
const UndoRedo = () => {
|
const UndoRedo = () => {
|
||||||
const [canUndo, setCanUndo] = useState(false);
|
const [canUndo, setCanUndo] = useState(false);
|
||||||
const [canRedo, setCanRedo] = useState(false);
|
const [canRedo, setCanRedo] = useState(false);
|
||||||
const { currentPage } = useAppState();
|
const { currentPage } = useAppState();
|
||||||
const onHistoryUpdated = useHistoryUpdated();
|
const onHistoryUpdated = useHistoryUpdated();
|
||||||
|
const { t } = useTranslation();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
onHistoryUpdated(page => {
|
onHistoryUpdated(page => {
|
||||||
setCanUndo(page.canUndo);
|
setCanUndo(page.canUndo);
|
||||||
@@ -95,7 +99,7 @@ const UndoRedo = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledToolbarWrapper>
|
<StyledToolbarWrapper>
|
||||||
<Tooltip content="Undo" placement="right-start">
|
<Tooltip content={t('Undo')} placement="right-start">
|
||||||
<StyledToolbarItem
|
<StyledToolbarItem
|
||||||
disable={!canUndo}
|
disable={!canUndo}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -105,7 +109,7 @@ const UndoRedo = () => {
|
|||||||
<UndoIcon />
|
<UndoIcon />
|
||||||
</StyledToolbarItem>
|
</StyledToolbarItem>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip content="Redo" placement="right-start">
|
<Tooltip content={t('Redo')} placement="right-start">
|
||||||
<StyledToolbarItem
|
<StyledToolbarItem
|
||||||
disable={!canRedo}
|
disable={!canRedo}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -131,7 +135,7 @@ export const EdgelessToolbar = () => {
|
|||||||
>
|
>
|
||||||
<StyledEdgelessToolbar aria-label="edgeless-toolbar">
|
<StyledEdgelessToolbar aria-label="edgeless-toolbar">
|
||||||
<StyledToolbarWrapper>
|
<StyledToolbarWrapper>
|
||||||
{toolbarList1.map(
|
{useToolbarList1().map(
|
||||||
({ icon, toolTip, flavor, disable, callback }, index) => {
|
({ icon, toolTip, flavor, disable, callback }, index) => {
|
||||||
return (
|
return (
|
||||||
<Tooltip key={index} content={toolTip} placement="right-start">
|
<Tooltip key={index} content={toolTip} placement="right-start">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Button } from '@/ui/button';
|
import { Button } from '@/ui/button';
|
||||||
import { FC, useRef, ChangeEvent, ReactElement } from 'react';
|
import { FC, useRef, ChangeEvent, ReactElement } from 'react';
|
||||||
import { styled } from '@/styles';
|
import { styled } from '@/styles';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
interface Props {
|
interface Props {
|
||||||
uploadType?: string;
|
uploadType?: string;
|
||||||
children?: ReactElement;
|
children?: ReactElement;
|
||||||
@@ -9,6 +10,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
export const Upload: FC<Props> = props => {
|
export const Upload: FC<Props> = props => {
|
||||||
const { fileChange, accept } = props;
|
const { fileChange, accept } = props;
|
||||||
|
const { t } = useTranslation();
|
||||||
const input_ref = useRef<HTMLInputElement>(null);
|
const input_ref = useRef<HTMLInputElement>(null);
|
||||||
const _chooseFile = () => {
|
const _chooseFile = () => {
|
||||||
if (input_ref.current) {
|
if (input_ref.current) {
|
||||||
@@ -28,7 +30,7 @@ export const Upload: FC<Props> = props => {
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<UploadStyle onClick={_chooseFile}>
|
<UploadStyle onClick={_chooseFile}>
|
||||||
{props.children ?? <Button>Upload</Button>}
|
{props.children ?? <Button>{t('Upload')}</Button>}
|
||||||
<input
|
<input
|
||||||
ref={input_ref}
|
ref={input_ref}
|
||||||
type="file"
|
type="file"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useAppState } from '@/providers/app-state-provider';
|
|||||||
import { useConfirm } from '@/providers/confirm-provider';
|
import { useConfirm } from '@/providers/confirm-provider';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import useCurrentPageMeta from '@/hooks/use-current-page-meta';
|
import useCurrentPageMeta from '@/hooks/use-current-page-meta';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
export const TrashButtonGroup = () => {
|
export const TrashButtonGroup = () => {
|
||||||
const { permanentlyDeletePage } = usePageHelper();
|
const { permanentlyDeletePage } = usePageHelper();
|
||||||
@@ -12,7 +13,7 @@ export const TrashButtonGroup = () => {
|
|||||||
const { confirm } = useConfirm();
|
const { confirm } = useConfirm();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { id = '' } = useCurrentPageMeta() || {};
|
const { id = '' } = useCurrentPageMeta() || {};
|
||||||
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
@@ -23,7 +24,7 @@ export const TrashButtonGroup = () => {
|
|||||||
toggleDeletePage(id);
|
toggleDeletePage(id);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Restore it
|
{t('Restore it')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
bold={true}
|
bold={true}
|
||||||
@@ -31,10 +32,9 @@ export const TrashButtonGroup = () => {
|
|||||||
type="danger"
|
type="danger"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
confirm({
|
confirm({
|
||||||
title: 'Permanently delete',
|
title: t('TrashButtonGroupTitle'),
|
||||||
content:
|
content: t('TrashButtonGroupDescription'),
|
||||||
"Once deleted, you can't undo this action. Do you confirm?",
|
confirmText: t('Delete'),
|
||||||
confirmText: 'Delete',
|
|
||||||
confirmType: 'danger',
|
confirmType: 'danger',
|
||||||
}).then(confirm => {
|
}).then(confirm => {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
@@ -44,7 +44,7 @@ export const TrashButtonGroup = () => {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Delete permanently
|
{t('Delete permanently')}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
"Delete page?": "Delete page?",
|
"Delete page?": "Delete page?",
|
||||||
"Delete permanently?": "Delete permanently?",
|
"Delete permanently?": "Delete permanently?",
|
||||||
"will be moved to Trash": "{{title}} will be moved to Trash",
|
"will be moved to Trash": "{{title}} will be moved to Trash",
|
||||||
"Once deleted, you can't undo this action.": "Once deleted,you can't undo this action.",
|
"Once deleted, you can't undo this action.": "Once deleted, you can't undo this action.",
|
||||||
"Moved to Trash": "Moved to Trash",
|
"Moved to Trash": "Moved to Trash",
|
||||||
"Permanently deleted": "Permanently deleted",
|
"Permanently deleted": "Permanently deleted",
|
||||||
"restored": "{{title}} restored",
|
"restored": "{{title}} restored",
|
||||||
@@ -61,5 +61,19 @@
|
|||||||
"Reduce indent": "Reduce indent",
|
"Reduce indent": "Reduce indent",
|
||||||
"Markdown Syntax": "Markdown Syntax",
|
"Markdown Syntax": "Markdown Syntax",
|
||||||
"Divider": "Divider",
|
"Divider": "Divider",
|
||||||
"404 - Page Not Found": "404 - Page Not Found"
|
"404 - Page Not Found": "404 - Page Not Found",
|
||||||
|
"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.",
|
||||||
|
"Create": "Create",
|
||||||
|
"Select": "Select",
|
||||||
|
"Text": "Text (coming soon)",
|
||||||
|
"Shape": "Shape",
|
||||||
|
"Sticky": "Sticky (coming soon)",
|
||||||
|
"Pen": "Pen (coming soon)",
|
||||||
|
"Connector": "Connector (coming soon)",
|
||||||
|
"Upload": "Upload",
|
||||||
|
"Restore it": "Restore it",
|
||||||
|
"TrashButtonGroupTitle": "Permanently delete",
|
||||||
|
"TrashButtonGroupDescription": "Once deleted, you can't undo this action. Do you confirm?",
|
||||||
|
"Delete permanently": "Delete permanently"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user