update i18n

This commit is contained in:
JimmFly
2022-08-30 10:32:52 +08:00
parent 0bda0feb83
commit e656941084
7 changed files with 64 additions and 68 deletions
@@ -38,7 +38,7 @@ export const Switcher = () => {
active={pageViewMode === DocMode.doc}
onClick={() => switchToPageView(DocMode.doc)}
>
{t('Paper')}
Paper
</StatusText>
<StatusTrack
mode={pageViewMode}
@@ -55,7 +55,7 @@ export const Switcher = () => {
active={pageViewMode === DocMode.board}
onClick={() => switchToPageView(DocMode.board)}
>
{t('Edgeless')}
Edgeless
</StatusText>
</StyledContainerForSwitcher>
);
+4 -2
View File
@@ -4,8 +4,10 @@ import en_US from './resources/en.json';
import zh_CN from './resources/zh.json';
const resources = {
en: en_US,
zh: zh_CN,
translation: {
en: en_US,
zh: zh_CN,
},
} as const;
i18next.use(initReactI18next).init({
@@ -1,30 +1,26 @@
{
"translation": {
"Paper": "Paper",
"Edgeless": "Edgeless",
"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"
"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"
},
"setting": {
"Layout": {
"title": "Layout"
},
"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"
}
"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"
}
}
}
@@ -1,30 +1,26 @@
{
"translation": {
"Paper": "页面",
"Edgeless": "无边缘",
"Sync to Disk": "同步到磁盘",
"Share": "分享",
"warningTips": {
"isNotfsApiSupported": "欢迎来到AFFiNE 的演示界面。您可以使用最新版本的基于Chrome的浏览器(如Chrome/Edge)将数据同步到磁盘来进行保存",
"isNotLocalWorkspace": "欢迎来到AFFiNE 的演示界面,您可以同步到磁盘来进行保存操作。",
"DoNotStore": "AFFINE 正在积极开发中,当前版本不稳定。请不要存储信息或数据。"
"Sync to Disk": "同步到磁盘",
"Share": "分享",
"WarningTips": {
"IsNotfsApiSupported": "欢迎来到AFFiNE 的演示界面。您可以使用最新版本的基于Chrome的浏览器(如Chrome/Edge)将数据同步到磁盘来进行保存",
"IsNotLocalWorkspace": "欢迎来到AFFiNE 的演示界面,您可以同步到磁盘来进行保存操作。",
"DoNotStore": "AFFINE 正在积极开发中,当前版本不稳定。请不要存储信息或数据。"
},
"Setting": {
"Layout": {
"Title": "布局"
},
"stetting": {
"Layout": {
"title": "布局"
},
"Comment": {
"title": "评论"
},
"Settings": {
"title": "设置",
"Duplicate Page": "复制页面",
"Copy Page Link": "拷贝页面链接",
"Language": "当前语言",
"Clear Workspace": "清空工作区域",
"Last edited by": "最后编辑者为 ",
"Logout": "登出"
}
"Comment": {
"Title": "评论"
},
"Settings": {
"Title": "设置",
"Duplicate Page": "复制页面",
"Copy Page Link": "拷贝页面链接",
"Language": "当前语言",
"Clear Workspace": "清空工作区域",
"Last edited by": "最后编辑者为 ",
"Logout": "退出登录"
}
}
}
@@ -17,12 +17,13 @@ const _defaultTabsKeys = ['layout', 'comment', 'settings'] as const;
export const ContainerTabs = () => {
const { activeCommentId, resolveComment } = useActiveComment();
const { t } = useTranslation();
const getSettingsTabsData = useCallback((): SettingsTabItemType[] => {
return [
{
type: 'layout',
text: 'Layout',
text: t('Setting.Layout'),
icon: (
<IconWrapper>
<LayoutIcon />
@@ -32,7 +33,7 @@ export const ContainerTabs = () => {
},
{
type: 'comment',
text: 'Comment',
text: t('Setting.Comment'),
icon: (
<IconWrapper>
<CommentIcon />
@@ -49,7 +50,7 @@ export const ContainerTabs = () => {
},
{
type: 'settings',
text: 'Settings',
text: t('Setting.Settings'),
icon: (
<IconWrapper>
<SettingsIcon />
@@ -68,7 +69,6 @@ export const ContainerTabs = () => {
_defaultTabsKeys as unknown as string[],
'settings'
);
const { t } = useTranslation();
return (
<>
<StyledTabsTitlesContainer>
@@ -76,7 +76,7 @@ export const ContainerTabs = () => {
const { type, text, icon } = tab;
return (
<TabItemTitle
title={t(`stetting.${text}.title`)}
title={text}
icon={icon}
isActive={activeTab === type}
onClick={() => {
@@ -12,8 +12,8 @@ import { useSettings } from './use-settings';
export const SettingsList = () => {
const settings = useSettings();
const { t, i18n } = useTranslation();
const changeLanguage = (event: any) => {
const { i18n } = useTranslation();
const changeLanguage = event => {
i18n.changeLanguage(event);
};
@@ -45,7 +45,7 @@ export const SettingsList = () => {
return (
<ListItem key={item.name} onClick={() => item.onClick()}>
{t(`stetting.Settings.${item.name}`)}
{item.name}
{item.name === 'Language' ? (
<div style={{ marginLeft: '12em' }}>
<Select
@@ -1,9 +1,10 @@
import { message } from '@toeverything/components/ui';
import { copyToClipboard } from '@toeverything/utils';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { useSettingFlags, type SettingFlags } from './use-setting-flags';
import {
// useReadingMode,
clearWorkspace,
duplicatePage,
exportHtml,
@@ -64,6 +65,7 @@ export const useSettings = (): SettingItem[] => {
const { workspaceId, pageId } = useWorkspaceAndPageId();
const navigate = useNavigate();
const settingFlags = useSettingFlags();
const { t } = useTranslation();
// const { toggleReadingMode, readingMode } = useReadingMode();
const settings: SettingItem[] = [
@@ -80,7 +82,7 @@ export const useSettings = (): SettingItem[] => {
// },
{
type: 'button',
name: 'Duplicate Page',
name: t('Setting.Settings.Duplicate Page'),
onClick: async () => {
const newPageInfo = await duplicatePage({
workspaceId,
@@ -91,7 +93,7 @@ export const useSettings = (): SettingItem[] => {
},
{
type: 'button',
name: 'Copy Page Link',
name: t('Setting.Settings.Copy Page Link'),
onClick: () => {
copyToClipboard(window.location.href);
message.success('Page link copied successfully');
@@ -99,9 +101,9 @@ export const useSettings = (): SettingItem[] => {
},
{
type: 'button',
name: 'Language',
name: t('Setting.Settings.Language'),
onClick: () => {
console.log('Language is change');
//Do noting
},
},
{
@@ -148,7 +150,7 @@ export const useSettings = (): SettingItem[] => {
},
{
type: 'button',
name: 'Clear Workspace',
name: t('Setting.Settings.Clear Workspace'),
onClick: () => clearWorkspace(workspaceId),
flag: 'booleanClearWorkspace',
},