@@ -41,16 +41,14 @@ export default function RadioButtons(props) {
4141 configProperty = configProperty . startsWith ( '.' ) ? configProperty . substring ( 1 ) : configProperty ;
4242
4343 const metaData = Array . isArray ( fieldMetadata )
44- ? fieldMetadata . filter ( ( field ) => field ?. classID === className ) [ 0 ]
45- : fieldMetadata ;
46- let displayName = metaData ?. datasource ?. propertyForDisplayText ;
47- displayName = displayName ?. slice ( displayName . lastIndexOf ( '.' ) + 1 ) ;
48- const localeContext = metaData ?. datasource ?. tableType === 'DataPage' ? 'datapage' : 'associated' ;
49- const localeClass = localeContext === 'datapage' ? '@baseclass' : className ;
50- const localeName = localeContext === 'datapage' ? metaData ?. datasource ?. name : configProperty ;
51- const localePath = localeContext === 'datapage' ? displayName : localeName ;
52-
53-
44+ ? fieldMetadata . filter ( field => field ?. classID === className ) [ 0 ]
45+ : fieldMetadata ;
46+ let displayName = metaData ?. datasource ?. propertyForDisplayText ;
47+ displayName = displayName ?. slice ( displayName . lastIndexOf ( '.' ) + 1 ) ;
48+ const localeContext = metaData ?. datasource ?. tableType === 'DataPage' ? 'datapage' : 'associated' ;
49+ const localeClass = localeContext === 'datapage' ? '@baseclass' : className ;
50+ const localeName = localeContext === 'datapage' ? metaData ?. datasource ?. name : configProperty ;
51+ const localePath = localeContext === 'datapage' ? displayName : localeName ;
5452
5553 // theOptions will be an array of JSON objects that are literally key/value pairs.
5654 // Ex: [ {key: "Basic", value: "Basic"} ]
@@ -62,11 +60,30 @@ const localePath = localeContext === 'datapage' ? displayName : localeName;
6260 } , [ value ] ) ;
6361
6462 if ( displayMode === 'LABELS_LEFT' ) {
65- return < FieldValueList name = { hideLabel ? '' : label } value = { value } /> ;
63+ return (
64+ < FieldValueList
65+ name = { hideLabel ? '' : label }
66+ value = { thePConn . getLocalizedValue (
67+ value ,
68+ localePath ,
69+ thePConn . getLocaleRuleNameFromKeys ( localeClass , localeContext , localeName )
70+ ) }
71+ />
72+ ) ;
6673 }
6774
6875 if ( displayMode === 'STACKED_LARGE_VAL' ) {
69- return < FieldValueList name = { hideLabel ? '' : label } value = { value } variant = 'stacked' /> ;
76+ return (
77+ < FieldValueList
78+ name = { hideLabel ? '' : label }
79+ value = { thePConn . getLocalizedValue (
80+ value ,
81+ localePath ,
82+ thePConn . getLocaleRuleNameFromKeys ( localeClass , localeContext , localeName )
83+ ) }
84+ variant = 'stacked'
85+ />
86+ ) ;
7087 }
7188
7289 const handleChange = event => {
@@ -91,13 +108,11 @@ const localePath = localeContext === 'datapage' ? displayName : localeName;
91108 < FormControlLabel
92109 value = { theOption . key }
93110 key = { theOption . key }
94- label = {
95- thePConn . getLocalizedValue (
96- theOption . value ,
97- localePath ,
98- thePConn . getLocaleRuleNameFromKeys ( localeClass , localeContext , localeName )
99- )
100- }
111+ label = { thePConn . getLocalizedValue (
112+ theOption . value ,
113+ localePath ,
114+ thePConn . getLocaleRuleNameFromKeys ( localeClass , localeContext , localeName )
115+ ) }
101116 control = { < Radio key = { theOption . key } color = 'primary' disabled = { readOnly } /> }
102117 />
103118 ) ;
0 commit comments