From 83e6b28d8127938d8b1e26512de9b93dc72bf591 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 19 Aug 2020 18:33:28 +0000 Subject: [PATCH] Bug 26256: Move translatable strings out of templates and into serials-toolbar.js This patch removes the definition of translatable strings out of templates and into the corresponding JavaScript file, using the new JS i81n function. To test: - Apply the patch and go to Serials and search for a subscription. - Open the detail page for an open subscription. - Click the "Close" button. You should get a confirmation, "Are you sure you want to close this subscription?" - Confirm that you want to close it. - When the page reloads, click the "Reopen" button. You should get a confirmation, "Are you sure you want to reopen this subscription?" - Cancel. - Choose Edit -> Delete subscription. You should get a confirmation, "Are you sure you want to delete this subscription?" - Perform the same tests from the "Serial collection" page. TESTING TRANSLATABILITY - Update a translation, e.g. fr-FR: > cd misc/translator > perl translate update fr-FR - Open the corresponding .po file for JavaScript strings, e.g. misc/translator/po/fr-FR-messages-js.po - Locate strings pulled from koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js for translation, e.g.: msgid "Are you sure you want to delete this subscription?" msgstr "" - Edit the "msgstr" string however you want (it's just for testing). - Install the updated translation: > perl translate install fr-FR - Switch to your newly translated language in the staff client and repeat the test plan above. The translated strings should appear. Signed-off-by: Alexis Ripetti Signed-off-by: Julian Maurice Signed-off-by: Jonathan Druart (cherry picked from commit ea72b15480c7230c03e7620e9900dc32ae0691c5) Signed-off-by: Lucas Gass --- .../prog/en/modules/serials/serials-collection.tt | 3 --- .../intranet-tmpl/prog/en/modules/serials/serials-home.tt | 5 +---- .../prog/en/modules/serials/serials-search.tt | 3 --- .../prog/en/modules/serials/subscription-detail.tt | 3 --- koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js | 8 ++++---- 5 files changed, 5 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt index a67be01377..0a22a53d7d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt @@ -305,9 +305,6 @@ [% INCLUDE 'datatables.inc' %] [% Asset.js("js/serials-toolbar.js") | $raw %] [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt index ff401ed4cb..8b85891a2e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt @@ -33,11 +33,8 @@ [% MACRO jsinclude BLOCK %] [% Asset.js("js/serials-toolbar.js") | $raw %] - [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt index 32af0cc5f7..b239efe571 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt @@ -410,9 +410,6 @@ [% INCLUDE 'datatables.inc' %] [% Asset.js("js/serials-toolbar.js") | $raw %] [% Asset.js("js/serials-toolbar.js") | $raw %] [% Asset.js("js/mana.js") | $raw %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js b/koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js index 9a3a5f1de1..e68173d950 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js +++ b/koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js @@ -1,20 +1,20 @@ -/* global MSG_CLOSE_SUBSCRIPTION MSG_REOPEN_SUBSCRIPTION CONFIRM_DELETE_SUBSCRIPTION subscriptionid */ +/* global subscriptionid */ function confirm_close() { - var is_confirmed = confirm( MSG_CLOSE_SUBSCRIPTION ); + var is_confirmed = confirm( __("Are you sure you want to close this subscription?") ); if (is_confirmed) { window.location="subscription-detail.pl?subscriptionid=" + subscriptionid + "&op=close"; } } function confirm_reopen() { - var is_confirmed = confirm( MSG_REOPEN_SUBSCRIPTION ); + var is_confirmed = confirm( __("Are you sure you want to reopen this subscription?") ); if (is_confirmed) { window.location="subscription-detail.pl?subscriptionid=" + subscriptionid + "&op=reopen"; } } function confirm_deletion() { - var is_confirmed = confirm( CONFIRM_DELETE_SUBSCRIPTION ); + var is_confirmed = confirm( __("Are you sure you want to delete this subscription?") ); if (is_confirmed) { window.location="subscription-detail.pl?subscriptionid=" + subscriptionid + "&op=del"; } -- 2.39.5