From 60393de145637389ac5b2a2eb7751cf289bd74ed Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Thu, 20 Jul 2023 17:12:43 +0200 Subject: [PATCH] fix(client): translate navigation warnings (#51026) --- client/i18n/locales/english/translations.json | 3 ++- client/src/templates/Challenges/exam/show.tsx | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json index dafb8bddfa5..46fa09d6d6a 100644 --- a/client/i18n/locales/english/translations.json +++ b/client/i18n/locales/english/translations.json @@ -544,7 +544,8 @@ "iframe-alert": "Normally this link would bring you to another website! It works. This is a link to: {{externalLink}}", "iframe-form-submit-alert": "Normally this form would be submitted! It works. This will be submitted to: {{externalLink}}", "document-notfound": "document not found", - "slow-load-msg": "Looks like this is taking longer than usual, please try refreshing the page." + "slow-load-msg": "Looks like this is taking longer than usual, please try refreshing the page.", + "navigation-warning": "If you leave this page, you will lose your progress. Are you sure?" }, "icons": { "gold-cup": "Gold Cup", diff --git a/client/src/templates/Challenges/exam/show.tsx b/client/src/templates/Challenges/exam/show.tsx index d062176a338..45ac3f773f1 100644 --- a/client/src/templates/Challenges/exam/show.tsx +++ b/client/src/templates/Challenges/exam/show.tsx @@ -348,13 +348,13 @@ class ShowExam extends Component { stopWindowClose = (event: Event) => { event.preventDefault(); - alert('stop!'); + alert(this.props.t('misc.navigation-warning')); }; stopBrowserBack = (event: Event) => { event.preventDefault(); window.history.forward(); - alert('stop!'); + alert(this.props.t('misc.navigation-warning')); }; runExam = () => {