import { useTranslation } from "react-i18next"; import { FlagIcon } from "@/components/FlagIcon"; import { Dropdown } from "@/components/form/Dropdown"; import { Heading1 } from "@/components/utils/Text"; import { appLanguageOptions } from "@/setup/i18n"; import { sortLangCodes } from "@/utils/sortLangCodes"; export function LocalePart(props: { language: string; setLanguage: (l: string) => void; }) { const { t } = useTranslation(); const sorted = sortLangCodes(appLanguageOptions.map((item) => item.code)); const options = appLanguageOptions .sort((a, b) => sorted.indexOf(a.code) - sorted.indexOf(b.code)) .map((opt) => ({ id: opt.code, name: `${opt.name} — ${opt.nativeName}`, leftIcon: , })); const selected = options.find((item) => item.id === props.language); return (
{t("settings.locale.title")}

{t("settings.locale.language")}

{t("settings.locale.languageDescription")}

props.setLanguage(opt.id)} />
); }