diff --git a/src/frontend/hooks/use-modal.ts b/src/frontend/hooks/use-modal.ts index f9a099e57..f12dc3c0c 100644 --- a/src/frontend/hooks/use-modal.ts +++ b/src/frontend/hooks/use-modal.ts @@ -47,12 +47,14 @@ export const useModal = (): ModalFunctions => { buttons.push({ label: translateButton('ok', resourceId), variant: 'primary', onClick: closeModal }) } + const getDefaultTranslationKey = (placement: string) => `modal-${placement}` + const data: ModalData = { modalProps: { ...modalProps, - label: translateLabel(modalProps.label || '', resourceId), - title: translateMessage(modalProps.title || '', resourceId), - subTitle: translateMessage(modalProps.subTitle || '', resourceId), + label: translateLabel(modalProps.label || getDefaultTranslationKey('label'), resourceId), + title: translateMessage(modalProps.title || getDefaultTranslationKey('title'), resourceId), + subTitle: translateMessage(modalProps.subTitle || getDefaultTranslationKey('subTitle'), resourceId), variant: modalProps.variant, buttons, onClose: modalProps.onClose || closeModal,