From d05a13d7fccd01be90e035be6ed397a020d01a44 Mon Sep 17 00:00:00 2001 From: ZhenYi <434836402@qq.com> Date: Mon, 27 Apr 2026 18:19:37 +0800 Subject: [PATCH] feat(i18n): integrate LanguageSwitcher into landing nav and theme panel --- src/app/i18n-demo/page.tsx | 63 ++++++++++++++++++++++++++ src/components/landing/landing-nav.tsx | 2 + src/components/room/ThemeSwitcher.tsx | 4 ++ 3 files changed, 69 insertions(+) create mode 100644 src/app/i18n-demo/page.tsx diff --git a/src/app/i18n-demo/page.tsx b/src/app/i18n-demo/page.tsx new file mode 100644 index 0000000..1558b4b --- /dev/null +++ b/src/app/i18n-demo/page.tsx @@ -0,0 +1,63 @@ +import {useTranslation} from 'react-i18next'; +import {LanguageSwitcher} from '@/components/shared/LanguageSwitcher'; + +export default function I18nDemo() { + const {t} = useTranslation(); + + return ( +
+
+

i18n Demo

+ +
+ + {/* Basic usage */} +
+

Basic Translation

+
+

{t('shared.loading')}

+

{t('shared.error')}

+

{t('shared.success')}

+
+
+ + {/* Interpolation */} +
+

Interpolation

+
+

{t('project.issueDetail.openedBy', {user: 'Alice'})}

+

{t('notification.unreadTotal', {unread: 5, total: 23})}

+

{t('repository.list.showing', {start: 1, end: 10, total: 100})}

+
+
+ + {/* Pluralization */} +
+

Plural (count: 0)

+
+

{t('workspace.members.totalMembers', {count: 0})}

+

{t('workspace.members.totalMembers', {count: 1})}

+

{t('workspace.members.totalMembers', {count: 5})}

+
+
+ + {/* Nested keys */} +
+

Nested Keys

+
+

{t('landing.hero.heading')}

+

{t('auth.login.heading')}

+

{t('project.issues.new')}

+
+
+ + {/* Arrays */} +
+

Array Values

+
+

{t('landing.features.sectionTitle')}

+
+
+
+ ); +} diff --git a/src/components/landing/landing-nav.tsx b/src/components/landing/landing-nav.tsx index 17bcf48..3200188 100644 --- a/src/components/landing/landing-nav.tsx +++ b/src/components/landing/landing-nav.tsx @@ -1,5 +1,6 @@ import {useEffect, useRef, useState} from 'react'; import {useNavigate} from 'react-router-dom'; +import {LanguageSwitcher} from '@/components/shared/LanguageSwitcher'; const POP_ITEMS = { Platform: [ @@ -94,6 +95,7 @@ export function LandingNav() { {/* Actions */}
+