Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions invokeai/frontend/web/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -74,15 +74,15 @@ 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;
}

const compositeArray = compositeImageData.data;
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;
}

Expand Down Expand Up @@ -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}>
Expand Down