Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

update i18n

JimmFlye6569410844e
diff --git a/libs/components/layout/src/header/EditorBoardSwitcher/Switcher.tsx b/libs/components/layout/src/header/EditorBoardSwitcher/Switcher.tsx
index d1b5cc2acc..636dfdc905 100644
--- a/libs/components/layout/src/header/EditorBoardSwitcher/Switcher.tsx
+++ b/libs/components/layout/src/header/EditorBoardSwitcher/Switcher.tsx
@@ -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>
);
diff --git a/libs/components/layout/src/i18n/index.ts b/libs/components/layout/src/i18n/index.ts
index dae0c24f3c..efb3848125 100644
--- a/libs/components/layout/src/i18n/index.ts
+++ b/libs/components/layout/src/i18n/index.ts
@@ -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({
diff --git a/libs/components/layout/src/i18n/resources/en.json b/libs/components/layout/src/i18n/resources/en.json
index 8706296bba..ef13d02e86 100644
--- a/libs/components/layout/src/i18n/resources/en.json
+++ b/libs/components/layout/src/i18n/resources/en.json
@@ -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"
}
}
}
diff --git a/libs/components/layout/src/i18n/resources/zh.json b/libs/components/layout/src/i18n/resources/zh.json
index 90847e4610..51a0cfcd00 100644
--- a/libs/components/layout/src/i18n/resources/zh.json
+++ b/libs/components/layout/src/i18n/resources/zh.json
@@ -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": "退出登录"
}
}
}
diff --git a/libs/components/layout/src/settings-sidebar/ContainerTabs/ContainerTabs.tsx b/libs/components/layout/src/settings-sidebar/ContainerTabs/ContainerTabs.tsx
index 9019063f30..9e29edaa2d 100644
--- a/libs/components/layout/src/settings-sidebar/ContainerTabs/ContainerTabs.tsx
+++ b/libs/components/layout/src/settings-sidebar/ContainerTabs/ContainerTabs.tsx
@@ -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={() => {
diff --git a/libs/components/layout/src/settings-sidebar/Settings/SettingsList.tsx b/libs/components/layout/src/settings-sidebar/Settings/SettingsList.tsx
index a0d93aae23..47384cf99f 100644
--- a/libs/components/layout/src/settings-sidebar/Settings/SettingsList.tsx
+++ b/libs/components/layout/src/settings-sidebar/Settings/SettingsList.tsx
@@ -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
diff --git a/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts b/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts
index fdd1a1fb53..eb7d2d1454 100644
--- a/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts
+++ b/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts
@@ -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',
},