Skip to content

Commit

Permalink
Fix dynamic uses of i18n (opensearch-project#678)
Browse files Browse the repository at this point in the history
Signed-off-by: Miki <[email protected]>
  • Loading branch information
AMoo-Miki authored Oct 2, 2024
1 parent c043733 commit 7d1b002
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Enhancements
### Bug Fixes
* fix: prevent overlay from overlapping new application header
* Fix dynamic uses of i18n ([#678](https://github.com/opensearch-project/dashboards-maps/pull/678))
### Infrastructure
### Documentation
### Maintenance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ export const DocumentLayerStyle = ({
fullWidth={true}
isInvalid={hasInvalid}
error={i18n.translate('maps.documents.style.invalidWidth', {
defaultMessage: `must be between ${min} and ${max}`,
defaultMessage: 'must be between {min} and {max}',
values: { min, max },
})}
>
<EuiCompressedFieldNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,11 @@ export const LabelConfig = ({
})}
isInvalid={invalidLabelSize}
error={i18n.translate('maps.documents.labelSizeError', {
defaultMessage: `Must be between ${DOCUMENTS_MIN_LABEL_SIZE} and ${DOCUMENTS_MAX_LABEL_SIZE}`,
defaultMessage: 'Must be between {min} and {max}',
values: {
min: DOCUMENTS_MIN_LABEL_SIZE,
max: DOCUMENTS_MAX_LABEL_SIZE
},
})}
>
<EuiCompressedFieldNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ export const LayerControlPanel = memo(

if (zoom < layer.zoomRange[0] || zoom > layer.zoomRange[1]) {
return i18n.translate('maps.layerControl.layerNotVisibleZoom', {
defaultMessage: `Layer is hidden outside of zoom range ${layer.zoomRange[0]}${layer.zoomRange[1]}`,
defaultMessage: 'Layer is hidden outside of zoom range {min}–{max}',
values: {
min: layer.zoomRange[0],
max: layer.zoomRange[1],
},
});
}
return '';
Expand Down
12 changes: 4 additions & 8 deletions public/components/map_top_nav/get_top_nav_config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,8 @@ export const onGetSave = (
}
toastNotifications.addSuccess({
title: i18n.translate('map.topNavMenu.saveMap.successNotificationText', {
defaultMessage: `Saved ${newTitle}`,
values: {
visTitle: newTitle,
},
defaultMessage: 'Saved {newTitle}',
values: { newTitle },
}),
});
if (originatingApp && returnToOrigin) {
Expand All @@ -212,10 +210,8 @@ export const onGetSave = (
} catch (error: any) {
toastNotifications.addDanger({
title: i18n.translate('maps.topNavMenu.saveVisualization.failureNotificationText', {
defaultMessage: `Error on saving ${newTitle}`,
values: {
visTitle: newTitle,
},
defaultMessage: 'Error on saving {newTitle}',
values: { newTitle },
}),
text: error.message,
'data-test-subj': 'saveMapError',
Expand Down

0 comments on commit 7d1b002

Please sign in to comment.