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 <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 573d2a3ba8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Katrin Fischer 2023-12-10 16:56:29 +00:00 committed by Fridolin Somers
parent b7db87ea7e
commit ff9fe04792
3 changed files with 16 additions and 16 deletions

View file

@ -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,

View file

@ -28,6 +28,6 @@ $("#cancelBookingForm").on('submit', function(e) {
});
deleting.fail(function(data) {
$('#cancel_booking_result').replaceWith('<div id="booking_result" class="alert alert-danger">Failure</div>');
$('#cancel_booking_result').replaceWith('<div id="booking_result" class="alert alert-danger">'+_("Failure")+'</div>');
});
});

View file

@ -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('<div id="booking_result" class="alert alert-danger">Failure</div>');
$('#booking_result').replaceWith('<div id="booking_result" class="alert alert-danger">'+_("Failure")+'</div>');
});
} else {
url += '/' + booking_id;
@ -545,7 +545,7 @@ $("#placeBookingForm").on('submit', function(e) {
});
putting.fail(function(data) {
$('#booking_result').replaceWith('<div id="booking_result" class="alert alert-danger">Failure</div>');
$('#booking_result').replaceWith('<div id="booking_result" class="alert alert-danger">'+__("Failure")+'</div>');
});
}
});