This commit is contained in:
JimmFly
2022-08-30 11:11:38 +08:00
parent e656941084
commit f475599f2f
10 changed files with 66 additions and 65 deletions
@@ -1,5 +1,4 @@
import { styled } from '@toeverything/components/ui';
import { useTranslation } from 'react-i18next';
import { useLocation, useNavigate, useParams } from 'react-router-dom';
import { StatusText } from './StatusText';
import { StatusTrack } from './StatusTrack';
@@ -11,7 +10,6 @@ export const Switcher = () => {
const navigate = useNavigate();
const params = useParams();
const { pathname } = useLocation();
const { t } = useTranslation();
const pageViewMode = isBoard(pathname) ? DocMode.board : DocMode.doc;
const switchToPageView = (targetViewMode: DocMode) => {
@@ -25,11 +25,11 @@ export const LayoutHeader = () => {
const warningTips = useMemo(() => {
if (!fsApiSupported()) {
return t('warningTips.isNotfsApiSupported');
return t('WarningTips.IsNotfsApiSupported');
} else if (!isLocalWorkspace) {
return t('warningTips.isNotLocalWorkspace');
return t('WarningTips.IsNotLocalWorkspace');
} else {
return t('warningTips.DoNotStore');
return t('WarningTips.DoNotStore');
}
}, [isLocalWorkspace, t]);
+3 -4
View File
@@ -4,15 +4,14 @@ import en_US from './resources/en.json';
import zh_CN from './resources/zh.json';
const resources = {
translation: {
en: en_US,
zh: zh_CN,
},
en: en_US,
zh: zh_CN,
} as const;
i18next.use(initReactI18next).init({
lng: 'en',
fallbackLng: 'en',
resources,
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
@@ -1,26 +1,21 @@
{
"Sync to Disk": "Sync to Disk",
"Share": "Share",
"WarningTips": {
"IsNotfsApiSupported": "Welcome to the AFFiNE demo. To begin saving changes you can SYNC DATA TO DISK with the latest version of Chromium based browser like Chrome/Edge",
"IsNotLocalWorkspace": "Welcome to the AFFiNE demo. To begin saving changes you can SYNC TO DISK.",
"DoNotStore": "AFFiNE is under active development and the current version is UNSTABLE. Please DO NOT store information or data"
},
"Setting": {
"Layout": {
"Title": "Layout"
"translation": {
"Sync to Disk": "Sync to Disk",
"Share": "Share",
"WarningTips": {
"IsNotfsApiSupported": "Welcome to the AFFiNE demo. To begin saving changes you can SYNC DATA TO DISK with the latest version of Chromium based browser like Chrome/Edge",
"IsNotLocalWorkspace": "Welcome to the AFFiNE demo. To begin saving changes you can SYNC TO DISK.",
"DoNotStore": "AFFiNE is under active development and the current version is UNSTABLE. Please DO NOT store information or data"
},
"Comment": {
"Title": "Comment"
},
"Settings": {
"Title": "Settings",
"Duplicate Page": "Duplicate Page",
"Copy Page Link": "Copy Page Link",
"Language": "Language",
"Clear Workspace": "Clear Workspace",
"Last edited by": "Last edited by ",
"Logout": "Logout"
}
"Layout": "Layout",
"Comment": "Comment",
"Settings": "Settings",
"Duplicate Page": "Duplicate Page",
"Copy Page Link": "Copy Page Link",
"Language": "Language",
"Clear Workspace": "Clear Workspace",
"Last edited by": "Last edited by ",
"Logout": "Logout"
}
}
@@ -1,26 +1,21 @@
{
"Sync to Disk": "同步到磁盘",
"Share": "分享",
"WarningTips": {
"IsNotfsApiSupported": "欢迎来到AFFiNE 的演示界面。您可以使用最新版本的基于Chrome的浏览器(如Chrome/Edge)将数据同步到磁盘来进行保存",
"IsNotLocalWorkspace": "欢迎来到AFFiNE 的演示界面您可以同步到磁盘来进行保存操作。",
"DoNotStore": "AFFINE 正在积极开发中,当前版本不稳定。请不要存储信息或数据。"
},
"Setting": {
"Layout": {
"Title": "布局"
"translation": {
"Sync to Disk": "同步到磁盘",
"Share": "分享",
"WarningTips": {
"IsNotfsApiSupported": "欢迎来到AFFiNE 的演示界面您可以使用最新版本的基于Chrome的浏览器(如Chrome/Edge)将数据同步到磁盘来进行保存",
"IsNotLocalWorkspace": "欢迎来到AFFiNE 的演示界面,您可以同步到磁盘来进行保存操作。",
"DoNotStore": "AFFINE 正在积极开发中,当前版本不稳定。请不要存储信息或数据。"
},
"Comment": {
"Title": "评论"
},
"Settings": {
"Title": "设置",
"Duplicate Page": "复制页面",
"Copy Page Link": "拷贝页面链接",
"Language": "当前语言",
"Clear Workspace": "清空工作区域",
"Last edited by": "最后编辑者为 ",
"Logout": "退出登录"
}
"Layout": "布局",
"Comment": "评论",
"Settings": "设置",
"Duplicate Page": "复制页面",
"Copy Page Link": "复制页面链接",
"Language": "当前语言",
"Clear Workspace": "清空工作区域",
"Last edited by": "最后编辑者为 ",
"Logout": "退出登录"
}
}
@@ -23,7 +23,7 @@ export const ContainerTabs = () => {
return [
{
type: 'layout',
text: t('Setting.Layout'),
text: 'Layout',
icon: (
<IconWrapper>
<LayoutIcon />
@@ -33,7 +33,7 @@ export const ContainerTabs = () => {
},
{
type: 'comment',
text: t('Setting.Comment'),
text: 'Comment',
icon: (
<IconWrapper>
<CommentIcon />
@@ -50,7 +50,7 @@ export const ContainerTabs = () => {
},
{
type: 'settings',
text: t('Setting.Settings'),
text: 'Settings',
icon: (
<IconWrapper>
<SettingsIcon />
@@ -76,7 +76,7 @@ export const ContainerTabs = () => {
const { type, text, icon } = tab;
return (
<TabItemTitle
title={text}
title={t(text)}
icon={icon}
isActive={activeTab === type}
onClick={() => {
@@ -62,6 +62,22 @@ 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,7 +15,7 @@ export const LastModified = () => {
<div>
<div>
<ContentText type="xs">
<span>{t('stetting.Settings.Last edited by')}</span>
<span>{t('Last edited by')}</span>
<span>{username}</span>
</ContentText>
</div>
@@ -21,9 +21,7 @@ export const Logout = () => {
return (
<ListItem onClick={logout}>
<StyledIcon />
<ContentText type="base">
{t('stetting.Settings.Logout')}
</ContentText>
<ContentText type="base">{t('Logout')}</ContentText>
</ListItem>
);
};
@@ -82,7 +82,7 @@ export const useSettings = (): SettingItem[] => {
// },
{
type: 'button',
name: t('Setting.Settings.Duplicate Page'),
name: t('Duplicate Page'),
onClick: async () => {
const newPageInfo = await duplicatePage({
workspaceId,
@@ -93,7 +93,7 @@ export const useSettings = (): SettingItem[] => {
},
{
type: 'button',
name: t('Setting.Settings.Copy Page Link'),
name: t('Copy Page Link'),
onClick: () => {
copyToClipboard(window.location.href);
message.success('Page link copied successfully');
@@ -101,7 +101,7 @@ export const useSettings = (): SettingItem[] => {
},
{
type: 'button',
name: t('Setting.Settings.Language'),
name: t('Language'),
onClick: () => {
//Do noting
},
@@ -150,7 +150,7 @@ export const useSettings = (): SettingItem[] => {
},
{
type: 'button',
name: t('Setting.Settings.Clear Workspace'),
name: t('Clear Workspace'),
onClick: () => clearWorkspace(workspaceId),
flag: 'booleanClearWorkspace',
},