Skip to content

Commit f8edb7c

Browse files
vivekdomadiyaVivek Domadiya
andauthored
fix: apply translation to unit and description fields (#4086)
Co-authored-by: Vivek Domadiya <Vivek.Domadiya@ibm.com>
1 parent 60e973a commit f8edb7c

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

packages/react/src/components/CardEditor/CardEditForm/CardEditFormItems/DataSeriesFormItemModal.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ const DataSeriesFormItemModal = ({
488488
unit: evt.target.value,
489489
})
490490
}
491-
value={editDataItem.unit}
491+
value={getTranslatedLabel(editDataItem.unit, shouldUseTranslatedLabels, i18n)}
492492
/>
493493
</div>
494494
)}

packages/react/src/components/CardEditor/CardEditForm/CommonCardEditFormFields.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ const CommonCardEditFormFields = ({
185185
labelText={mergedI18n.description}
186186
light
187187
onChange={(evt) => onChange({ ...cardConfig, description: evt.target.value })}
188-
value={description}
188+
value={getTranslatedLabel(description, shouldUseTranslatedLabels, mergedI18n)}
189189
/>
190190
</div>
191191
<div className={`${baseClassName}--input`}>

packages/react/src/components/ValueCard/Attribute.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ const Attribute = ({
125125

126126
// Get translated label if shouldUseTranslatedLabels is true
127127
const displayLabel = getTranslatedLabel(label, shouldUseTranslatedLabels, i18n);
128+
const displayUnitLabel = getTranslatedLabel(unit, shouldUseTranslatedLabels, i18n);
128129

129130
// Render threshold icon component
130131
const renderThresholdIcon = () => {
@@ -192,7 +193,7 @@ const Attribute = ({
192193
/>
193194
<div className={`${BEM_BASE}-unit-with-icon`}>
194195
{thresholdsIconPosition === 'unit' && renderThresholdIcon()}
195-
<UnitRenderer unit={measurementUnitLabel || unit} testId={`${testId}-unit`} />
196+
<UnitRenderer unit={measurementUnitLabel || displayUnitLabel} testId={`${testId}-unit`} />
196197
</div>
197198
</div>
198199
{!isNil(secondaryValue) ? (

0 commit comments

Comments
 (0)