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

View File

@@ -1,5 +1,4 @@
import { styled } from '@toeverything/components/ui'; import { styled } from '@toeverything/components/ui';
import { useTranslation } from 'react-i18next';
import { useLocation, useNavigate, useParams } from 'react-router-dom'; import { useLocation, useNavigate, useParams } from 'react-router-dom';
import { StatusText } from './StatusText'; import { StatusText } from './StatusText';
import { StatusTrack } from './StatusTrack'; import { StatusTrack } from './StatusTrack';
@@ -11,7 +10,6 @@ export const Switcher = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const params = useParams(); const params = useParams();
const { pathname } = useLocation(); const { pathname } = useLocation();
const { t } = useTranslation();
const pageViewMode = isBoard(pathname) ? DocMode.board : DocMode.doc; const pageViewMode = isBoard(pathname) ? DocMode.board : DocMode.doc;
const switchToPageView = (targetViewMode: DocMode) => { const switchToPageView = (targetViewMode: DocMode) => {

View File

@@ -25,11 +25,11 @@ export const LayoutHeader = () => {
const warningTips = useMemo(() => { const warningTips = useMemo(() => {
if (!fsApiSupported()) { if (!fsApiSupported()) {
return t('warningTips.isNotfsApiSupported'); return t('WarningTips.IsNotfsApiSupported');
} else if (!isLocalWorkspace) { } else if (!isLocalWorkspace) {
return t('warningTips.isNotLocalWorkspace'); return t('WarningTips.IsNotLocalWorkspace');
} else { } else {
return t('warningTips.DoNotStore'); return t('WarningTips.DoNotStore');
} }
}, [isLocalWorkspace, t]); }, [isLocalWorkspace, t]);

View File

@@ -4,15 +4,14 @@ import en_US from './resources/en.json';
import zh_CN from './resources/zh.json'; import zh_CN from './resources/zh.json';
const resources = { const resources = {
translation: { en: en_US,
en: en_US, zh: zh_CN,
zh: zh_CN,
},
} as const; } as const;
i18next.use(initReactI18next).init({ i18next.use(initReactI18next).init({
lng: 'en', lng: 'en',
fallbackLng: 'en', fallbackLng: 'en',
resources, resources,
interpolation: { interpolation: {
escapeValue: false, // not needed for react as it escapes by default escapeValue: false, // not needed for react as it escapes by default

View File

@@ -1,26 +1,21 @@
{ {
"Sync to Disk": "Sync to Disk", "translation": {
"Share": "Share", "Sync to Disk": "Sync to Disk",
"WarningTips": { "Share": "Share",
"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", "WarningTips": {
"IsNotLocalWorkspace": "Welcome to the AFFiNE demo. To begin saving changes you can SYNC TO DISK.", "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",
"DoNotStore": "AFFiNE is under active development and the current version is UNSTABLE. Please DO NOT store information or data" "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"
}, },
"Comment": { "Layout": "Layout",
"Title": "Comment" "Comment": "Comment",
}, "Settings": "Settings",
"Settings": {
"Title": "Settings", "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 ",
"Last edited by": "Last edited by ", "Logout": "Logout"
"Logout": "Logout"
}
} }
} }

View File

@@ -1,26 +1,21 @@
{ {
"Sync to Disk": "同步到磁盘", "translation": {
"Share": "分享", "Sync to Disk": "同步到磁盘",
"WarningTips": { "Share": "分享",
"IsNotfsApiSupported": "欢迎来到AFFiNE 的演示界面。您可以使用最新版本的基于Chrome的浏览器(如Chrome/Edge)将数据同步到磁盘来进行保存", "WarningTips": {
"IsNotLocalWorkspace": "欢迎来到AFFiNE 的演示界面,您可以同步到磁盘来进行保存操作。", "IsNotfsApiSupported": "欢迎来到AFFiNE 的演示界面。您可以使用最新版本的基于Chrome的浏览器(如Chrome/Edge)将数据同步到磁盘来进行保存",
"DoNotStore": "AFFINE 正在积极开发中,当前版本不稳定。请不要存储信息或数据。" "IsNotLocalWorkspace": "欢迎来到AFFiNE 的演示界面,您可以同步到磁盘来进行保存操作。",
}, "DoNotStore": "AFFINE 正在积极开发中,当前版本不稳定。请不要存储信息或数据。"
"Setting": {
"Layout": {
"Title": "布局"
}, },
"Comment": {
"Title": "评论" "Layout": "布局",
}, "Comment": "评论",
"Settings": { "Settings": "设置",
"Title": "设置", "Duplicate Page": "复制页面",
"Duplicate Page": "复制页面", "Copy Page Link": "复制页面链接",
"Copy Page Link": "拷贝页面链接", "Language": "当前语言",
"Language": "当前语言", "Clear Workspace": "清空工作区域",
"Clear Workspace": "清空工作区域", "Last edited by": "最后编辑者为 ",
"Last edited by": "最后编辑者为 ", "Logout": "退出登录"
"Logout": "退出登录"
}
} }
} }

View File

@@ -23,7 +23,7 @@ export const ContainerTabs = () => {
return [ return [
{ {
type: 'layout', type: 'layout',
text: t('Setting.Layout'), text: 'Layout',
icon: ( icon: (
<IconWrapper> <IconWrapper>
<LayoutIcon /> <LayoutIcon />
@@ -33,7 +33,7 @@ export const ContainerTabs = () => {
}, },
{ {
type: 'comment', type: 'comment',
text: t('Setting.Comment'), text: 'Comment',
icon: ( icon: (
<IconWrapper> <IconWrapper>
<CommentIcon /> <CommentIcon />
@@ -50,7 +50,7 @@ export const ContainerTabs = () => {
}, },
{ {
type: 'settings', type: 'settings',
text: t('Setting.Settings'), text: 'Settings',
icon: ( icon: (
<IconWrapper> <IconWrapper>
<SettingsIcon /> <SettingsIcon />
@@ -76,7 +76,7 @@ export const ContainerTabs = () => {
const { type, text, icon } = tab; const { type, text, icon } = tab;
return ( return (
<TabItemTitle <TabItemTitle
title={text} title={t(text)}
icon={icon} icon={icon}
isActive={activeTab === type} isActive={activeTab === type}
onClick={() => { onClick={() => {

View File

@@ -62,6 +62,22 @@ 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>
); );

View File

@@ -15,7 +15,7 @@ export const LastModified = () => {
<div> <div>
<div> <div>
<ContentText type="xs"> <ContentText type="xs">
<span>{t('stetting.Settings.Last edited by')}</span> <span>{t('Last edited by')}</span>
<span>{username}</span> <span>{username}</span>
</ContentText> </ContentText>
</div> </div>

View File

@@ -21,9 +21,7 @@ export const Logout = () => {
return ( return (
<ListItem onClick={logout}> <ListItem onClick={logout}>
<StyledIcon /> <StyledIcon />
<ContentText type="base"> <ContentText type="base">{t('Logout')}</ContentText>
{t('stetting.Settings.Logout')}
</ContentText>
</ListItem> </ListItem>
); );
}; };

View File

@@ -82,7 +82,7 @@ export const useSettings = (): SettingItem[] => {
// }, // },
{ {
type: 'button', type: 'button',
name: t('Setting.Settings.Duplicate Page'), name: t('Duplicate Page'),
onClick: async () => { onClick: async () => {
const newPageInfo = await duplicatePage({ const newPageInfo = await duplicatePage({
workspaceId, workspaceId,
@@ -93,7 +93,7 @@ export const useSettings = (): SettingItem[] => {
}, },
{ {
type: 'button', type: 'button',
name: t('Setting.Settings.Copy Page Link'), name: t('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');
@@ -101,7 +101,7 @@ export const useSettings = (): SettingItem[] => {
}, },
{ {
type: 'button', type: 'button',
name: t('Setting.Settings.Language'), name: t('Language'),
onClick: () => { onClick: () => {
//Do noting //Do noting
}, },
@@ -150,7 +150,7 @@ export const useSettings = (): SettingItem[] => {
}, },
{ {
type: 'button', type: 'button',
name: t('Setting.Settings.Clear Workspace'), name: t('Clear Workspace'),
onClick: () => clearWorkspace(workspaceId), onClick: () => clearWorkspace(workspaceId),
flag: 'booleanClearWorkspace', flag: 'booleanClearWorkspace',
}, },