"use client"; import { useRouter, usePathname } from "next/navigation"; import { useLocale } from "next-intl"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { Globe } from "lucide-react"; const languages = [ { code: "ko", label: "ν•œκ΅­μ–΄", flag: "πŸ‡°πŸ‡·" }, { code: "en", label: "English", flag: "πŸ‡ΊπŸ‡Έ" }, { code: "ja", label: "ζ—₯本θͺž", flag: "πŸ‡―πŸ‡΅" }, ]; export function LanguageSelect() { const router = useRouter(); const pathname = usePathname(); const locale = useLocale(); const handleLanguageChange = (newLocale: string) => { // Remove current locale from pathname const pathnameWithoutLocale = pathname.replace(`/${locale}`, ""); // Navigate to new locale router.push(`/${newLocale}${pathnameWithoutLocale}`); }; const currentLanguage = languages.find((lang) => lang.code === locale); return ( ); }