Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@ import { Component } from "solid-js"
import { Select } from "@kilocode/kilo-ui/select"
import { useLanguage, LOCALES, LOCALE_LABELS, type Locale } from "../../context/language"

const options = ["", ...LOCALES] as const
type Option = "" | Locale
const AUTO = "auto"
const options = [AUTO, ...LOCALES] as const
type Option = typeof AUTO | Locale

const LanguageTab: Component = () => {
const language = useLanguage()
const current = () => language.userOverride() || AUTO

return (
<div style={{ padding: "16px" }}>
<p style={{ "font-size": "13px", "margin-bottom": "12px" }}>{language.t("settings.language.description")}</p>
<Select
options={[...options]}
current={language.userOverride()}
label={(opt: Option) => (opt === "" ? language.t("settings.language.auto") : LOCALE_LABELS[opt])}
current={current()}
label={(opt: Option) => (opt === AUTO ? language.t("settings.language.auto") : LOCALE_LABELS[opt])}
value={(opt: Option) => opt}
onSelect={(opt) => {
if (opt !== undefined) {
language.setLocale(opt as Locale | "")
language.setLocale(opt === AUTO ? "" : (opt as Locale))
}
}}
variant="secondary"
Expand Down
Loading