From ff9fe047927f149838e53b5ea522ead7792eb143 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Sun, 10 Dec 2023 16:56:29 +0000 Subject: [PATCH] Bug 35475: Makes strings in booking JS file translatable This makes several strings in the booking specific JS file translatable. To test: * Make an item bookable: * Find a record with items in your catalog or create one * From the details page, switch to the items tab * Mark items as bookable * Add a booking, verify the modal works as expected * Check the bookings tab * Verify the column headings of the bookings table show correctly * Verify the "Biblio level" and "Item" in the calendar show Note: Months don't translate, this will be a separate bug * Cancel a booking, edit a booking... make sure everything works as expected * If you can: Install a translation and verify strings show up in po files as expected Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit 573d2a3ba86aa0e805975a4d224d341b775eaebd) Signed-off-by: Fridolin Somers --- .../prog/en/modules/bookings/list.tt | 18 +++++++++--------- .../prog/js/cancel_booking_modal.js | 2 +- .../prog/js/place_booking_modal.js | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt index 6e0cb5e4f4..b72459c5f7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt @@ -85,12 +85,12 @@ function(items, bookings){ var itemsSet = new vis.DataSet([{ id: 0, - content: "Biblio level" + content: _("Biblio level") }]); for (item of items[0]) { itemsSet.add({ id: item.item_id, - content: "Item " + item.external_id, + content: _("Item") + " " + item.external_id, }); } @@ -201,15 +201,15 @@ ], "columns": [{ "data": "booking_id", - "title": "Booking ID", + "title": _("Booking ID"), "visible": false }, { "data": "item.external_id", - "title": "Item", + "title": _("Item"), "searchable": true, "orderable": true, - "defaultContent": "Any item", + "defaultContent": _("Any item"), "render": function(data,type,row,meta) { if ( row.item ) { return row.item.external_id + " (" + row.booking_id + ")"; @@ -220,7 +220,7 @@ }, { "data": "patron.firstname:patron.surname", - "title": "Patron", + "title": _("Patron"), "searchable": true, "orderable": true, "render": function(data, type, row, meta) { @@ -232,7 +232,7 @@ }, { "data": "start_date", - "title": "Start date", + "title": _("Start date"), "searchable": true, "orderable": true, "render": function(data, type, row, meta) { @@ -241,7 +241,7 @@ }, { "data": "end_date", - "title": "End date", + "title": _("End date"), "searchable": true, "orderable": true, "render": function(data, type, row, meta) { @@ -250,7 +250,7 @@ }, { "data": "", - "title": "Actions", + "title": _("Actions"), "class": "actions", "searchable": false, "orderable": false, diff --git a/koha-tmpl/intranet-tmpl/prog/js/cancel_booking_modal.js b/koha-tmpl/intranet-tmpl/prog/js/cancel_booking_modal.js index 4090ed853c..4f993869ab 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cancel_booking_modal.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cancel_booking_modal.js @@ -28,6 +28,6 @@ $("#cancelBookingForm").on('submit', function(e) { }); deleting.fail(function(data) { - $('#cancel_booking_result').replaceWith('
Failure
'); + $('#cancel_booking_result').replaceWith('
'+_("Failure")+'
'); }); }); diff --git a/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js b/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js index 4cf49eb0da..9f35cd3a64 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js +++ b/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js @@ -16,10 +16,10 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { // Get booking id if this is an edit booking_id = button.data('booking'); if (booking_id) { - $('#placeBookingLabel').html('Edit booking'); + $('#placeBookingLabel').html(__("Edit booking")); $('#booking_id').val(booking_id); } else { - $('#placeBookingLabel').html('Place booking'); + $('#placeBookingLabel').html(__("Place booking")); // Ensure we don't accidentally update a booking $('#booking_id').val(''); } @@ -103,7 +103,7 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { escape_str(patron.surname) + ", " + escape_str(patron.firstname) ); }, - placeholder: "Search for a patron" + placeholder: __("Search for a patron") }); $('#booking_patron_id').on('select2:select', function (e) { @@ -164,7 +164,7 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { width: '50%', dropdownAutoWidth: true, minimumResultsForSearch: 20, - placeholder: "Select item" + placeholder: __("Select item") }); // Update flatpickr mode @@ -494,7 +494,7 @@ $("#placeBookingForm").on('submit', function(e) { }); posting.fail(function(data) { - $('#booking_result').replaceWith('
Failure
'); + $('#booking_result').replaceWith('
'+_("Failure")+'
'); }); } else { url += '/' + booking_id; @@ -545,7 +545,7 @@ $("#placeBookingForm").on('submit', function(e) { }); putting.fail(function(data) { - $('#booking_result').replaceWith('
Failure
'); + $('#booking_result').replaceWith('
'+__("Failure")+'
'); }); } }); -- 2.39.5