-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathLanguageTab.tsx
More file actions
36 lines (32 loc) · 1.22 KB
/
LanguageTab.tsx
File metadata and controls
36 lines (32 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { Component } from "solid-js"
import { Select } from "@kilocode/kilo-ui/select"
import { useLanguage, LOCALES, LOCALE_LABELS, type Locale } from "../../context/language"
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={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 === AUTO ? "" : (opt as Locale))
}
}}
variant="secondary"
size="large"
/>
<p style={{ "font-size": "12px", color: "var(--vscode-descriptionForeground)", "margin-top": "8px" }}>
{language.t("settings.language.current")} {LOCALE_LABELS[language.locale()]}
</p>
</div>
)
}
export default LanguageTab