mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-17 04:34:21 +00:00
* Strongly type our settings use composition where possible * Update src/core/contextProxy.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * Update src/core/contextProxy.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * Add comment, tweak function name * Add changeset * Clean up toolGroup types * Comments tweak * Remove unused type * More type safety * Improve import / export, add translations --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
import { HTMLAttributes } from "react"
|
|
import { useAppTranslation } from "@/i18n/TranslationContext"
|
|
import { Globe } from "lucide-react"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui"
|
|
import { Language, LANGUAGES } from "../../../../src/shared/language"
|
|
|
|
import { SetCachedStateField } from "./types"
|
|
import { SectionHeader } from "./SectionHeader"
|
|
import { Section } from "./Section"
|
|
|
|
type LanguageSettingsProps = HTMLAttributes<HTMLDivElement> & {
|
|
language: string
|
|
setCachedStateField: SetCachedStateField<"language">
|
|
}
|
|
|
|
export const LanguageSettings = ({ language, setCachedStateField, className, ...props }: LanguageSettingsProps) => {
|
|
const { t } = useAppTranslation()
|
|
|
|
return (
|
|
<div className={cn("flex flex-col gap-2", className)} {...props}>
|
|
<SectionHeader>
|
|
<div className="flex items-center gap-2">
|
|
<Globe className="w-4" />
|
|
<div>{t("settings:sections.language")}</div>
|
|
</div>
|
|
</SectionHeader>
|
|
|
|
<Section>
|
|
<Select value={language} onValueChange={(value) => setCachedStateField("language", value as Language)}>
|
|
<SelectTrigger className="w-full">
|
|
<SelectValue placeholder={t("settings:common.select")} />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
<SelectGroup>
|
|
{Object.entries(LANGUAGES).map(([code, name]) => (
|
|
<SelectItem key={code} value={code}>
|
|
{name}
|
|
<span className="text-muted-foreground">({code})</span>
|
|
</SelectItem>
|
|
))}
|
|
</SelectGroup>
|
|
</SelectContent>
|
|
</Select>
|
|
</Section>
|
|
</div>
|
|
)
|
|
}
|