This repository has been archived on 2026-02-28. You can view files and clone it, but cannot push or open issues or pull requests.
site-2025/src/components/ui/language-selector.tsx
2025-02-09 03:07:23 +01:00

19 lines
569 B
TypeScript

'use client'
import { Lang } from "@/i18n/locales";
import Link from "next/link";
import { useParams } from "next/navigation";
export const LanguageSelector = () => {
const params = useParams<{ locale: Lang }>();
const lang = params?.locale || 'pl';
const hash = globalThis?.window?.location?.hash || '';
if (lang === 'pl') return (<>
<Link suppressHydrationWarning className="pt-1" href={`/en${hash}`}>🇬🇧</Link></>);
if (lang === 'en') return (<>
<Link suppressHydrationWarning className="pt-1" href={`/pl${hash}`}>🇵🇱</Link></>);
};