"use client"; import Image from "next/image"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { useLocale } from "next-intl"; import { useTransition } from "react"; import { LOCALES } from "@/config/i18n"; import { Locale } from "@/generated/client"; import { setUserLocale } from "@/i18n/locale"; const getIconForLocale = (locale: Locale) => { switch (locale) { case Locale.en: return ( English ); case Locale.zh: return ( 中文 ); } }; const getLabelForLocale = (locale: Locale) => { switch (locale) { case Locale.en: return "English"; case Locale.zh: return "中文"; } }; export const LocaleSwitcher = () => { const locale = useLocale(); const [isPending, startTransition] = useTransition(); const handleValueChange = (value: Locale) => { const locale = value as Locale; startTransition(() => { setUserLocale(locale); }); }; return ( ); };