@@ -10,10 +10,11 @@ export function presetField(fieldID, field, allFields) {
10
10
allFields = allFields || { } ;
11
11
let _this = Object . assign ( { } , field ) ; // shallow copy
12
12
13
- // This handles fieldIDs that contain ':', like 'source:1'
14
- let localizerFieldID = fieldID . includes ( ':' ) ? fieldID . split ( ':' ) [ 0 ] + '_multiple' : fieldID ;
15
- // This is what comes after the ':' in the fieldID.
16
- let localizerOption = fieldID . includes ( ':' ) ? fieldID . split ( ':' ) [ 1 ] : 0 ;
13
+ // This handles fields that are composed of a base key and an index, like 'source:1'
14
+ let localizerFieldID = fieldID ;
15
+ if ( field . baseKey && field . index ) {
16
+ localizerFieldID = field . baseKey + '_multiple' ;
17
+ }
17
18
18
19
_this . id = fieldID ;
19
20
@@ -48,10 +49,10 @@ export function presetField(fieldID, field, allFields) {
48
49
return _this ;
49
50
} ;
50
51
51
- _this . title = ( ) => _this . overrideLabel || _this . resolveReference ( 'label' ) . t ( 'label' , { 'default' : fieldID , 'localizerOption ' : localizerOption } ) ;
52
+ _this . title = ( ) => _this . overrideLabel || _this . resolveReference ( 'label' ) . t ( 'label' , { 'default' : fieldID , 'index ' : field . index } ) ;
52
53
_this . label = ( ) => _this . overrideLabel ?
53
54
selection => selection . text ( _this . overrideLabel ) :
54
- _this . resolveReference ( 'label' ) . t . append ( 'label' , { 'default' : fieldID , 'localizerOption ' : localizerOption } ) ;
55
+ _this . resolveReference ( 'label' ) . t . append ( 'label' , { 'default' : fieldID , 'index ' : field . index } ) ;
55
56
56
57
_this . placeholder = ( ) => _this . resolveReference ( 'placeholder' ) . t ( 'placeholder' , { 'default' : '' } ) ;
57
58
0 commit comments