feat(i18n): integrate LanguageSwitcher into landing nav and theme panel
This commit is contained in:
parent
77e0923f28
commit
d05a13d7fc
63
src/app/i18n-demo/page.tsx
Normal file
63
src/app/i18n-demo/page.tsx
Normal file
@ -0,0 +1,63 @@
|
||||
import {useTranslation} from 'react-i18next';
|
||||
import {LanguageSwitcher} from '@/components/shared/LanguageSwitcher';
|
||||
|
||||
export default function I18nDemo() {
|
||||
const {t} = useTranslation();
|
||||
|
||||
return (
|
||||
<div className="container mx-auto py-10 space-y-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-3xl font-bold">i18n Demo</h1>
|
||||
<LanguageSwitcher />
|
||||
</div>
|
||||
|
||||
{/* Basic usage */}
|
||||
<section className="space-y-2">
|
||||
<h2 className="text-xl font-semibold">Basic Translation</h2>
|
||||
<div className="rounded-lg border p-4 space-y-2">
|
||||
<p>{t('shared.loading')}</p>
|
||||
<p>{t('shared.error')}</p>
|
||||
<p>{t('shared.success')}</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Interpolation */}
|
||||
<section className="space-y-2">
|
||||
<h2 className="text-xl font-semibold">Interpolation</h2>
|
||||
<div className="rounded-lg border p-4 space-y-2">
|
||||
<p>{t('project.issueDetail.openedBy', {user: 'Alice'})}</p>
|
||||
<p>{t('notification.unreadTotal', {unread: 5, total: 23})}</p>
|
||||
<p>{t('repository.list.showing', {start: 1, end: 10, total: 100})}</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Pluralization */}
|
||||
<section className="space-y-2">
|
||||
<h2 className="text-xl font-semibold">Plural (count: 0)</h2>
|
||||
<div className="rounded-lg border p-4 space-y-2">
|
||||
<p>{t('workspace.members.totalMembers', {count: 0})}</p>
|
||||
<p>{t('workspace.members.totalMembers', {count: 1})}</p>
|
||||
<p>{t('workspace.members.totalMembers', {count: 5})}</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Nested keys */}
|
||||
<section className="space-y-2">
|
||||
<h2 className="text-xl font-semibold">Nested Keys</h2>
|
||||
<div className="rounded-lg border p-4 space-y-2">
|
||||
<p>{t('landing.hero.heading')}</p>
|
||||
<p>{t('auth.login.heading')}</p>
|
||||
<p>{t('project.issues.new')}</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Arrays */}
|
||||
<section className="space-y-2">
|
||||
<h2 className="text-xl font-semibold">Array Values</h2>
|
||||
<div className="rounded-lg border p-4 space-y-2">
|
||||
<p>{t('landing.features.sectionTitle')}</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -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 */}
|
||||
<div className="flex items-center gap-2">
|
||||
<LanguageSwitcher />
|
||||
<button onClick={() => navigate('/auth/login')}
|
||||
className="h-8 px-4 text-xs font-medium text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 transition-colors rounded-full">
|
||||
Sign in
|
||||
|
||||
@ -25,6 +25,7 @@ import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sh
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useTheme } from '@/contexts';
|
||||
import { Check, RotateCcw, Sliders } from 'lucide-react';
|
||||
import {LanguageSwitcher} from '@/components/shared/LanguageSwitcher';
|
||||
|
||||
// ─── Token definitions ───────────────────────────────────────────────────────
|
||||
|
||||
@ -304,6 +305,9 @@ export function ThemeSwitcher({ open, onOpenChange }: ThemeSwitcherProps) {
|
||||
<Sliders className="h-4 w-4" />
|
||||
Theme Settings
|
||||
</SheetTitle>
|
||||
<div className="flex items-center gap-2 pt-1">
|
||||
<LanguageSwitcher />
|
||||
</div>
|
||||
</SheetHeader>
|
||||
|
||||
{/* ── Scrollable content with padding ─────────────────────────────── */}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user