From bb1aebc1d193c3340821582c97ee3fadaaee735e Mon Sep 17 00:00:00 2001 From: yozuru Date: Sun, 20 Apr 2025 06:00:07 +0800 Subject: [PATCH] feat: internationalize the rest --- src/components/about.astro | 4 +- src/components/buttons/play/play.tsx | 4 +- src/components/buttons/unselect/unselect.tsx | 8 +- src/components/categories/donate/donate.tsx | 10 +- src/components/donate.astro | 8 +- src/components/footer.astro | 33 ++- src/components/hero.astro | 16 +- src/components/modal/modal.tsx | 9 +- src/components/reload/reload-modal.tsx | 12 +- src/components/shuffle/shuffle.tsx | 7 +- .../sounds/sound/favorite/favorite.tsx | 4 +- src/components/source.astro | 11 +- src/components/toolbar/menu/menu.tsx | 2 +- .../toolbar/scroll-to-top/scroll-to-top.tsx | 4 +- src/layouts/layout.astro | 2 +- src/locales/en/translation.json | 124 ++++---- src/locales/zh/translation.json | 274 ++++++++++-------- 17 files changed, 302 insertions(+), 230 deletions(-) diff --git a/src/components/about.astro b/src/components/about.astro index c7a309e..2c4e2bc 100644 --- a/src/components/about.astro +++ b/src/components/about.astro @@ -32,9 +32,7 @@ const paragraphKeys = [ )) } - + diff --git a/src/components/buttons/play/play.tsx b/src/components/buttons/play/play.tsx index 21b686f..ce7c15b 100644 --- a/src/components/buttons/play/play.tsx +++ b/src/components/buttons/play/play.tsx @@ -44,14 +44,14 @@ export function PlayButton() { {' '} - {t('buttons.pause.label')} + {t('common.pause')} ) : ( <> {' '} - {t('buttons.play.label')} + {t('common.play')} )} diff --git a/src/components/buttons/unselect/unselect.tsx b/src/components/buttons/unselect/unselect.tsx index 7682138..eac4840 100644 --- a/src/components/buttons/unselect/unselect.tsx +++ b/src/components/buttons/unselect/unselect.tsx @@ -47,16 +47,16 @@ export function UnselectButton() { showDelay={0} content={ hasHistory - ? t('buttons.unselect.restore.tooltip') - : t('buttons.unselect.tooltip') + ? t('unselect.restore.tooltip') + : t('unselect.tooltip') } > {children} diff --git a/src/components/reload/reload-modal.tsx b/src/components/reload/reload-modal.tsx index ee3d366..8f8c241 100644 --- a/src/components/reload/reload-modal.tsx +++ b/src/components/reload/reload-modal.tsx @@ -1,10 +1,12 @@ import { useRegisterSW } from 'virtual:pwa-register/react'; // eslint-disable-line +import { useTranslation } from 'react-i18next'; import { Modal } from '@/components/modal'; import styles from './reload.module.css'; export function ReloadModal() { + const { t } = useTranslation(); const { needRefresh: [needRefresh, setNeedRefresh], updateServiceWorker, @@ -16,19 +18,17 @@ export function ReloadModal() { return ( -

New Content

-

- New content available, click on reload button to update. -

+

{t('modals.reload.title')}

+

{t('modals.reload.description')}

- +
diff --git a/src/components/shuffle/shuffle.tsx b/src/components/shuffle/shuffle.tsx index db5b551..85f99ff 100644 --- a/src/components/shuffle/shuffle.tsx +++ b/src/components/shuffle/shuffle.tsx @@ -1,4 +1,5 @@ import { BiShuffle } from 'react-icons/bi/index'; +import { useTranslation } from 'react-i18next'; import { Tooltip } from '@/components/tooltip'; import { useSoundStore } from '@/stores/sound'; @@ -6,12 +7,14 @@ import { useSoundStore } from '@/stores/sound'; import styles from './shuffle.module.css'; export function Shuffle() { + const { t } = useTranslation(); const shuffle = useSoundStore(state => state.shuffle); + const shuffleLabel = t('toolbar.items.shuffle'); // Get translated label return ( - +