From 0b61f4a2a04a83d3dd3616aaf87d649330ae51ba Mon Sep 17 00:00:00 2001 From: JimmFly Date: Wed, 4 Jan 2023 17:10:47 +0800 Subject: [PATCH] feat: add translation --- packages/app/src/components/404/index.tsx | 5 +-- .../src/components/contact-modal/index.tsx | 35 +++++++++--------- .../components/editor-mode-switch/index.tsx | 8 ++--- .../header-right-items/editor-option-menu.tsx | 30 +++++++++------- .../components/header/quick-search-button.tsx | 6 ++-- .../app/src/components/help-island/index.tsx | 7 ++-- packages/app/src/components/import/index.tsx | 4 ++- .../components/page-list/operation-cell.tsx | 36 ++++++++++--------- .../src/components/quick-search/footer.tsx | 7 ++-- .../src/components/quick-search/results.tsx | 10 ++++-- .../src/components/shortcuts-modal/index.tsx | 16 +++++---- .../components/workspace-slider-bar/index.tsx | 22 ++++++------ .../src/pages/workspace/[workspaceId]/all.tsx | 6 ++-- .../workspace/[workspaceId]/favorite.tsx | 7 ++-- .../pages/workspace/[workspaceId]/trash.tsx | 5 +-- packages/app/src/ui/confirm/Confirm.tsx | 4 ++- 16 files changed, 118 insertions(+), 90 deletions(-) diff --git a/packages/app/src/components/404/index.tsx b/packages/app/src/components/404/index.tsx index e2f828ad9..7df644bbf 100644 --- a/packages/app/src/components/404/index.tsx +++ b/packages/app/src/components/404/index.tsx @@ -1,9 +1,10 @@ import { NotFoundTitle, PageContainer } from './styles'; - +import { useTranslation } from 'react-i18next'; export const NotfoundPage = () => { + const { t } = useTranslation(); return ( - 404 - Page Not Found + {t('404 - Page Not Found')} ); }; diff --git a/packages/app/src/components/contact-modal/index.tsx b/packages/app/src/components/contact-modal/index.tsx index a182f3e04..50c1e1b53 100644 --- a/packages/app/src/components/contact-modal/index.tsx +++ b/packages/app/src/components/contact-modal/index.tsx @@ -23,7 +23,7 @@ import { StyledModalFooter, } from './style'; import bg from '@/components/contact-modal/bg.png'; - +import { useTranslation } from 'react-i18next'; const linkList = [ { icon: , @@ -51,20 +51,6 @@ const linkList = [ link: 'https://discord.gg/Arn7TqJBvG', }, ]; -const rightLinkList = [ - { - icon: , - title: 'Official Website ', - subTitle: 'AFFiNE.pro', - link: 'https://affine.pro', - }, - { - icon: , - title: 'AFFiNE Community', - subTitle: 'community.affine.pro', - link: 'https://community.affine.pro', - }, -]; type TransitionsModalProps = { open: boolean; @@ -72,6 +58,21 @@ type TransitionsModalProps = { }; export const ContactModal = ({ open, onClose }: TransitionsModalProps) => { + const { t } = useTranslation(); + const rightLinkList = [ + { + icon: , + title: t('Official Website'), + subTitle: 'AFFiNE.pro', + link: 'https://affine.pro', + }, + { + icon: , + title: t('AFFiNE Community'), + subTitle: 'community.affine.pro', + link: 'https://community.affine.pro', + }, + ]; return ( { })} - Get in touch! + {t('Get in touch!')} {linkList.map(({ icon, title, link }) => { return ( @@ -128,7 +129,7 @@ export const ContactModal = ({ open, onClose }: TransitionsModalProps) => { target="_blank" rel="noreferrer" > - How is AFFiNE Alpha different? + {t('How is AFFiNE Alpha different?')}

Copyright © 2022 Toeverything

diff --git a/packages/app/src/components/editor-mode-switch/index.tsx b/packages/app/src/components/editor-mode-switch/index.tsx index 8a219e475..86a54d860 100644 --- a/packages/app/src/components/editor-mode-switch/index.tsx +++ b/packages/app/src/components/editor-mode-switch/index.tsx @@ -15,7 +15,7 @@ import { useTheme } from '@/providers/themeProvider'; import { EdgelessIcon, PaperIcon } from './icons'; import useCurrentPageMeta from '@/hooks/use-current-page-meta'; import { usePageHelper } from '@/hooks/use-page-helper'; - +import { useTranslation } from 'react-i18next'; const PaperItem = ({ active }: { active?: boolean }) => { const { theme: { @@ -96,7 +96,7 @@ export const EditorModeSwitch = ({ setRadioItemStatus(modifyRadioItemStatus()); // eslint-disable-next-line react-hooks/exhaustive-deps }, [isHover, mode]); - + const { t } = useTranslation(); return ( } active={mode === 'page'} status={radioItemStatus.left} @@ -126,7 +126,7 @@ export const EditorModeSwitch = ({