From d851b3019b7504beb7c0e9fcb55694f475ba5e56 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 2 May 2019 16:26:55 +0000 Subject: [PATCH] Bug 22804: OPAC Overdrive JavaScript contains untranslatable strings This patch moves untranslatable strings out of overdrive.js and into opac-bottom.inc where other strings are defined for use in JavaScript files. To test you must have OverDrive integration set up, including OverDriveCirculation. Test the various Overdrive integration features: - Placing holds - Cancelling holds - Checking out - Checking in These features should work as expected. Signed-off-by: Jesse Maseto Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize (cherry picked from commit 740d0bde7860c1d67f1612d5fd3c4a68d0714ef0) Signed-off-by: Fridolin Somers --- .../bootstrap/en/includes/opac-bottom.inc | 11 ++++- koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js | 47 ++++++++++--------- 2 files changed, 35 insertions(+), 23 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 a8494dec85..8b8d9ddf6e 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -134,7 +134,7 @@ $.widget.bridge('uitooltip', $.ui.tooltip); var MSG_CHECKOUTS = _("Checkouts"); var MSG_NO_CHECKOUTS = _("No checkouts"); var MSG_CHECK_OUT = _("Check out"); - var MSG_CHECK_OUT_CONFIRM = _("Are you sure you want to checkout this item?"); + var MSG_CHECK_OUT_CONFIRM = _("Are you sure you want to check out this item?"); var MSG_CHECKED_OUT_UNTIL = _("Checked out until %s"); var MSG_CHECK_IN = _("Check in"); var MSG_CHECK_IN_CONFIRM = _("Are you sure you want to return this item?"); @@ -176,6 +176,15 @@ $.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 ( OPACAmazonCoverImages || SyndeticsCoverImages ) %] $(window).load(function() { verify_images(); diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js b/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js index 1e998140fe..bafb61a712 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js @@ -1,3 +1,5 @@ +/* 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 */ + if ( typeof KOHA == "undefined" || !KOHA ) { var KOHA = {}; } @@ -74,7 +76,7 @@ KOHA.OverDriveCirculation = new function() { if( OD_password_required ) { $("#overdrive-login").modal('show'); } else { login(""); } }) - .text(_("Login to OverDrive account")); + .text( MSG_OVERDRIVE_LOGIN ); var login_div = $('