diff --git a/src/client/app/components/conversion/EditConversionModalComponent.tsx b/src/client/app/components/conversion/EditConversionModalComponent.tsx index 558588673..757d96e8c 100644 --- a/src/client/app/components/conversion/EditConversionModalComponent.tsx +++ b/src/client/app/components/conversion/EditConversionModalComponent.tsx @@ -87,46 +87,46 @@ export default function EditConversionModalComponent(props: EditConversionModalC let msg = ''; let cancel = false; if (source.typeOfUnit === UnitType.meter) { - const count = getConversionCount(source, conversionDetails); - if (count === 1) { - msg += `Deleting this meter conversion will orphan ${unitDataById[state.destinationId].name}.\n`; + const srcCount = getConversionCount(source, conversionDetails); + if (srcCount === 1) { + msg += `${translate('conversion.delete.meter.orphan')} "${unitDataById[state.destinationId].name}".\n`; } else { - msg += 'Deleting this meter conversion will make the following meter(s) ungraphable:\n'; + msg += `${translate('conversion.delete.meter.ungraphable')}\n`; for (const meterId of Object.values(meterDataById)) { - if (meterId.unitId == source.id) { - msg += `${meterId.name}\n`; + if (meterId.unitId === source.id) { + msg += `"${meterId.name}"\n`; cancel = true; } } } } else if (source.typeOfUnit === UnitType.suffix) { - const count = getConversionCount(source, conversionDetails); - if (count === 1) { - msg += `Deleting this suffix conversion will disable use of ${source.name}.\n`; + const srcCount = getConversionCount(source, conversionDetails); + if (srcCount === 1) { + msg += `${translate('conversion.delete.suffix.disable')} "${source.name}".\n`; } } else if (source.typeOfUnit === UnitType.unit && dest.typeOfUnit === UnitType.unit) { const destCount = getConversionCount(dest, conversionDetails); if (destCount === 1) { - msg += `Deleting this unit conversion will orphan ${unitDataById[state.destinationId].name}.\n`; + msg += `${translate('conversion.delete.unit.orphan')} "${unitDataById[state.destinationId].name}".\n`; } if (state.bidirectional) { - const sourceCount = getConversionCount(source, conversionDetails); - if (sourceCount === 1) { - msg += `Deleting this unit conversion will orphan ${unitDataById[state.destinationId].name}.\n`; + const srcCount = getConversionCount(source, conversionDetails); + if (srcCount === 1) { + msg += `${translate('conversion.delete.unit.orphan')} "${unitDataById[state.destinationId].name}".\n`; } } if (msg === '') { - msg += 'Deleting this unit conversion between two units of type unit will have consequences.\n'; + msg += `${translate('conversion.delete.unit')}\n`; } } if (msg === '') { handleDeleteConfirmationModalOpen(); } else if (cancel) { - setDeleteConfirmationMessage(msg + 'This conversion cannot be deleted.\n'); + setDeleteConfirmationMessage(msg + `${translate('conversion.delete.restricted')}\n`); handleCancelModalOpen(); } else { - setDeleteConfirmationMessage(msg + deleteConfirmationMessage); + setDeleteConfirmationMessage(msg + translate('conversion.delete.conversion') + ' [' + props.conversionIdentifier + '] ?'); handleDeleteConfirmationModalOpen(); } }; diff --git a/src/client/app/translations/data.ts b/src/client/app/translations/data.ts index 91795e891..fb853ce58 100644 --- a/src/client/app/translations/data.ts +++ b/src/client/app/translations/data.ts @@ -63,6 +63,12 @@ const LocaleTranslationData = { "conversion.create.source.destination.not": "Source or destination not set", "conversion.create.source.destination.same": "The source and destination cannot be the same for a conversion", "conversion.delete.conversion": "Delete Conversion", + "conversion.delete.meter.orphan": "Deleting this meter conversion will orphan meter", + "conversion.delete.meter.ungraphable": "Deleting this meter conversion will make the following meter(s) ungraphable:", + "conversion.delete.restricted": "This conversion cannot be deleted until the significant consequences of doing this are addressed.", + "conversion.delete.suffix.disable": "Deleting this suffix conversion will disable use of suffix", + "conversion.delete.unit" : "Deleting this conversion between two units of type unit may reduce the possible graphing units for some meter(s) but cannot be known until after the deletion happens.", + "conversion.delete.unit.orphan": "Deleting this unit conversion will orphan unit", "conversion.destination": "Destination:", "conversion.dropdown.displayable.option.admin": "Admin", "conversion.edit.conversion": "Edit Conversion", @@ -585,6 +591,12 @@ const LocaleTranslationData = { "conversion.create.source.destination.not": "Source or destination not set\u{26A1}", "conversion.create.source.destination.same": "The source and destination cannot be the same for a conversion\u{26A1}", "conversion.delete.conversion": "Delete Conversion\u{26A1}", + "conversion.delete.meter.orphan": "Deleting this meter conversion will orphan meter\u{26A1}", + "conversion.delete.meter.ungraphable": "Deleting this meter conversion will make the following meter(s) ungraphable:\u{26A1}", + "conversion.delete.restricted": "This conversion cannot be deleted until the significant consequences of doing this are addressed.\u{26A1}", + "conversion.delete.suffix.disable": "Deleting this suffix conversion will disable use of suffix\u{26A1}", + "conversion.delete.unit" : "Deleting this conversion between two units of type unit may reduce the possible graphing units for some meter(s) but cannot be known until after the deletion happens.\u{26A1}", + "conversion.delete.unit.orphan": "Deleting this unit conversion will orphan unit\u{26A1}", "conversion.destination": "Destination:\u{26A1}", "conversion.dropdown.displayable.option.admin": "admin\u{26A1}", "conversion.edit.conversion": "Edit Conversion\u{26A1}", @@ -1107,6 +1119,12 @@ const LocaleTranslationData = { "conversion.create.source.destination.not": "Fuente o destinación no establecida.", "conversion.create.source.destination.same": "La fuente y destinación no pueden ser la misma para una conversión", "conversion.delete.conversion": "Eliminar conversión", + "conversion.delete.meter.orphan": "Deleting this meter conversion will orphan meter\u{26A1}", + "conversion.delete.meter.ungraphable": "Deleting this meter conversion will make the following meter(s) ungraphable:\u{26A1}", + "conversion.delete.restricted": "This conversion cannot be deleted until the significant consequences of doing this are addressed.\u{26A1}", + "conversion.delete.suffix.disable": "Deleting this suffix conversion will disable use of suffix\u{26A1}", + "conversion.delete.unit" : "Deleting this conversion between two units of type unit may reduce the possible graphing units for some meter(s) but cannot be known until after the deletion happens.\u{26A1}", + "conversion.delete.unit.orphan": "Deleting this unit conversion will orphan unit\u{26A1}", "conversion.destination": "Destinación", "conversion.dropdown.displayable.option.admin": "Administrador", "conversion.edit.conversion": "Editar conversión",