From 9cd67c8489fffe9700d76328c4d30774df83a87c Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 18 Aug 2020 18:45:56 +0000 Subject: [PATCH] Bug 26243: Move translatable strings out of templates and into circulation.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 check out to a patron. - If there are none on the account, add a new message using the "Add a new message" link. - Click "Delete" for that message. - You should get a confirmation message, "Are you sure you want to delete this message? This cannot be undone." - If necessary, enable the ExportCircHistory system preference. - Check out to a patron who has one or more items checked out. - Wihtout checking any checkboxes, click the "Export" button at the bottom of the page. - You should get an error message, "You must select checkout(s) to export." - Add a restriction the patron's account. - Delete the restriction. You should get a confirmation message, "Remove restriction?" - Perform the same tests from the patron detail 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/pages/circulation.js for translation, e.g.: msgid "You must select checkout(s) to export" 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: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart (cherry picked from commit 111b14dc965d51561add33d94eaf18616a815e88) Signed-off-by: Lucas Gass --- koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt | 5 +---- .../intranet-tmpl/prog/en/modules/members/moremember.tt | 5 +---- koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 2e5156ed8f..43c4a912e6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -830,7 +830,7 @@ "[% message.message | html %]" [% IF message.branchcode == branch OR Koha.Preference('AllowAllMessageDeletion') %] - Delete + Delete [% END %] [% END %] @@ -1055,9 +1055,6 @@ [% FOREACH b IN relatives_borrowernumbers %] relatives_borrowernumbers.push("[% b | html %]"); [% END %] - - var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); - var MSG_CONFIRM_DELETE_MESSAGE = _("Are you sure you want to delete this message? This cannot be undone."); var SuspendHoldsIntranet = [% ( Koha.Preference('SuspendHoldsIntranet') ) ? 1 : 0 | html %]; [% Asset.js("js/pages/circulation.js") | $raw %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index e06e5cfe12..e390393351 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -98,7 +98,7 @@ "[% patron_message.message | html %]" [% IF patron_message.branchcode == patron.branchcode OR Koha.Preference('AllowAllMessageDeletion') %] - Delete + Delete [% END %] [% END %] @@ -893,9 +893,6 @@ [% FOREACH b IN relatives_borrowernumbers %] relatives_borrowernumbers.push("[% b | html %]"); [% END %] - - var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); - var MSG_CONFIRM_DELETE_MESSAGE = _("Are you sure you want to delete this message? This cannot be undone."); var SuspendHoldsIntranet = [% ( Koha.Preference('SuspendHoldsIntranet') ) ? 1 : 0 | html %]; [% Asset.js("js/pages/circulation.js") | $raw %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js index 84c7f77fe9..d282e4b22a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js @@ -87,7 +87,7 @@ $(document).ready(function() { // Debarments $("div#reldebarments .remove_restriction").on("click",function(){ - return confirm(_("Remove restriction?")); + return confirm( __("Remove restriction?") ); }); var mrform = $("#manual_restriction_form"); var mrlink = $("#add_manual_restriction"); @@ -113,7 +113,7 @@ $(document).ready(function() { function export_checkouts(format) { if ($("input:checkbox[name='biblionumbers']:checked").length < 1){ - alert(MSG_EXPORT_SELECT_CHECKOUTS); + alert( __("You must select checkout(s) to export") ); return; } -- 2.39.5