opac-bottom.inc defines several template variables for variations on "No cover image available" which are unnecessary. We can wrap those strings in the __() function in the JS files. This patch will cover Coce, Amazon, Baker & Taylor, Google, and OpenLibrary.
Created attachment 152393 [details] [review] Bug 34026: Move translatable cover-handling strings out of opac-bottom.inc This patch removes several instances from opac-bottom.inc where we define strings for translation and use in separate JavaScript files. The JavaScript files are updated to use the __() function to mark strings for translation. Note: Definition of the variable NO_COCE_JACKET is removed because it is unused. To test, apply the patch and clear your browser cache if necessary. - In the staff interface, enable OPAC cover image services: - OPACAmazonCoverImages - BakerTaylorEnabled - GoogleJackets - OpenLibraryCovers - In the OPAC, perform a search and confirm that there are no JS errors on the search results page related to cover images. - Check the bibliographic detail page as well. To confirm that the strings are being picked up for translation, run the update process for another language, e.g. perl misc/translator/translate update fr-FR Then check the newly-built po file: fr-FR-messages-js.po. It should list the updated files: koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js:8 koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js:10 koha-tmpl/opac-tmpl/bootstrap/js/bakertaylorimages.js:7 koha-tmpl/opac-tmpl/bootstrap/js/google-jackets.js:77 koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js:63
Created attachment 152432 [details] [review] Bug 34026: Move translatable cover-handling strings out of opac-bottom.inc This patch removes several instances from opac-bottom.inc where we define strings for translation and use in separate JavaScript files. The JavaScript files are updated to use the __() function to mark strings for translation. Note: Definition of the variable NO_COCE_JACKET is removed because it is unused. To test, apply the patch and clear your browser cache if necessary. - In the staff interface, enable OPAC cover image services: - OPACAmazonCoverImages - BakerTaylorEnabled - GoogleJackets - OpenLibraryCovers - In the OPAC, perform a search and confirm that there are no JS errors on the search results page related to cover images. - Check the bibliographic detail page as well. To confirm that the strings are being picked up for translation, run the update process for another language, e.g. perl misc/translator/translate update fr-FR Then check the newly-built po file: fr-FR-messages-js.po. It should list the updated files: koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js:8 koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js:10 koha-tmpl/opac-tmpl/bootstrap/js/bakertaylorimages.js:7 koha-tmpl/opac-tmpl/bootstrap/js/google-jackets.js:77 koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js:63
This change cannot be made to coce.js because it is outside koha-tmpl/intranet-tmpl/prog/js. Files in koha-tmpl/intranet-tmpl/js are not processed for translation.
Created attachment 156701 [details] [review] Bug 34026: Move translatable cover-handling strings out of opac-bottom.inc This patch removes several instances from opac-bottom.inc where we define strings for translation and use in separate JavaScript files. The JavaScript files are updated to use the __() function to mark strings for translation. Note: Definition of the variable NO_COCE_JACKET is removed because it is unused. To test, apply the patch and clear your browser cache if necessary. - In the staff interface, enable OPAC cover image services: - OPACAmazonCoverImages - BakerTaylorEnabled - GoogleJackets - OpenLibraryCovers - In the OPAC, perform a search and confirm that there are no JS errors on the search results page related to cover images. - Check the bibliographic detail page as well. To confirm that the strings are being picked up for translation, run the update process for another language, e.g. perl misc/translator/translate update fr-FR Then check the newly-built po file: fr-FR-messages-js.po. It should list the updated files: koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js:8 koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js:10 koha-tmpl/opac-tmpl/bootstrap/js/bakertaylorimages.js:7 koha-tmpl/opac-tmpl/bootstrap/js/google-jackets.js:77 koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js:63 Signed-off-by: David Nind <david@davidnind.com>
Testing notes (using KTD): 1. I don't have Baker & Taylor credentials, but I tested all the others. Please change back to needs sign off if that is required. 2. There were some JavaScript errors in the console, but these were there before the patch was applied as well. I have listed these in case they need separate bugs to fix up. JavaScript console errors ========================= OPAC home page ~~~~~~~~~~~~~~ downloadable font: Glyph bbox was incorrect (glyph ids 1 2 3 4 5 8 9 10 11 12 13 14 16 17 19 22 24 28 32 34 35 38 39 40 43 44 45 46 47 50 51 52 53 55 56 58 60 61 62 64 67 68 70 71 72 73 74 78 79 80 81 83 90 96 101 103 104 105 108 109 115 116 117 118 120 123 125 135 138 139 140 142 143 144 145 146 148 149 154 155 157 161 162 163 164 165 169 170 171 173 179 181 193 195 203 207 208 210 211 214 218 219 223 225 227 228 229 230 235 236 237 ..... 1380 1381 1382 1384 1387) (font-family: "Font Awesome 6 Free" style:normal weight:900 stretch:100 src index:0) source: http://127.0.0.1:8080/opac-tmpl/lib/fontawesome/webfonts/fa-solid-900.woff2 Search results page in the OPAC ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Some cookies are misusing the recommended “SameSite“ attribute The script from “https://openlibrary.org/api/books?bibkeys=ISBN%3A0596004923%2CISBN%3A0596001738%2CISBN%3A1565926994%2CISBN%3A1430223650%2CISBN%3A1565924193%2CISBN%3A0596102062%2CISBN%3A0321496949%2CISBN%3A1558607013%2CISBN%3A0596004761&callback=KOHA.OpenLibrary.olCallBack&jscmd=data” was loaded even though its MIME type (“application/json”) is not a valid JavaScript MIME type. opac-search.pl The script from “https://openlibrary.org/api/volumes/brief/json/id:0;isbn:0596004923;lccn:__2012392268|id:1;isbn:0596001738;lccn:__2005284585;oclc:ocm61231154|id:2;isbn:1565926994;lccn:___00022023_|id:3;isbn:1430223650;lccn:__2010501891;oclc:ocn436921319|id:4;isbn:1565924193;lccn:___00041664_|id:5;isbn:0596102062;lccn:__2006283805;oclc:ocm64666983|id:6;isbn:0321496949;lccn:__2010001078;oclc:ocn457156606|id:7;isbn:1558607013;lccn:__2004017815|id:8;isbn:0596004761;lccn:__2004558626;oclc:ocm53243416?callback=jQuery360042252389391369305_1696707019971&show_all_items=true&_=1696707019972” was loaded even though its MIME type (“application/json”) is not a valid JavaScript MIME type. opac-search.pl Request to access cookie or storage on “https://books.google.com/books?bibkeys=0596004923%2C0596001738%2C1565926994%2C1430223650%2C1565924193%2C0596102062%2C0321496949%2C1558607013%2C0596004761&jscmd=viewapi&callback=KOHA.Google.gbsCallBack” was blocked because it came from a tracker and content blocking is enabled. [This is probably browser related - Firefox Developer Edition] OPAC detail page for a record ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The script from “https://openlibrary.org/api/books?bibkeys=ISBN%3A0596004923&callback=KOHA.OpenLibrary.olCallBack&jscmd=data” was loaded even though its MIME type (“application/json”) is not a valid JavaScript MIME type. opac-detail.pl The script from “https://openlibrary.org/api/volumes/brief/json/id:0;isbn:0596004923;lccn:__2012392268?callback=jQuery36007419735162323229_1696707250396&show_all_items=true&_=1696707250397” was loaded even though its MIME type (“application/json”) is not a valid JavaScript MIME type. opac-detail.pl Request to access cookie or storage on “https://books.google.com/books?bibkeys=0596004923&jscmd=viewapi&callback=KOHA.Google.gbsCallBack” was blocked because it came from a tracker and content blocking is enabled.
Created attachment 156706 [details] [review] Bug 34026: Move translatable cover-handling strings out of opac-bottom.inc This patch removes several instances from opac-bottom.inc where we define strings for translation and use in separate JavaScript files. The JavaScript files are updated to use the __() function to mark strings for translation. Note: Definition of the variable NO_COCE_JACKET is removed because it is unused. To test, apply the patch and clear your browser cache if necessary. - In the staff interface, enable OPAC cover image services: - OPACAmazonCoverImages - BakerTaylorEnabled - GoogleJackets - OpenLibraryCovers - In the OPAC, perform a search and confirm that there are no JS errors on the search results page related to cover images. - Check the bibliographic detail page as well. To confirm that the strings are being picked up for translation, run the update process for another language, e.g. perl misc/translator/translate update fr-FR Then check the newly-built po file: fr-FR-messages-js.po. It should list the updated files: koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js:8 koha-tmpl/opac-tmpl/bootstrap/js/amazonimages.js:10 koha-tmpl/opac-tmpl/bootstrap/js/bakertaylorimages.js:7 koha-tmpl/opac-tmpl/bootstrap/js/google-jackets.js:77 koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js:63 Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 156707 [details] [review] Bug 34026: (QA follow-up) Remove NO_COCE_JACKET As already noted in Owen's commit message, this variable appears to be unused. Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
(In reply to David Nind from comment #5) > Testing notes (using KTD): > > 1. I don't have Baker & Taylor credentials, but I tested all the others. > Please change back to needs sign off if that is required. > > 2. There were some JavaScript errors in the console, but these were there > before the patch was applied as well. I have listed these in case they need > separate bugs to fix up. I believe that these JS messages are unrelated to the changes in this patch.
Pushed to master for 23.11. Nice work everyone, thanks!
Enhancement not pushed to 23.05.x