mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-09-27 18:15:49 +08:00
53 lines
948 B
TypeScript
53 lines
948 B
TypeScript
import { useSettingStore } from "@/store";
|
|
import { Locale } from "@/types";
|
|
import Select from "./kit/Select";
|
|
|
|
interface LocaleItem {
|
|
value: Locale;
|
|
label: string;
|
|
}
|
|
|
|
const localeItemList: LocaleItem[] = [
|
|
{
|
|
value: "en",
|
|
label: "English",
|
|
},
|
|
{
|
|
value: "zh",
|
|
label: "简体中文",
|
|
},
|
|
{
|
|
value: "zhHant",
|
|
label: "繁體中文",
|
|
},
|
|
{
|
|
value: "es",
|
|
label: "Español",
|
|
},
|
|
{
|
|
value: "jp",
|
|
label: "日本語",
|
|
},
|
|
{
|
|
value: "de",
|
|
label: "Deutsch",
|
|
},
|
|
{
|
|
value: "th",
|
|
label: "ยาสุฟุมิ",
|
|
},
|
|
];
|
|
|
|
const LocaleSelector = () => {
|
|
const settingStore = useSettingStore();
|
|
const locale = settingStore.setting.locale;
|
|
|
|
const handleLocaleChange = (locale: Locale) => {
|
|
settingStore.setLocale(locale);
|
|
};
|
|
|
|
return <Select className="w-28" value={locale} itemList={localeItemList} onValueChange={handleLocaleChange} />;
|
|
};
|
|
|
|
export default LocaleSelector;
|