var MSG_CONFIRM_AGAIN = _("Warning: Cannot be undone. Please confirm once again")
var MSG_DELETE_SEARCH_HISTORY = _("Are you sure you want to delete your search history?");
var MSG_NO_SUGGESTION_SELECTED = _("No suggestion was selected");
+ var MSG_SEARCHING = _("Searching %s...");
+ var MSG_ERROR_SEARCHING_COLLECTION = _("Error searching %s collection");
+ var MSG_NO_RESULTS_FOUND_IN_COLLECTION = _("No results found in the library's %s collection");
+ var MSG_RESULTS_FOUND_IN_COLLECTION = _("Found %s results in the library's %s collection");
+ var MSG_BY = _("by");
+ var MSG_TYPE = _("Type");
+ var MSG_NEXT = _("Next");
+ var MSG_PREVIOUS = _("Previous");
+ var MSG_CHECKOUTS = _("Checkouts");
+ var MSG_NO_CHECKOUTS = _("No checkouts");
+ var MSG_CHECK_OUT = _("Check out");
+ var MSG_CHECK_OUT_CONFIRM = _("Are you sure you want to checkout this item?");
+ var MSG_CHECKED_OUT_UNTIL = _("Checked out until %s");
+ var MSG_CHECK_IN = _("Check in");
+ var MSG_CHECK_IN_CONFIRM = _("Are you sure you want to return this item?");
+ var MSG_NO_CHECKOUTS = _("No checkouts");
+ var MSG_DOWNLOAD = _("Download");
+ var MSG_HOLDS = _("Holds");
+ var MSG_NO_HOLDS = _("No holds");
+ var MSG_PLACE_HOLD = _("Place hold");
+ var MSG_CANCEL_HOLD = _("Cancel");
+ var MSG_CANCEL_HOLD_CONFIRM = _("Are you sure you want to cancel this hold?");
+ var MSG_ON_HOLD = _("On hold");
[% IF Koha.Preference( 'opacbookbag' ) == 1 or Koha.Preference( 'virtualshelves' ) == 1 %]
var MSG_BASKET_EMPTY = _("Your cart is currently empty");
var MSG_RECORD_IN_BASKET = _("The item is already in your cart");
var results_per_page = [% OPACnumSearchResults || 20 %];
function search( page ) {
- $( '#recordedbooks-status' ).html( _("Searching RecordedBooks...") + ' <img class="throbber" src="[% interface %]/lib/jquery/plugins/themes/classic/throbber.gif" /></span>' );
+ $( '#recordedbooks-status' ).html( MSG_SEARCHING.format("RecordedBooks") + ' <img class="throbber" src="[% interface %]/lib/jquery/plugins/themes/classic/throbber.gif" /></span>' );
KOHA.RecordedBooks.search( querystring, results_per_page, page, function( data ) {
if ( data.error ) {
- $( '#recordedbooks-status' ).html( '<strong class="unavailable">' + _("Error searching RecordedBooks collection") + ': ' + data.error + '</strong>' );
+ $( '#recordedbooks-status' ).html( '<strong class="unavailable">' + MSG_ERROR_SEARCHING_COLLECTION.format("RecordedBooks") + ': ' + data.error + '</strong>' );
return;
}
if ( !data.total ) {
- $( '#recordedbooks-status' ).html( '<strong>' + _("No results found in the library's RecordedBooks collection.") + '</strong>' );
+ $( '#recordedbooks-status' ).html( '<strong>' + MSG_NO_RESULTS_FOUND_IN_COLLECTION.format("RecordedBooks") + '</strong>' );
return;
}
$( '#recordedbooks-results-list tbody' ).empty();
- $( '#recordedbooks-status' ).html( '<strong>' + _("Found") + ' ' + data.total + ' ' + _("results in the library's RecordedBooks collection.") + '</strong>' );
+ $( '#recordedbooks-status' ).html( '<strong>' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.total, "RecordedBooks") + '</strong>' );
for ( var i = 0; data.items[i]; i++ ) {
var prod = data.items[i];
results.push( prod.title );
if (prod.url) results.push( '</a>' );
results.push( '</span>' );
- results.push( '<p>' + _("by") + ' ', prod.author, '</p>' );
+ results.push( '<p>' + MSG_BY + ' ', prod.author, '</p>' );
if (prod.description) results.push( '<p>' + prod.description, '</p>' );
- results.push( '<span class="results_summary mediatype"><span class="label">' + _("Type:") + ' </span>', prod.media, '</span>' );
+ results.push( '<span class="results_summary mediatype"><span class="label">' + MSG_TYPE + ': </span>', prod.media, '</span>' );
results.push( '</td>' );
if (data.total == page*results_per_page) max_page++;
if ( page != 1 ) {
- pages.push( '<li><a class="od-nav" href="#" data-page="' + (page - 1) + '">« ' + _("Previous") + '</a></li>' );
+ pages.push( '<li><a class="od-nav" href="#" data-page="' + (page - 1) + '">« ' + MSG_PREVIOUS + '</a></li>' );
}
for ( var p = Math.max( 0, page - 9 ); p <= Math.min( max_page, p + 9 ); p++ ) {
}
if ( page < max_page ) {
- pages.push( ' <li><a class="od-nav" href="#" data-page="' + (page + 1) + '">' + _("Next") + ' »</a></li>' );
+ pages.push( ' <li><a class="od-nav" href="#" data-page="' + (page + 1) + '">' + MSG_NEXT + ' »</a></li>' );
}
if ( pages.length > 1 ) $( '#top-pages, #bottom-pages' ).find( '.pagination' ).html( '<ul>' + pages.join( '' ) + '</ul>');
}
if (data.checkouts) {
- var checkouts_div = $('<div class="recordedbooks-div">').html('<h3>' + _("Checkouts") + '</h3>');
+ var checkouts_div = $('<div class="recordedbooks-div">').html('<h3>' + MSG_CHECKOUTS + '</h3>');
var items = data.checkouts.items;
var checkouts_list;
if (items.length == 0) {
- checkouts_list = _("No checkouts");
+ checkouts_list = MSG_NO_CHECKOUTS;
} else {
checkouts_list = $('<ul class="recordedbooks-list">');
data.checkouts.items.forEach(function(item) {
}
if (data.holds) {
- var holds_div = $('<div class="recordedbooks-div">').html('<h3>' + _("Holds") + '</h3>');
+ var holds_div = $('<div class="recordedbooks-div">').html('<h3>' + MSG_HOLDS + '</h3>');
var items = data.holds.items;
var holds_list;
if (items.length == 0) {
- holds_list = _("No holds");
+ holds_list = MSG_NO_HOLDS;
} else {
holds_list = $('<ul class="recordedbooks-list">');
data.holds.items.forEach(function(item) {
if (item) {
var expires = new Date(item.expires);
$('<span class="recordedbooks-item-status">')
- .text(_("Checked out until") + " " + expires.toLocaleString())
+ .text(MSG_CHECKED_OUT_UNTIL.format(expires.toLocaleString()))
.appendTo(el);
$(el).append(" ");
if (item.url) {
var download = $('<a href="'+item.url+'">').appendTo(el);
- decorate_button(download, _("Download"));
+ decorate_button(download, MSG_DOWNLOAD);
$(el).append(" ");
}
- $(el).append( ajax_button(_("Check in"), function() {
- if( confirm(_("Are you sure you want to return this item?")) ) {
+ $(el).append( ajax_button(MSG_CHECK_IN, function() {
+ if( confirm(MSG_CHECK_IN_CONFIRM) ) {
item_action({action: "return", isbn: isbn}, el);
}
}) );
item = item_is_on_hold(isbn);
if (item) {
$('<span class="recordedbooks-status">')
- .text(_("On hold"))
+ .text(MSG_ON_HOLD)
.appendTo(el);
$(el).append(" ");
}
if(checkout_popup) {
- $(el).append( ajax_button(_("Check out"), function() {
- if( confirm(_("Are you sure you want to checkout this item?")) ) {
+ $(el).append( ajax_button(MSG_CHECK_OUT, function() {
+ if( confirm(MSG_CHECK_OUT_CONFIRM) ) {
svc_ajax('post', {action: "checkout", isbn: isbn}, function(data) {
if (data.checkouts) {
details.checkouts = data.checkouts;
}) );
}
if (!item) {
- $(el).append( ajax_button(_("Place hold"), function() {
+ $(el).append( ajax_button(MSG_PLACE_HOLD, function() {
item_action({action: "place_hold", isbn: isbn}, el);
}) );
}
if (item) {
- $(el).append( ajax_button(_("Cancel"), function() {
- if( confirm(_("Are you sure you want to cancel this hold?")) ) {
+ $(el).append( ajax_button(MSG_CANCEL_HOLD, function() {
+ if( confirm(MSG_CANCEL_HOLD_CONFIRM) ) {
item_action({action: "remove_hold", isbn: isbn}, el);
}
}) );