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

View File

@@ -38,7 +38,7 @@ export const Switcher = () => {
active={pageViewMode === DocMode.doc} active={pageViewMode === DocMode.doc}
onClick={() => switchToPageView(DocMode.doc)} onClick={() => switchToPageView(DocMode.doc)}
> >
{t('Paper')} Paper
</StatusText> </StatusText>
<StatusTrack <StatusTrack
mode={pageViewMode} mode={pageViewMode}
@@ -55,7 +55,7 @@ export const Switcher = () => {
active={pageViewMode === DocMode.board} active={pageViewMode === DocMode.board}
onClick={() => switchToPageView(DocMode.board)} onClick={() => switchToPageView(DocMode.board)}
> >
{t('Edgeless')} Edgeless
</StatusText> </StatusText>
</StyledContainerForSwitcher> </StyledContainerForSwitcher>
); );

View File

@@ -4,8 +4,10 @@ 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 = {
en: en_US, translation: {
zh: zh_CN, en: en_US,
zh: zh_CN,
},
} as const; } as const;
i18next.use(initReactI18next).init({ i18next.use(initReactI18next).init({

View File

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

View File

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

View File

@@ -17,12 +17,13 @@ const _defaultTabsKeys = ['layout', 'comment', 'settings'] as const;
export const ContainerTabs = () => { export const ContainerTabs = () => {
const { activeCommentId, resolveComment } = useActiveComment(); const { activeCommentId, resolveComment } = useActiveComment();
const { t } = useTranslation();
const getSettingsTabsData = useCallback((): SettingsTabItemType[] => { const getSettingsTabsData = useCallback((): SettingsTabItemType[] => {
return [ return [
{ {
type: 'layout', type: 'layout',
text: 'Layout', text: t('Setting.Layout'),
icon: ( icon: (
<IconWrapper> <IconWrapper>
<LayoutIcon /> <LayoutIcon />
@@ -32,7 +33,7 @@ export const ContainerTabs = () => {
}, },
{ {
type: 'comment', type: 'comment',
text: 'Comment', text: t('Setting.Comment'),
icon: ( icon: (
<IconWrapper> <IconWrapper>
<CommentIcon /> <CommentIcon />
@@ -49,7 +50,7 @@ export const ContainerTabs = () => {
}, },
{ {
type: 'settings', type: 'settings',
text: 'Settings', text: t('Setting.Settings'),
icon: ( icon: (
<IconWrapper> <IconWrapper>
<SettingsIcon /> <SettingsIcon />
@@ -68,7 +69,6 @@ export const ContainerTabs = () => {
_defaultTabsKeys as unknown as string[], _defaultTabsKeys as unknown as string[],
'settings' 'settings'
); );
const { t } = useTranslation();
return ( return (
<> <>
<StyledTabsTitlesContainer> <StyledTabsTitlesContainer>
@@ -76,7 +76,7 @@ export const ContainerTabs = () => {
const { type, text, icon } = tab; const { type, text, icon } = tab;
return ( return (
<TabItemTitle <TabItemTitle
title={t(`stetting.${text}.title`)} title={text}
icon={icon} icon={icon}
isActive={activeTab === type} isActive={activeTab === type}
onClick={() => { onClick={() => {

View File

@@ -12,8 +12,8 @@ import { useSettings } from './use-settings';
export const SettingsList = () => { export const SettingsList = () => {
const settings = useSettings(); const settings = useSettings();
const { t, i18n } = useTranslation(); const { i18n } = useTranslation();
const changeLanguage = (event: any) => { const changeLanguage = event => {
i18n.changeLanguage(event); i18n.changeLanguage(event);
}; };
@@ -45,7 +45,7 @@ export const SettingsList = () => {
return ( return (
<ListItem key={item.name} onClick={() => item.onClick()}> <ListItem key={item.name} onClick={() => item.onClick()}>
{t(`stetting.Settings.${item.name}`)} {item.name}
{item.name === 'Language' ? ( {item.name === 'Language' ? (
<div style={{ marginLeft: '12em' }}> <div style={{ marginLeft: '12em' }}>
<Select <Select

View File

@@ -1,9 +1,10 @@
import { message } from '@toeverything/components/ui'; import { message } from '@toeverything/components/ui';
import { copyToClipboard } from '@toeverything/utils'; import { copyToClipboard } from '@toeverything/utils';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { useSettingFlags, type SettingFlags } from './use-setting-flags'; import { useSettingFlags, type SettingFlags } from './use-setting-flags';
import { import {
// useReadingMode,
clearWorkspace, clearWorkspace,
duplicatePage, duplicatePage,
exportHtml, exportHtml,
@@ -64,6 +65,7 @@ export const useSettings = (): SettingItem[] => {
const { workspaceId, pageId } = useWorkspaceAndPageId(); const { workspaceId, pageId } = useWorkspaceAndPageId();
const navigate = useNavigate(); const navigate = useNavigate();
const settingFlags = useSettingFlags(); const settingFlags = useSettingFlags();
const { t } = useTranslation();
// const { toggleReadingMode, readingMode } = useReadingMode(); // const { toggleReadingMode, readingMode } = useReadingMode();
const settings: SettingItem[] = [ const settings: SettingItem[] = [
@@ -80,7 +82,7 @@ export const useSettings = (): SettingItem[] => {
// }, // },
{ {
type: 'button', type: 'button',
name: 'Duplicate Page', name: t('Setting.Settings.Duplicate Page'),
onClick: async () => { onClick: async () => {
const newPageInfo = await duplicatePage({ const newPageInfo = await duplicatePage({
workspaceId, workspaceId,
@@ -91,7 +93,7 @@ export const useSettings = (): SettingItem[] => {
}, },
{ {
type: 'button', type: 'button',
name: 'Copy Page Link', name: t('Setting.Settings.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');
@@ -99,9 +101,9 @@ export const useSettings = (): SettingItem[] => {
}, },
{ {
type: 'button', type: 'button',
name: 'Language', name: t('Setting.Settings.Language'),
onClick: () => { onClick: () => {
console.log('Language is change'); //Do noting
}, },
}, },
{ {
@@ -148,7 +150,7 @@ export const useSettings = (): SettingItem[] => {
}, },
{ {
type: 'button', type: 'button',
name: 'Clear Workspace', name: t('Setting.Settings.Clear Workspace'),
onClick: () => clearWorkspace(workspaceId), onClick: () => clearWorkspace(workspaceId),
flag: 'booleanClearWorkspace', flag: 'booleanClearWorkspace',
}, },