Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

Corrected error message and redirected popup messages to use translation file

DustyShoe2d8317f1aa40
diff --git a/invokeai/frontend/web/public/locales/en.json b/invokeai/frontend/web/public/locales/en.json
index 881d725327..97b6282a9b 100644
--- a/invokeai/frontend/web/public/locales/en.json
+++ b/invokeai/frontend/web/public/locales/en.json
@@ -2185,6 +2185,9 @@
"showHUD": "Show HUD",
"rectangle": "Rectangle",
"maskFill": "Mask Fill",
+ "maskLayerEmpty": "Mask layer is empty",
+ "extractMaskedAreaFailed": "Unable to extract masked area.",
+ "extractMaskedAreaMissingData": "Cannot extract: image or mask data is missing.",
"addPositivePrompt": "Add $t(controlLayers.prompt)",
"addNegativePrompt": "Add $t(controlLayers.negativePrompt)",
"addReferenceImage": "Add $t(controlLayers.referenceImage)",
diff --git a/invokeai/frontend/web/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItemsExtractMaskedArea.tsx b/invokeai/frontend/web/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItemsExtractMaskedArea.tsx
index fccee3a3a0..6c5cf7b42e 100644
--- a/invokeai/frontend/web/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItemsExtractMaskedArea.tsx
+++ b/invokeai/frontend/web/src/features/controlLayers/components/InpaintMask/InpaintMaskMenuItemsExtractMaskedArea.tsx
@@ -27,7 +27,7 @@ export const InpaintMaskMenuItemsExtractMaskedArea = memo(() => {
const maskAdapter = canvasManager.getAdapter(entityIdentifier);
if (!maskAdapter) {
log.error({ entityIdentifier }, 'Inpaint mask adapter not found when extracting masked area');
- toast({ status: 'error', title: 'Unable to extract masked area.' });
+ toast({ status: 'error', title: t('controlLayers.extractMaskedAreaFailed') });
return;
}
@@ -44,7 +44,7 @@ export const InpaintMaskMenuItemsExtractMaskedArea = memo(() => {
// Abort when the canvas is effectively empty—no pixels to extract.
if (rect.width <= 0 || rect.height <= 0) {
- toast({ status: 'warning', title: 'Canvas is empty.' });
+ toast({ status: 'warning', title: t('controlLayers.maskLayerEmpty') });
return;
}
@@ -74,7 +74,7 @@ export const InpaintMaskMenuItemsExtractMaskedArea = memo(() => {
},
'Mask and composite dimensions did not match when extracting masked area'
);
- toast({ status: 'error', title: 'Unable to extract masked area.' });
+ toast({ status: 'error', title: t('controlLayers.extractMaskedAreaFailed') });
return;
}
@@ -82,7 +82,7 @@ export const InpaintMaskMenuItemsExtractMaskedArea = memo(() => {
const maskArray = maskImageData.data;
if (!compositeArray || !maskArray) {
- toast({ status: 'error', title: 'Cannot extract: image or mask data is missing.' });
+ toast({ status: 'error', title: t('controlLayers.extractMaskedAreaMissingData') });
return;
}
@@ -137,10 +137,10 @@ export const InpaintMaskMenuItemsExtractMaskedArea = memo(() => {
});
} catch (error) {
log.error({ error: serializeError(error as Error) }, 'Failed to extract masked area to raster layer');
- toast({ status: 'error', title: 'Unable to extract masked area.' });
+ toast({ status: 'error', title: t('controlLayers.extractMaskedAreaFailed') });
}
})();
- }, [canvasManager, entityIdentifier]);
+ }, [canvasManager, entityIdentifier, t]);
return (
<MenuItem onClick={onExtract} icon={<PiSelectionBackgroundBold />} isDisabled={isBusy}>