mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 18:46:19 +08:00
update i18n
This commit is contained in:
@@ -3,6 +3,20 @@ import { initReactI18next } from 'react-i18next';
|
||||
import en_US from './resources/en.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 = {
|
||||
en: en_US,
|
||||
zh: zh_CN,
|
||||
|
||||
@@ -10,12 +10,17 @@
|
||||
"Layout": "Layout",
|
||||
"Comment": "Comment",
|
||||
"Settings": "Settings",
|
||||
|
||||
"ComingSoon": "Layout Settings Coming Soon...",
|
||||
"Duplicate Page": "Duplicate Page",
|
||||
"Copy Page Link": "Copy Page Link",
|
||||
"Language": "Language",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"IsNotLocalWorkspace": "欢迎来到AFFiNE 的演示界面,您可以同步到磁盘来进行保存操作。",
|
||||
"DoNotStore": "AFFINE 正在积极开发中,当前版本不稳定。请不要存储信息或数据。"
|
||||
},
|
||||
|
||||
"ComingSoon": "布局设置即将到来",
|
||||
"Layout": "布局",
|
||||
"Comment": "评论",
|
||||
"Settings": "设置",
|
||||
@@ -15,7 +15,12 @@
|
||||
"Copy Page Link": "复制页面链接",
|
||||
"Language": "当前语言",
|
||||
"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": "退出登录"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user