From 9c2f4ed6bfe45619fbec20a7480ef26f606b5976 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 8 Jun 2021 15:03:29 +0000 Subject: [PATCH] Bug 28536: Move translatable strings into overdrive.js This patch takes strings defined as variables in opac-bottom.inc for use in overdrive.js and moves them to overdrive.js, wrapped in the double-underscore translation function. To test you must have valid credentials entered in system preferences for the OverDrive API. Ideally you should test using a patron who has holds and current checkouts in OverDrive. Apply the patch and log in to the OPAC. - On the "Your summary" page, open the "OverDrive Account" tab. - Log in to your OverDrive account. - The contents of the tab should display correctly, with correct labels for controls like "Log out of your OverDrive account", "Check in", "On hold", etc. - Perform a catalog search which will return results also found in your OverDrive collection. - Open the OverDrive results page. - The page should display correctly, with correct labels on controls like "Check out" and "Place hold." To test that the correct strings are translatable. In this example I'm testing fr-FR: - Update a translation: > gulp po:update > cd misc/translator > perl translate update fr-FR - Open the corresponding .po file for the strings pulled from JavaScript e.g. misc/translator/po/fr-FR-messages-js.po - Locate strings pulled from bootstrap/js/overdrive.js for translation, e.g.: koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js:124 msgid "OverDrive account page" msgstr "" - Edit the "msgstr" string however you want (it's just for testing) - Install the updated translation: > perl translate install fr-FR In the OPAC, switch to the language you're testing. Confirm that your translated strings appear. In the above example, the string should appear at the top of the "Overdrive Account" tab. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- .../bootstrap/en/includes/opac-bottom.inc | 9 ----- koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js | 38 +++++++++---------- 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc index ae93d718ef..e4aaccf54a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -196,15 +196,6 @@ $.widget.bridge('uitooltip', $.ui.tooltip); var MSG_MULTI_ADD_TAG_FAILED = _("Unable to add one or more tags."); var MSG_NO_TAG_SPECIFIED = _("No tag was specified."); [% END %] - [% IF ( Koha.Preference('OverDriveClientKey') && Koha.Preference('OverDriveClientSecret') ) %] - var MSG_OVERDRIVE_LOGIN = _("Log in to your OverDrive account"); - var MSG_OVERDRIVE_LINK = _( "OverDrive account page" ); - var MSG_OVERDRIVE_LOGOUT = _("Log out from your OverDrive account"); - var MSG_OVERDRIVE_CHECKEDOUT_UNTIL = _( "Checked out until: " ); - var MSG_OVERDRIVE_ACCESS_ONLINE = _("Access online"); - var MSG_OVERDRIVE_DOWNLOAD_AS = _( "Download as: " ); - var MSG_OVERDRIVE_CANNOT_CHECKOUT = _("Item cannot be checked out. There are no available formats"); - [% END %] [% IF OpenLibraryCovers || OpenLibrarySearch %] var NO_OL_JACKET = _("No cover image available"); [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js b/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js index 6f586e069f..865946c350 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js @@ -1,4 +1,4 @@ -/* global MSG_OVERDRIVE_LOGIN MSG_OVERDRIVE_LINK MSG_OVERDRIVE_LOGOUT MSG_OVERDRIVE_CHECKEDOUT_UNTIL MSG_DOWNLOAD MSG_OVERDRIVE_ACCESS_ONLINE MSG_OVERDRIVE_DOWNLOAD_AS MSG_CHECK_IN MSG_CHECK_OUT MSG_CHECKOUTS MSG_HOLDS MSG_ON_HOLD MSG_PLACE_HOLD MSG_CANCEL_HOLD MSG_OVERDRIVE_CANNOT_CHECKOUT MSG_CANCEL_HOLD_CONFIRM MSG_CHECK_IN_CONFIRM MSG_CHECK_OUT_CONFIRM OD_password_required */ +/* global OD_password_required __ */ if ( typeof KOHA == "undefined" || !KOHA ) { var KOHA = {}; @@ -76,7 +76,7 @@ KOHA.OverDriveCirculation = new function() { if( OD_password_required ) { $("#overdrive-login").modal('show'); } else { login(""); } }) - .text( MSG_OVERDRIVE_LOGIN ); + .text( __("Log in to your OverDrive account") ); var login_div = $('