refactor: change locale key (#3838)

This commit is contained in:
Garfield Lee
2023-09-06 15:20:44 +08:00
committed by GitHub
parent b3d902e33f
commit 925c18300f
49 changed files with 2622 additions and 2324 deletions
@@ -24,6 +24,7 @@ const DEFAULT_SHOW_LIST: IslandItemNames[] = [
];
const DESKTOP_SHOW_LIST: IslandItemNames[] = [...DEFAULT_SHOW_LIST, 'guide'];
export type IslandItemNames = 'whatNew' | 'contact' | 'shortcuts' | 'guide';
export const HelpIsland = ({
showList = environment.isDesktop ? DESKTOP_SHOW_LIST : DEFAULT_SHOW_LIST,
}: {
@@ -61,7 +62,10 @@ export const HelpIsland = ({
style={{ height: spread ? `${showList.length * 40 + 4}px` : 0 }}
>
{showList.includes('whatNew') && (
<Tooltip content={t["Discover what's new!"]()} side="left">
<Tooltip
content={t['com.affine.appUpdater.whatsNew']()}
side="left"
>
<StyledIconWrapper
data-testid="right-bottom-change-log-icon"
onClick={() => {
@@ -73,7 +77,10 @@ export const HelpIsland = ({
</Tooltip>
)}
{showList.includes('contact') && (
<Tooltip content={t['Contact Us']()} side="left">
<Tooltip
content={t['com.affine.helpIsland.contactUs']()}
side="left"
>
<StyledIconWrapper
data-testid="right-bottom-contact-us-icon"
onClick={openAbout}
@@ -83,7 +90,10 @@ export const HelpIsland = ({
</Tooltip>
)}
{showList.includes('shortcuts') && (
<Tooltip content={t['Keyboard Shortcuts']()} side="left">
<Tooltip
content={t['com.affine.keyboardShortcuts.title']()}
side="left"
>
<StyledIconWrapper
data-testid="shortcuts-icon"
onClick={() => {
@@ -113,7 +123,10 @@ export const HelpIsland = ({
)}
</StyledAnimateWrapper>
<Tooltip content={t['Help and Feedback']()} side="left">
<Tooltip
content={t['com.affine.helpIsland.helpAndFeedback']()}
side="left"
>
<MuiFade in={!spread} data-testid="faq-icon">
<StyledTriggerWrapper>
<HelpIcon />
@@ -34,7 +34,7 @@ export const useSwitchToConfig = (workspaceId: string): Config[] => {
return useMemo(
() => [
{
title: t['All pages'](),
title: t['com.affine.workspaceSubPath.all'](),
subPath: WorkspaceSubPath.ALL,
icon: FolderIcon,
},
@@ -50,7 +50,7 @@ export const useSwitchToConfig = (workspaceId: string): Config[] => {
icon: SettingsIcon,
},
{
title: t['Trash'](),
title: t['com.affine.workspaceSubPath.trash'](),
subPath: WorkspaceSubPath.TRASH,
icon: DeleteTemporarilyIcon,
},
@@ -39,11 +39,15 @@ export const TrashButtonGroup = () => {
type="primary"
onClick={() => {
restoreFromTrash(pageId);
toast(t['restored']({ title: pageMeta.title || 'Untitled' }));
toast(
t['com.affine.toastMessage.restored']({
title: pageMeta.title || 'Untitled',
})
);
}}
size="large"
>
{t['Restore it']()}
{t['com.affine.trashOperation.restoreIt']()}
</Button>
</div>
<div className={buttonContainer}>
@@ -54,19 +58,19 @@ export const TrashButtonGroup = () => {
}}
size="large"
>
{t['Delete permanently']()}
{t['com.affine.trashOperation.deletePermanently']()}
</Button>
</div>
<Confirm
title={t['TrashButtonGroupTitle']()}
content={t['TrashButtonGroupDescription']()}
confirmText={t['Delete']()}
title={t['com.affine.trashOperation.delete.title']()}
content={t['com.affine.trashOperation.delete.description']()}
confirmText={t['com.affine.trashOperation.delete']()}
confirmType="error"
open={open}
onConfirm={useCallback(() => {
jumpToSubPath(workspace.id, WorkspaceSubPath.ALL);
blockSuiteWorkspace.removePage(pageId);
toast(t['Permanently deleted']());
toast(t['com.affine.toastMessage.permanentlyDeleted']());
}, [blockSuiteWorkspace, jumpToSubPath, pageId, workspace.id, t])}
onCancel={() => {
setOpen(false);
@@ -21,10 +21,12 @@ export const WorkspaceModeFilterTab = () => {
onValueChange={handleValueChange}
>
<RadioButton value="all" style={{ textTransform: 'capitalize' }}>
{t['all']()}
{t['com.affine.pageMode.all']()}
</RadioButton>
<RadioButton value="page">{t['com.affine.pageMode.page']()}</RadioButton>
<RadioButton value="edgeless">
{t['com.affine.pageMode.edgeless']()}
</RadioButton>
<RadioButton value="page">{t['Page']()}</RadioButton>
<RadioButton value="edgeless">{t['Edgeless']()}</RadioButton>
</RadioButtonGroup>
);
};
@@ -51,7 +51,7 @@ export const AddCollectionButton = ({
onConfirm={setting.saveCollection}
open={show}
onClose={() => showUpdateCollection(false)}
title={t['Save as New Collection']()}
title={t['com.affine.editCollection.saveCollection']()}
init={defaultCollection}
/>
</>
@@ -96,7 +96,7 @@ export const PageOperations = ({
<DeleteIcon />
</MenuIcon>
),
name: t['Delete'](),
name: t['com.affine.trashOperation.delete'](),
click: () => {
removeToTrash(page.id);
},