update i18n
This commit is contained in:
@@ -3,6 +3,20 @@ import { initReactI18next } from 'react-i18next';
|
|||||||
import en_US from './resources/en.json';
|
import en_US from './resources/en.json';
|
||||||
import zh_CN from './resources/zh.json';
|
import zh_CN from './resources/zh.json';
|
||||||
|
|
||||||
|
// See https://react.i18next.com/latest/typescript
|
||||||
|
declare module 'react-i18next' {
|
||||||
|
// and extend them!
|
||||||
|
interface CustomTypeOptions {
|
||||||
|
// custom namespace type if you changed it
|
||||||
|
defaultNS: 'ns1';
|
||||||
|
// custom resources type
|
||||||
|
resources: {
|
||||||
|
en: typeof en_US.translation;
|
||||||
|
zh: typeof zh_CN.translation;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const resources = {
|
const resources = {
|
||||||
en: en_US,
|
en: en_US,
|
||||||
zh: zh_CN,
|
zh: zh_CN,
|
||||||
|
|||||||
@@ -10,12 +10,17 @@
|
|||||||
"Layout": "Layout",
|
"Layout": "Layout",
|
||||||
"Comment": "Comment",
|
"Comment": "Comment",
|
||||||
"Settings": "Settings",
|
"Settings": "Settings",
|
||||||
|
"ComingSoon": "Layout Settings Coming Soon...",
|
||||||
"Duplicate Page": "Duplicate Page",
|
"Duplicate Page": "Duplicate Page",
|
||||||
"Copy Page Link": "Copy Page Link",
|
"Copy Page Link": "Copy Page Link",
|
||||||
"Language": "Language",
|
"Language": "Language",
|
||||||
"Clear Workspace": "Clear Workspace",
|
"Clear Workspace": "Clear Workspace",
|
||||||
"Last edited by": "Last edited by ",
|
"Export As Markdown": "Export As Markdown",
|
||||||
|
"Export As HTML": "Export As HTML",
|
||||||
|
"Export As PDF (Unsupported)": "Export As PDF (Unsupported)",
|
||||||
|
"Import Workspace": "Import Workspace",
|
||||||
|
"Export Workspace": "Export Workspace",
|
||||||
|
"Last edited by": "Last edited by {{name}}",
|
||||||
"Logout": "Logout"
|
"Logout": "Logout"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"IsNotLocalWorkspace": "欢迎来到AFFiNE 的演示界面,您可以同步到磁盘来进行保存操作。",
|
"IsNotLocalWorkspace": "欢迎来到AFFiNE 的演示界面,您可以同步到磁盘来进行保存操作。",
|
||||||
"DoNotStore": "AFFINE 正在积极开发中,当前版本不稳定。请不要存储信息或数据。"
|
"DoNotStore": "AFFINE 正在积极开发中,当前版本不稳定。请不要存储信息或数据。"
|
||||||
},
|
},
|
||||||
|
"ComingSoon": "布局设置即将到来",
|
||||||
"Layout": "布局",
|
"Layout": "布局",
|
||||||
"Comment": "评论",
|
"Comment": "评论",
|
||||||
"Settings": "设置",
|
"Settings": "设置",
|
||||||
@@ -15,7 +15,12 @@
|
|||||||
"Copy Page Link": "复制页面链接",
|
"Copy Page Link": "复制页面链接",
|
||||||
"Language": "当前语言",
|
"Language": "当前语言",
|
||||||
"Clear Workspace": "清空工作区域",
|
"Clear Workspace": "清空工作区域",
|
||||||
"Last edited by": "最后编辑者为 ",
|
"Export As Markdown": "导出 markdown",
|
||||||
|
"Export As HTML": "导出 HTML",
|
||||||
|
"Export As PDF (Unsupported)": "导出 PDF (暂不支持)",
|
||||||
|
"Import Workspace": "导入 Workspace",
|
||||||
|
"Export Workspace": "导出 Workspace",
|
||||||
|
"Last edited by": "最后编辑者为 {{name}}",
|
||||||
"Logout": "退出登录"
|
"Logout": "退出登录"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const ContainerTabs = () => {
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
type: 'layout',
|
type: 'layout',
|
||||||
text: 'Layout',
|
text: t('Layout'),
|
||||||
icon: (
|
icon: (
|
||||||
<IconWrapper>
|
<IconWrapper>
|
||||||
<LayoutIcon />
|
<LayoutIcon />
|
||||||
@@ -33,7 +33,7 @@ export const ContainerTabs = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'comment',
|
type: 'comment',
|
||||||
text: 'Comment',
|
text: t('Comment'),
|
||||||
icon: (
|
icon: (
|
||||||
<IconWrapper>
|
<IconWrapper>
|
||||||
<CommentIcon />
|
<CommentIcon />
|
||||||
@@ -50,7 +50,7 @@ export const ContainerTabs = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'settings',
|
type: 'settings',
|
||||||
text: 'Settings',
|
text: t('Settings'),
|
||||||
icon: (
|
icon: (
|
||||||
<IconWrapper>
|
<IconWrapper>
|
||||||
<SettingsIcon />
|
<SettingsIcon />
|
||||||
@@ -59,7 +59,7 @@ export const ContainerTabs = () => {
|
|||||||
panel: <SettingsPanel />,
|
panel: <SettingsPanel />,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}, [activeCommentId, resolveComment]);
|
}, [activeCommentId, resolveComment, t]);
|
||||||
|
|
||||||
const settingsTabsData = useMemo(() => {
|
const settingsTabsData = useMemo(() => {
|
||||||
return getSettingsTabsData();
|
return getSettingsTabsData();
|
||||||
@@ -76,7 +76,7 @@ export const ContainerTabs = () => {
|
|||||||
const { type, text, icon } = tab;
|
const { type, text, icon } = tab;
|
||||||
return (
|
return (
|
||||||
<TabItemTitle
|
<TabItemTitle
|
||||||
title={t(text)}
|
title={text}
|
||||||
icon={icon}
|
icon={icon}
|
||||||
isActive={activeTab === type}
|
isActive={activeTab === type}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export const SettingsList = () => {
|
|||||||
if (type === 'switch') {
|
if (type === 'switch') {
|
||||||
return (
|
return (
|
||||||
<SwitchItemContainer
|
<SwitchItemContainer
|
||||||
key={item.name}
|
key={item.key}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
item.onChange(!item.value);
|
item.onChange(!item.value);
|
||||||
}}
|
}}
|
||||||
@@ -44,9 +44,9 @@ export const SettingsList = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListItem key={item.name} onClick={() => item.onClick()}>
|
<ListItem key={item.key} onClick={() => item.onClick()}>
|
||||||
{item.name}
|
{item.name}
|
||||||
{item.name === 'Language' ? (
|
{item.key === 'Language' ? (
|
||||||
<div style={{ marginLeft: '12em' }}>
|
<div style={{ marginLeft: '12em' }}>
|
||||||
<Select
|
<Select
|
||||||
defaultValue="en"
|
defaultValue="en"
|
||||||
@@ -62,22 +62,6 @@ export const SettingsList = () => {
|
|||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</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}
|
) : null}
|
||||||
</ListItem>
|
</ListItem>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ export const LastModified = () => {
|
|||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<ContentText type="xs">
|
<ContentText type="xs">
|
||||||
<span>{t('Last edited by')}</span>
|
<span>{t('Last edited by', { name: username })}</span>
|
||||||
<span>{username}</span>
|
|
||||||
</ContentText>
|
</ContentText>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
|
|
||||||
interface BaseSettingItem {
|
interface BaseSettingItem {
|
||||||
flag?: keyof SettingFlags;
|
flag?: keyof SettingFlags;
|
||||||
|
key: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SwitchItem extends BaseSettingItem {
|
interface SwitchItem extends BaseSettingItem {
|
||||||
@@ -83,6 +84,7 @@ export const useSettings = (): SettingItem[] => {
|
|||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
name: t('Duplicate Page'),
|
name: t('Duplicate Page'),
|
||||||
|
key: 'Duplicate Page',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
const newPageInfo = await duplicatePage({
|
const newPageInfo = await duplicatePage({
|
||||||
workspaceId,
|
workspaceId,
|
||||||
@@ -94,6 +96,7 @@ export const useSettings = (): SettingItem[] => {
|
|||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
name: t('Copy Page Link'),
|
name: t('Copy Page Link'),
|
||||||
|
key: 'Copy Page Link',
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
copyToClipboard(window.location.href);
|
copyToClipboard(window.location.href);
|
||||||
message.success('Page link copied successfully');
|
message.success('Page link copied successfully');
|
||||||
@@ -102,16 +105,19 @@ export const useSettings = (): SettingItem[] => {
|
|||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
name: t('Language'),
|
name: t('Language'),
|
||||||
|
key: 'Language',
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
//Do noting
|
// Do noting
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'separator',
|
type: 'separator',
|
||||||
|
key: 'separator1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
name: 'Export As Markdown',
|
name: t('Export As Markdown'),
|
||||||
|
key: 'Export As Markdown',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
const title = await getPageTitle({ workspaceId, pageId });
|
const title = await getPageTitle({ workspaceId, pageId });
|
||||||
exportMarkdown({ workspaceId, rootBlockId: pageId, title });
|
exportMarkdown({ workspaceId, rootBlockId: pageId, title });
|
||||||
@@ -120,7 +126,8 @@ export const useSettings = (): SettingItem[] => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
name: 'Export As HTML',
|
name: t('Export As HTML'),
|
||||||
|
key: 'Export As HTML',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
const title = await getPageTitle({ workspaceId, pageId });
|
const title = await getPageTitle({ workspaceId, pageId });
|
||||||
exportHtml({ workspaceId, rootBlockId: pageId, title });
|
exportHtml({ workspaceId, rootBlockId: pageId, title });
|
||||||
@@ -129,28 +136,33 @@ export const useSettings = (): SettingItem[] => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
name: 'Export As PDF (Unsupported)',
|
name: t('Export As PDF (Unsupported)'),
|
||||||
|
key: 'Export As PDF (Unsupported)',
|
||||||
onClick: () => console.log('Export As PDF'),
|
onClick: () => console.log('Export As PDF'),
|
||||||
flag: 'booleanExportPdf',
|
flag: 'booleanExportPdf',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'separator',
|
type: 'separator',
|
||||||
|
key: 'separator2',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
name: 'Import Workspace',
|
name: t('Import Workspace'),
|
||||||
|
key: 'Import Workspace',
|
||||||
onClick: () => importWorkspace(workspaceId),
|
onClick: () => importWorkspace(workspaceId),
|
||||||
flag: 'booleanImportWorkspace',
|
flag: 'booleanImportWorkspace',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
name: 'Export Workspace',
|
name: t('Export Workspace'),
|
||||||
|
key: 'Export Workspace',
|
||||||
onClick: () => exportWorkspace(),
|
onClick: () => exportWorkspace(),
|
||||||
flag: 'booleanExportWorkspace',
|
flag: 'booleanExportWorkspace',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
name: t('Clear Workspace'),
|
name: t('Clear Workspace'),
|
||||||
|
key: 'Clear Workspace',
|
||||||
onClick: () => clearWorkspace(workspaceId),
|
onClick: () => clearWorkspace(workspaceId),
|
||||||
flag: 'booleanClearWorkspace',
|
flag: 'booleanClearWorkspace',
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user