Bug 25351

Summary: Move cart-related strings out of opac-bottom.inc and into basket.js
Product: Koha Reporter: Owen Leonard <oleonard>
Component: I18N/L10NAssignee: Bugs List <koha-bugs>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: aleisha, f.demians, lucas, testopia, tomascohen, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.03, 19.11.09
Circulation function:
Bug Depends on: 21156    
Bug Blocks: 26719    
Attachments: Bug 25351: Move cart-related strings out of opac-bottom.inc and into basket.js
Bug 25351: Move cart-related strings out of opac-bottom.inc and into basket.js
Bug 25351: Move cart-related strings out of opac-bottom.inc and into basket.js

Description Owen Leonard 2020-05-01 22:10:38 UTC
Cart-related strings which were put in opac-bottom.inc for translation purposes can now be wrapped in the new translation function and put in basket.js
Comment 1 Owen Leonard 2020-06-18 14:15:18 UTC Comment hidden (obsolete)
Comment 2 Tomás Cohen Arazi (tcohen) 2020-07-21 18:19:50 UTC
Tested with es-ES and works like a charm.
Comment 3 Tomás Cohen Arazi (tcohen) 2020-07-21 18:20:45 UTC Comment hidden (obsolete)
Comment 4 Katrin Fischer 2020-07-29 21:27:50 UTC
Created attachment 107537 [details] [review]
Bug 25351: Move cart-related strings out of opac-bottom.inc and into basket.js

This patch adds the necessary JavaScript includes to the OPAC to
enable translation of strings in JavaScript. It also updates the
translation of cart-related strings by removing the strings from
opac-bottom.inc and putting them in basket.js where they are used.

To test, apply the patch and test that the correct strings are
translatable. In this example I'm testing fr-FR:

 - Update a translation:

   > 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/basket.js for
   translation, e.g.:

   #: koha-tmpl/opac-tmpl/bootstrap/js/basket.js:89
   msgid "Your cart is currently empty"
   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 string appears. In the above example, by clicking the "Cart"
icon in the header when there are no items in the cart.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Jonathan Druart 2020-07-30 15:46:46 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 6 Lucas Gass (lukeg) 2020-08-06 20:13:04 UTC
This enhancement improves translatability so I am choosing to backport this to 20.05.x for 20.05.03
Comment 7 Aleisha Amohia 2020-08-07 02:08:18 UTC
backported to 19.11.x for 19.11.09
Comment 8 Victor Grousset/tuxayo 2020-09-20 10:22:58 UTC
Not backported to oldoldstable (19.05.x). Feel free to ask if it's needed.