Cart-related strings which were put in js_includes.inc for translation purposes can now be wrapped in the new translation function and put in basket.js
Created attachment 109969 [details] [review] Bug 26439: Move cart-related strings out of js_includes.inc and into basket.js This patch moves strings defined for translation in js_includes.inc into basket.js for translation using the new double-underscore i81n function. To test, apply the patch and perform a catalog search in the staff client. - Click the Cart link in the header menu. A pop-up should appear saying "Your cart is currently empty." - On the search results page, click the "Add to cart" link next to any search result. The text should change to "In your cart." - Click the "Remove" link. The text should change to "Add to cart." - Check the box next to a title in the search results and click the "Add to cart" button in the search results toolbar. A message should appear, "1 item(s) added to your cart." - Click the "Add to cart" button again. You should see the message "No item was added to your cart (already in your cart)!" - Uncheck all check boxes on the search results page and click "Add to cart." You should see "No item was selected." - Add more items to your cart so that it contains more than one item. - Click the "Cart" link to open it. - Click the "Empty and close" button. You should be asked to confirm, "Are you sure you want to empty your cart?" 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/basket.js for translation, e.g.: 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 - Switch to your newly translated language in the staff client and repeat the test plan above. The translated strings should appear.
Created attachment 110831 [details] [review] Bug 26439: Move cart-related strings out of js_includes.inc and into basket.js This patch moves strings defined for translation in js_includes.inc into basket.js for translation using the new double-underscore i81n function. To test, apply the patch and perform a catalog search in the staff client. - Click the Cart link in the header menu. A pop-up should appear saying "Your cart is currently empty." - On the search results page, click the "Add to cart" link next to any search result. The text should change to "In your cart." - Click the "Remove" link. The text should change to "Add to cart." - Check the box next to a title in the search results and click the "Add to cart" button in the search results toolbar. A message should appear, "1 item(s) added to your cart." - Click the "Add to cart" button again. You should see the message "No item was added to your cart (already in your cart)!" - Uncheck all check boxes on the search results page and click "Add to cart." You should see "No item was selected." - Add more items to your cart so that it contains more than one item. - Click the "Cart" link to open it. - Click the "Empty and close" button. You should be asked to confirm, "Are you sure you want to empty your cart?" 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/basket.js for translation, e.g.: 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 - 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 <david@davidnind.com>
Can you please rebase?
Created attachment 111636 [details] [review] Bug 26439: Move cart-related strings out of js_includes.inc and into basket.js This patch moves strings defined for translation in js_includes.inc into basket.js for translation using the new double-underscore i81n function. To test, apply the patch and perform a catalog search in the staff client. - Click the Cart link in the header menu. A pop-up should appear saying "Your cart is currently empty." - On the search results page, click the "Add to cart" link next to any search result. The text should change to "In your cart." - Click the "Remove" link. The text should change to "Add to cart." - Check the box next to a title in the search results and click the "Add to cart" button in the search results toolbar. A message should appear, "1 item(s) added to your cart." - Click the "Add to cart" button again. You should see the message "No item was added to your cart (already in your cart)!" - Uncheck all check boxes on the search results page and click "Add to cart." You should see "No item was selected." - Add more items to your cart so that it contains more than one item. - Click the "Cart" link to open it. - Click the "Empty and close" button. You should be asked to confirm, "Are you sure you want to empty your cart?" 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/basket.js for translation, e.g.: 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 - 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 <david@davidnind.com>
Created attachment 111665 [details] [review] Bug 26439: Move cart-related strings out of js_includes.inc and into basket.js This patch moves strings defined for translation in js_includes.inc into basket.js for translation using the new double-underscore i81n function. To test, apply the patch and perform a catalog search in the staff client. - Click the Cart link in the header menu. A pop-up should appear saying "Your cart is currently empty." - On the search results page, click the "Add to cart" link next to any search result. The text should change to "In your cart." - Click the "Remove" link. The text should change to "Add to cart." - Check the box next to a title in the search results and click the "Add to cart" button in the search results toolbar. A message should appear, "1 item(s) added to your cart." - Click the "Add to cart" button again. You should see the message "No item was added to your cart (already in your cart)!" - Uncheck all check boxes on the search results page and click "Add to cart." You should see "No item was selected." - Add more items to your cart so that it contains more than one item. - Click the "Cart" link to open it. - Click the "Empty and close" button. You should be asked to confirm, "Are you sure you want to empty your cart?" 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/basket.js for translation, e.g.: 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 - 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 <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
There are still occurrences: koha-tmpl/intranet-tmpl/prog/js/cart.js: alert(MSG_NO_RECORD_SELECTED); koha-tmpl/intranet-tmpl/prog/js/cart.js: alert(MSG_NO_RECORD_SELECTED); koha-tmpl/intranet-tmpl/prog/js/cart.js: alert(MSG_NO_RECORD_SELECTED); (Same at the OPAC btw)
Created attachment 111729 [details] [review] Bug 26439: (QA follow-up) Correct MSG instances in cart.js To test, add some items to the cart in the staff interface and open the cart window. Test the "Selected items" links (Remove, add to list, etc.) without checking any checkboxes. You should get an alert, "No item was selected."
Pushed to master for 20.11, thanks to everybody involved!
enhancement will not be backported to 20.05.x