update i18n

This commit is contained in:
JimmFly
2022-08-30 12:42:04 +08:00
parent 6b373642e7
commit 838113941e
7 changed files with 55 additions and 36 deletions
@@ -23,7 +23,7 @@ export const ContainerTabs = () => {
return [
{
type: 'layout',
text: 'Layout',
text: t('Layout'),
icon: (
<IconWrapper>
<LayoutIcon />
@@ -33,7 +33,7 @@ export const ContainerTabs = () => {
},
{
type: 'comment',
text: 'Comment',
text: t('Comment'),
icon: (
<IconWrapper>
<CommentIcon />
@@ -50,7 +50,7 @@ export const ContainerTabs = () => {
},
{
type: 'settings',
text: 'Settings',
text: t('Settings'),
icon: (
<IconWrapper>
<SettingsIcon />
@@ -59,7 +59,7 @@ export const ContainerTabs = () => {
panel: <SettingsPanel />,
},
];
}, [activeCommentId, resolveComment]);
}, [activeCommentId, resolveComment, t]);
const settingsTabsData = useMemo(() => {
return getSettingsTabsData();
@@ -76,7 +76,7 @@ export const ContainerTabs = () => {
const { type, text, icon } = tab;
return (
<TabItemTitle
title={t(text)}
title={text}
icon={icon}
isActive={activeTab === type}
onClick={() => {
@@ -28,7 +28,7 @@ export const SettingsList = () => {
if (type === 'switch') {
return (
<SwitchItemContainer
key={item.name}
key={item.key}
onClick={() => {
item.onChange(!item.value);
}}
@@ -44,9 +44,9 @@ export const SettingsList = () => {
}
return (
<ListItem key={item.name} onClick={() => item.onClick()}>
<ListItem key={item.key} onClick={() => item.onClick()}>
{item.name}
{item.name === 'Language' ? (
{item.key === 'Language' ? (
<div style={{ marginLeft: '12em' }}>
<Select
defaultValue="en"
@@ -62,22 +62,6 @@ export const SettingsList = () => {
))}
</Select>
</div>
) : item.name === '当前语言' ? (
<div style={{ marginLeft: '12em' }}>
<Select
defaultValue="zh"
onChange={changeLanguage}
>
{options.map(option => (
<Option
key={option.value}
value={option.value}
>
{option.text}
</Option>
))}
</Select>
</div>
) : null}
</ListItem>
);
@@ -15,8 +15,7 @@ export const LastModified = () => {
<div>
<div>
<ContentText type="xs">
<span>{t('Last edited by')}</span>
<span>{username}</span>
<span>{t('Last edited by', { name: username })}</span>
</ContentText>
</div>
<div>
@@ -17,6 +17,7 @@ import {
interface BaseSettingItem {
flag?: keyof SettingFlags;
key: string;
}
interface SwitchItem extends BaseSettingItem {
@@ -83,6 +84,7 @@ export const useSettings = (): SettingItem[] => {
{
type: 'button',
name: t('Duplicate Page'),
key: 'Duplicate Page',
onClick: async () => {
const newPageInfo = await duplicatePage({
workspaceId,
@@ -94,6 +96,7 @@ export const useSettings = (): SettingItem[] => {
{
type: 'button',
name: t('Copy Page Link'),
key: 'Copy Page Link',
onClick: () => {
copyToClipboard(window.location.href);
message.success('Page link copied successfully');
@@ -102,16 +105,19 @@ export const useSettings = (): SettingItem[] => {
{
type: 'button',
name: t('Language'),
key: 'Language',
onClick: () => {
//Do noting
// Do noting
},
},
{
type: 'separator',
key: 'separator1',
},
{
type: 'button',
name: 'Export As Markdown',
name: t('Export As Markdown'),
key: 'Export As Markdown',
onClick: async () => {
const title = await getPageTitle({ workspaceId, pageId });
exportMarkdown({ workspaceId, rootBlockId: pageId, title });
@@ -120,7 +126,8 @@ export const useSettings = (): SettingItem[] => {
},
{
type: 'button',
name: 'Export As HTML',
name: t('Export As HTML'),
key: 'Export As HTML',
onClick: async () => {
const title = await getPageTitle({ workspaceId, pageId });
exportHtml({ workspaceId, rootBlockId: pageId, title });
@@ -129,28 +136,33 @@ export const useSettings = (): SettingItem[] => {
},
{
type: 'button',
name: 'Export As PDF (Unsupported)',
name: t('Export As PDF (Unsupported)'),
key: 'Export As PDF (Unsupported)',
onClick: () => console.log('Export As PDF'),
flag: 'booleanExportPdf',
},
{
type: 'separator',
key: 'separator2',
},
{
type: 'button',
name: 'Import Workspace',
name: t('Import Workspace'),
key: 'Import Workspace',
onClick: () => importWorkspace(workspaceId),
flag: 'booleanImportWorkspace',
},
{
type: 'button',
name: 'Export Workspace',
name: t('Export Workspace'),
key: 'Export Workspace',
onClick: () => exportWorkspace(),
flag: 'booleanExportWorkspace',
},
{
type: 'button',
name: t('Clear Workspace'),
key: 'Clear Workspace',
onClick: () => clearWorkspace(workspaceId),
flag: 'booleanClearWorkspace',
},