From 5f61c54efdf85dee90dd7ca918af22ab384bafbd Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Wed, 25 Mar 2026 10:24:48 -0500 Subject: [PATCH] add optional i18n prefix for select widgets --- .../config-form/theme/widgets/SelectWidget.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/web/src/components/config-form/theme/widgets/SelectWidget.tsx b/web/src/components/config-form/theme/widgets/SelectWidget.tsx index d5047e959..46c2d0701 100644 --- a/web/src/components/config-form/theme/widgets/SelectWidget.tsx +++ b/web/src/components/config-form/theme/widgets/SelectWidget.tsx @@ -1,5 +1,6 @@ // Select Widget - maps to shadcn/ui Select import type { WidgetProps } from "@rjsf/utils"; +import { useTranslation } from "react-i18next"; import { Select, SelectContent, @@ -21,9 +22,18 @@ export function SelectWidget(props: WidgetProps) { schema, } = props; + const { t } = useTranslation(["views/settings"]); const { enumOptions = [] } = options; + const enumI18nPrefix = options["enumI18nPrefix"] as string | undefined; const fieldClassName = getSizedFieldClassName(options, "sm"); + const getLabel = (option: { value: unknown; label: string }) => { + if (enumI18nPrefix) { + return t(`${enumI18nPrefix}.${option.value}`); + } + return option.label; + }; + return (