@@ -4,6 +4,7 @@ import { validationErrorComponent } from '../../components/validation-error-comp
44import { valueEditorContainerComponent } from '../../components/value-editor-container-component' ;
55import { rowComponent } from '../../components/row-component' ;
66import { selectComponent } from '../../components/select-component' ;
7+ import { createStepI18nPrefix } from '../../core/step-i18n-prefix' ;
78
89export const choiceValueEditorId = 'choice' ;
910
@@ -13,16 +14,27 @@ export function choiceValueEditor(context: ValueContext<ChoiceValueModel>): Valu
1314 }
1415
1516 function onSelected ( index : number ) {
16- const value = context . model . configuration . choices [ index ] ;
17+ const value = choices [ index ] ;
1718 context . setValue ( value ) ;
1819 validate ( ) ;
1920 }
2021
2122 const select = selectComponent ( {
2223 stretched : true
2324 } ) ;
24- select . setValues ( context . model . configuration . choices ) ;
25- const startIndex = context . model . configuration . choices . indexOf ( context . getValue ( ) ) ;
25+
26+ const stepType = context . tryGetStepType ( ) ;
27+ const i18nPrefix = createStepI18nPrefix ( stepType ) ;
28+
29+ const choices = context . model . configuration . choices ;
30+ const translatedChoices = choices . map ( choice => {
31+ const pathStr = context . model . path . toString ( ) ;
32+ const key = `${ i18nPrefix } ${ pathStr } :choice:${ choice } ` ;
33+ return context . i18n ( key , choice ) ;
34+ } ) ;
35+
36+ select . setValues ( translatedChoices ) ;
37+ const startIndex = choices . indexOf ( context . getValue ( ) ) ;
2638 select . selectIndex ( startIndex ) ;
2739 select . onSelected . subscribe ( onSelected ) ;
2840
0 commit comments