Skip to content

Commit

Permalink
🌐 [#4798] Translated confirmation buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
robinmolen committed Nov 12, 2024
1 parent 605f2d1 commit 1d5c200
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 14 deletions.
12 changes: 12 additions & 0 deletions src/openforms/js/compiled-lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2527,6 +2527,12 @@
"value": "Change text"
}
],
"M9JbDC": [
{
"type": 0,
"value": "Cancel"
}
],
"MEkGHD": [
{
"type": 0,
Expand Down Expand Up @@ -4635,6 +4641,12 @@
"value": "."
}
],
"gpiYPI": [
{
"type": 0,
"value": "Confirm"
}
],
"gqVGbb": [
{
"type": 0,
Expand Down
12 changes: 12 additions & 0 deletions src/openforms/js/compiled-lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -2548,6 +2548,12 @@
"value": "'Wijzigen' tekst"
}
],
"M9JbDC": [
{
"type": 0,
"value": "Annuleren"
}
],
"MEkGHD": [
{
"type": 0,
Expand Down Expand Up @@ -4657,6 +4663,12 @@
"value": "."
}
],
"gpiYPI": [
{
"type": 0,
"value": "Accepteren"
}
],
"gqVGbb": [
{
"type": 0,
Expand Down
40 changes: 26 additions & 14 deletions src/openforms/js/components/admin/form_design/useConfirm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {useState} from 'react';
import {useIntl} from 'react-intl';

import ActionButton from 'components/admin/forms/ActionButton';
import {Modal} from 'components/admin/modals';
Expand All @@ -25,20 +26,31 @@ const useConfirm = (message, title = '') => {
handleClose();
};

const ConfirmationModal = () => (
<Modal
title={title}
isOpen={promise !== null}
contentModifiers={['with-form', 'small']}
closeModal={handleCancel}
>
<div style={{flexGrow: 1}}>{message}</div>
<div className="button-group">
<ActionButton text="confirm" className="default" onClick={handleConfirm} />
<ActionButton text="cancel" onClick={handleCancel} />
</div>
</Modal>
);
const ConfirmationModal = () => {
const intl = useIntl();
const confirmBtnText = intl.formatMessage({
description: 'Confirmation modal confirm button',
defaultMessage: 'Confirm',
});
const cancelBtnText = intl.formatMessage({
description: 'Confirmation modal cancel button',
defaultMessage: 'Cancel',
});
return (
<Modal
title={title}
isOpen={promise !== null}
contentModifiers={['with-form', 'small']}
closeModal={handleCancel}
>
<div style={{flexGrow: 1}}>{message}</div>
<div className="button-group">
<ActionButton text={confirmBtnText} className="default" onClick={handleConfirm} />
<ActionButton text={cancelBtnText} onClick={handleCancel} />
</div>
</Modal>
);
};
return [ConfirmationModal, confirm];
};

Expand Down
10 changes: 10 additions & 0 deletions src/openforms/js/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,11 @@
"description": "literals.changeText form label",
"originalDefault": "Change text"
},
"M9JbDC": {
"defaultMessage": "Cancel",
"description": "Confirmation modal cancel button",
"originalDefault": "Cancel"
},
"MEkGHD": {
"defaultMessage": "Component",
"description": "Formio component selection label",
Expand Down Expand Up @@ -2129,6 +2134,11 @@
"description": "Logic action warning icon text",
"originalDefault": "Detected some problems in this action: {problems}."
},
"gpiYPI": {
"defaultMessage": "Confirm",
"description": "Confirmation modal confirm button",
"originalDefault": "Confirm"
},
"gqVGbb": {
"defaultMessage": "Edit prefill configuration",
"description": "'Edit variable prefill' icon label",
Expand Down
10 changes: 10 additions & 0 deletions src/openforms/js/lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,11 @@
"description": "literals.changeText form label",
"originalDefault": "Change text"
},
"M9JbDC": {
"defaultMessage": "Annuleren",
"description": "Confirmation modal cancel button",
"originalDefault": "Cancel"
},
"MEkGHD": {
"defaultMessage": "Veld",
"description": "Formio component selection label",
Expand Down Expand Up @@ -2146,6 +2151,11 @@
"description": "Logic action warning icon text",
"originalDefault": "Detected some problems in this action: {problems}."
},
"gpiYPI": {
"defaultMessage": "Accepteren",
"description": "Confirmation modal confirm button",
"originalDefault": "Confirm"
},
"gqVGbb": {
"defaultMessage": "Prefill instellen",
"description": "'Edit variable prefill' icon label",
Expand Down

0 comments on commit 1d5c200

Please sign in to comment.