fix: some typo and i18n (#3155)

(cherry picked from commit 6ad2d106bc)
This commit is contained in:
3720
2023-07-11 19:04:45 +08:00
committed by Alex Yang
parent b0bb925ef6
commit 2c9c4c2cd3
7 changed files with 61 additions and 16 deletions

View File

@@ -7,6 +7,7 @@ import {
} from '@affine/component/page-list';
import type { Collection } from '@affine/env/filter';
import type { GetPageInfoById } from '@affine/env/page-info';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import {
DeleteIcon,
FilterIcon,
@@ -51,6 +52,7 @@ const CollectionOperations = ({
showUpdateCollection: () => void;
setting: ReturnType<typeof useCollectionManager>;
}) => {
const t = useAFFiNEI18N();
const actions = useMemo<
Array<
| {
@@ -68,12 +70,12 @@ const CollectionOperations = ({
() => [
{
icon: <FilterIcon />,
name: 'Edit Filter',
name: t['Edit Filter'](),
click: showUpdateCollection,
},
{
icon: <UnpinIcon />,
name: 'Unpin',
name: t['Unpin'](),
click: () => {
return setting.updateCollection({
...view,
@@ -86,14 +88,14 @@ const CollectionOperations = ({
},
{
icon: <DeleteIcon style={{ color: 'var(--affine-warning-color)' }} />,
name: 'Delete',
name: t['Delete'](),
click: () => {
return setting.deleteCollection(view.id);
},
className: styles.deleteFolder,
},
],
[setting, showUpdateCollection, view]
[setting, showUpdateCollection, t, view]
);
return (
<div style={{ minWidth: 150 }}>

View File

@@ -39,6 +39,7 @@ export const PageOperations = ({
addToExcludeList: (id: string) => void;
}) => {
const { removeToTrash } = useBlockSuiteMetaHelper(workspace);
const t = useAFFiNEI18N();
const actions = useMemo<
Array<
| {
@@ -58,7 +59,7 @@ export const PageOperations = ({
? [
{
icon: <FilterMinusIcon />,
name: 'Remove special filter',
name: t['Remove special filter'](),
click: () => removeFromAllowList(page.id),
},
]
@@ -67,7 +68,7 @@ export const PageOperations = ({
? [
{
icon: <FilterUndoIcon />,
name: 'Exclude from filter',
name: t['Exclude from filter'](),
click: () => addToExcludeList(page.id),
},
]
@@ -77,7 +78,7 @@ export const PageOperations = ({
},
{
icon: <DeleteIcon style={{ color: 'var(--affine-warning-color)' }} />,
name: 'Delete',
name: t['Delete'](),
click: () => {
removeToTrash(page.id);
},
@@ -86,9 +87,10 @@ export const PageOperations = ({
],
[
inAllowList,
t,
inExcludeList,
page.id,
removeFromAllowList,
page.id,
addToExcludeList,
removeToTrash,
]

View File

@@ -1,4 +1,5 @@
import { MenuLinkItem } from '@affine/component/app-sidebar';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { EdgelessIcon, PageIcon } from '@blocksuite/icons';
import type { PageMeta, Workspace } from '@blocksuite/store';
import * as Collapsible from '@radix-ui/react-collapsible';
@@ -40,6 +41,7 @@ export const ReferencePage = ({
const collapsible = referencesToShow.length > 0;
const nestedItem = parentIds.size > 0;
const untitled = !metaMapping[pageId]?.title;
const t = useAFFiNEI18N();
return (
<Collapsible.Root
className={styles.favItemWrapper}
@@ -56,7 +58,7 @@ export const ReferencePage = ({
onCollapsedChange={setCollapsed}
>
<span className={styles.label} data-untitled={untitled}>
{metaMapping[pageId]?.title || 'Untitled'}
{metaMapping[pageId]?.title || t['Untitled']()}
</span>
</MenuLinkItem>
{collapsible && (

View File

@@ -11,6 +11,8 @@ export const FilterTag = ({ name }: FilterTagProps) => {
return t['Created']();
case 'Updated':
return t['Updated']();
case 'Tags':
return t['Tags']();
case 'Is Favourited':
return t['com.affine.filter.is-favourited']();
case 'after':
@@ -19,6 +21,18 @@ export const FilterTag = ({ name }: FilterTagProps) => {
return t['com.affine.filter.before']();
case 'is':
return t['com.affine.filter.is']();
case 'is not empty':
return t['com.affine.filter.is not empty']();
case 'is empty':
return t['com.affine.filter.is empty']();
case 'contains all':
return t['com.affine.filter.contains all']();
case 'contains one of':
return t['com.affine.filter.contains one of']();
case 'does not contains all':
return t['com.affine.filter.does not contains all']();
case 'does not contains one of':
return t['com.affine.filter.does not contains one of']();
case 'true':
return t['com.affine.filter.true']();
case 'false':

View File

@@ -1,6 +1,7 @@
import { EditCollectionModel } from '@affine/component/page-list';
import type { PropertiesMeta } from '@affine/env/filter';
import type { GetPageInfoById } from '@affine/env/page-info';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import {
DeleteIcon,
FilterIcon,
@@ -80,6 +81,7 @@ export const CollectionBar = ({
[setting, collection]
);
const onClose = useCallback(() => setOpen(false), []);
const t = useAFFiNEI18N();
return !setting.isDefault ? (
<tr style={{ userSelect: 'none' }}>
<td>
@@ -124,8 +126,11 @@ export const CollectionBar = ({
justifyContent: 'end',
}}
>
<Button style={{ border: 'none' }} onClick={() => setting.backToAll()}>
Back to all
<Button
style={{ border: 'none', position: 'static' }}
onClick={() => setting.backToAll()}
>
{t['Back to all']()}
</Button>
</td>
</tr>

View File

@@ -1,6 +1,7 @@
import type { Collection } from '@affine/env/filter';
import type { PropertiesMeta } from '@affine/env/filter';
import type { GetPageInfoById } from '@affine/env/page-info';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import {
EdgelessIcon,
PageIcon,
@@ -35,14 +36,17 @@ export const EditCollectionModel = ({
onClose,
getPageInfo,
propertiesMeta,
title,
}: {
init?: Collection;
onConfirm: (view: Collection) => void;
open: boolean;
onClose: () => void;
title?: string;
getPageInfo: GetPageInfoById;
propertiesMeta: PropertiesMeta;
}) => {
const t = useAFFiNEI18N();
return (
<Modal open={open} onClose={onClose}>
<ModalWrapper
@@ -61,8 +65,8 @@ export const EditCollectionModel = ({
{init ? (
<EditCollection
propertiesMeta={propertiesMeta}
title="Update Collection"
onConfirmText="Save"
title={title}
onConfirmText={t['Save']()}
init={init}
getPageInfo={getPageInfo}
onCancel={onClose}
@@ -129,6 +133,7 @@ export const EditCollection = ({
}: CreateCollectionProps & {
onCancel: () => void;
}) => {
const t = useAFFiNEI18N();
const [value, onChange] = useState<Collection>(init);
const removeFromExcludeList = useCallback(
(id: string) => {
@@ -157,7 +162,7 @@ export const EditCollection = ({
}}
>
<div className={styles.saveTitle}>
{title ?? 'Save As New Collection'}
{title ?? t['Update Collection']()}
</div>
<ScrollableContainer
className={styles.scrollContainer}
@@ -244,7 +249,7 @@ export const EditCollection = ({
}}
>
<Button className={styles.cancelButton} onClick={onCancel}>
Cancel
{t['Cancel']()}
</Button>
<Button
style={{
@@ -259,7 +264,7 @@ export const EditCollection = ({
}
}}
>
{onConfirmText ?? 'Create'}
{onConfirmText ?? t['Create']()}
</Button>
</div>
</div>
@@ -272,6 +277,7 @@ export const SaveCollectionButton = ({
propertiesMeta,
}: CreateCollectionProps) => {
const [show, changeShow] = useState(false);
const t = useAFFiNEI18N();
return (
<>
<Button
@@ -288,6 +294,7 @@ export const SaveCollectionButton = ({
</div>
</Button>
<EditCollectionModel
title={t['Save As New Collection']()}
propertiesMeta={propertiesMeta}
init={init}
onConfirm={onConfirm}

View File

@@ -61,6 +61,12 @@
"Export AFFiNE backup file": "Export AFFiNE backup file",
"com.affine.filter.before": "before",
"com.affine.filter.is": "is",
"com.affine.filter.is not empty": "is not empty",
"com.affine.filter.is empty": "is empty",
"com.affine.filter.contains all": "contains all",
"com.affine.filter.contains one of": "contains one of",
"com.affine.filter.does not contains all": "does not contains all",
"com.affine.filter.does not contains one of": "does not contains one of",
"com.affine.filter.true": "true",
"com.affine.filter.false": "false",
"com.affine.filter.save-view": "Save View",
@@ -364,6 +370,13 @@
"Date Format": "Date Format",
"Select All": "Select All",
"Collections": "Collections",
"Save As New Collection": "Save As New Collection",
"Update Collection": "Update Collection",
"Back to all": "Back to all",
"Edit Filter": "Edit Filter",
"Unpin": "Unpin",
"Remove special filter": "Remove special filter",
"Exclude from filter": "Exclude from filter",
"Customize your date style.": "Customise your date style.",
"Contact with us": "Contact Us",
"Terms of Use": "Terms of Use",