diff --git a/js/apps/admin-ui/src/user/components/SelectComponent.tsx b/js/apps/admin-ui/src/user/components/SelectComponent.tsx index 2f80c8e9e4..0e88f54530 100644 --- a/js/apps/admin-ui/src/user/components/SelectComponent.tsx +++ b/js/apps/admin-ui/src/user/components/SelectComponent.tsx @@ -9,9 +9,10 @@ import { import { useTranslation } from "react-i18next"; import { Options } from "../UserProfileFields"; -import { fieldName } from "../utils"; +import { fieldName, unWrap } from "../utils"; import { UserProfileFieldsProps, UserProfileGroup } from "./UserProfileGroup"; +type OptionLabel = Record | undefined; export const SelectComponent = (attribute: UserProfileFieldsProps) => { const { t } = useTranslation("users"); const { control } = useFormContext(); @@ -42,6 +43,12 @@ export const SelectComponent = (attribute: UserProfileFieldsProps) => { const options = (attribute.validations?.options as Options | undefined)?.options || []; + const optionLabel = attribute.annotations?.[ + "inputOptionLabels" + ] as OptionLabel; + const label = (label: string) => + optionLabel ? t(unWrap(optionLabel[label])) : label; + return ( { key={option} value={option} > - {option} + {label(option)} ))}