var countdeletedorders = [% countdeletedorders %];
var is_confirmed;
if (count > 0){
- is_confirmed = alert( count + " " +_("item(s) are attached to this record. You must delete all items before deleting this record.") );
+ is_confirmed = alert( _("%s item(s) are attached to this record. You must delete all items before deleting this record.").format(count) );
}
else if (countorders > 0){
[% IF ( CAN_user_acquisition_order_manage ) %]
- is_confirmed = confirm( _("Warning: This record is used in")+" "+ countorders + " " +_("order(s). Deleting it could cause serious issues on acquisition module. Are you sure you want to delete this record?") );
+ is_confirmed = confirm( _("Warning: This record is used in %s order(s). Deleting it could cause serious issues on acquisition module. Are you sure you want to delete this record?").format(countorders) );
[% ELSE %]
- is_confirmed = alert( countorders + " " +_("order(s) are using this record. You need order managing permissions to delete this record.") );
+ is_confirmed = alert( _("%s order(s) are using this record. You need order managing permissions to delete this record.").format(countorders) );
[% END %]
}
else if (countdeletedorders > 0){
[% IF ( CAN_user_acquisition_order_manage ) %]
- is_confirmed = confirm( countdeletedorders + " " +_("deleted order(s) are using this record. Are you sure you want to delete this record?") );
+ is_confirmed = confirm( _("%s deleted order(s) are using this record. Are you sure you want to delete this record?").format(countdeletedorders) );
[% ELSE %]
- is_confirmed = alert( countdeletedorders + " " +_("deleted order(s) are using this record. You need order managing permissions to delete this record.") );
+ is_confirmed = alert( _("%s deleted order(s) are using this record. You need order managing permissions to delete this record.").format(countdeletedorders) );
[% END %]
}
else if ( holdcount > 0 ) {
- is_confirmed = confirm( holdcount + " " + _("holds(s) for this record. Are you sure you want to delete this record?"));
+ is_confirmed = confirm( _("%s holds(s) for this record. Are you sure you want to delete this record?").format(holdcount) );
} else {
is_confirmed = confirm(_("Are you sure you want to delete this record?"));
}
var holdcount = [% holdcount %];
if ( holdcount > 0 ) {
- alert( holdcount + " " + _("hold(s) on this record. You must delete all holds before deleting all items.") );
+ alert( _("%s hold(s) on this record. You must delete all holds before deleting all items.").format(holdcount) );
} else if ( count > 0 ) {
- if( confirm( _("Are you sure you want to delete the") + " " + count + " " + _("attached items?") ) ) {
+ if( confirm( _("Are you sure you want to delete the %s attached items?").format(count) ) ) {
window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&biblionumber=[% biblionumber %]";
} else {
return false;
function _(s) { return s; } // dummy function for gettext
+// http://stackoverflow.com/questions/1038746/equivalent-of-string-format-in-jquery/5341855#5341855
+String.prototype.format = function() { return formatstr(this, arguments) }
+function formatstr(str, col) {
+ col = typeof col === 'object' ? col : Array.prototype.slice.call(arguments, 1);
+ var idx = 0;
+ return str.replace(/%%|%s|%(\d+)\$s/g, function (m, n) {
+ if (m == "%%") { return "%"; }
+ if (m == "%s") { return col[idx++]; }
+ return col[n];
+ });
+};
+
+
// http://stackoverflow.com/questions/14859281/select-tab-by-name-in-jquery-ui-1-10-0/16550804#16550804
$.fn.tabIndex = function () {
return $(this).parent().find(this).index() - 1;
if (total_errors > 0) {
var alertString = _("Form not submitted because of the following problem(s)");
alertString += "\n------------------------------------------------------------------------------------\n";
- alertString += "\n- "+ total_errors + _(" mandatory fields empty (highlighted)");
+ alertString += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
alert(alertString);
return false;
}
function add_user(borrowernumber, borrowername) {
var p = window.opener;
if(p.add_basket_user(borrowernumber, borrowername) < 0) {
- alert(_("Borrower '" + borrowername + "' is already in the list."));
+ alert(_("Borrower '%s' is already in the list.").format(borrowername));
}
}
//]]>
});
$(".modal").on("show", function(){
var basket = $(this).data("basketno");
- var legend = _("Add order to basket") + " " + basket;
+ var legend = _("Add order to basket %s").format(basket);
$(this).find("legend").html(legend);
});
});
$('#merge_' + prop).val(invoice[prop]);
});
if (invoice.closedate) {
- $('#merge_status').text(_("Closed on " + invoice.closedate + ""));
+ $('#merge_status').text(_("Closed on %s").format(invoice.closedate));
} else {
$('#merge_status').text(_("Open"));
}
if (totalExceedsBudget(ff.budget_id.value, ff.total.value ) ) {
ok=1;
- _alertString += "\n- " + _("Order total (") + ff.total.value +
- _(") exceeds budget available (") + actTotal+")";
+ _alertString += "\n- " + _("Order total (%s) exceeds budget available (%s)").format(ff.total.value, actTotal);
}
if ( ff.field_value ) {
if (empty_item_mandatory > 0) {
ok = 1;
_alertString +=
- "\n- " + empty_item_mandatory + _(" item mandatory fields empty");
+ "\n- " + _("%s item mandatory fields empty").format(empty_item_mandatory);
}
}
if (total_errors != 0) {
var alertString = _("Form not submitted because of the following problem(s)");
alertString += "\n------------------------------------------------------------------------------------\n";
- alertString += "\n- "+ total_errors+_(" mandatory fields empty (highlighted)");
+ alertString += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
alert(alertString);
return false;
}
return false;
}
else if(page < 1 || page > [% total_pages %] ) {
- alert(_("The page should be a number between 1 and ") + [% total_pages %] + ".");
+ alert(_("The page should be a number between 1 and %s.").format([% total_pages %]));
return false;
}
else {
var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search);
if (matches && matches.length > 1) {
- alert(_("Error importing the framework ") + decodeURIComponent(matches[1]));
+ alert(_("Error importing the framework %s").format(decodeURIComponent(matches[1])));
}
$('input.input_import').change( function() {
if (/(?:\.csv|\.ods|\.xml)$/.test(obj.val())) {
if (confirm(_("Do you really want to import the framework fields and subfields? This will overwrite the current configuration. For safety reasons please use the export option to make a backup"))) {
var frameworkcode = $('#' + id + ' input:hidden[name=frameworkcode]').val();
- $('#importing_' + frameworkcode).find("span").html(_("Importing to framework:")+"<strong>" + frameworkcode + "</strong>. " +_("Importing from file:")+"<i>" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + "</i>");
+ $('#importing_' + frameworkcode).find("span").html(_("Importing to framework: %s. Importing from file: %s").format("<strong>" + frameworkcode + "</strong>", "<i>" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + "</i>"));
if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
var timestamp = new Date().getTime();
$('#importing_' + frameworkcode).find("img").attr('src', '[% interface %]/[% theme %]/img/loading-small.gif' + '?' +timestamp);
var blocked = _("Blocked!");
var saving = _("Saving...");
var disabledForAll = _("Disabled for all");
- var disabledForCurrent = _("Disabled for") + ' ' + $branch;
+ var disabledForCurrent = _("Disabled for %s").format($branch);
$('#branch_selector input:submit').hide();
$('#branch').change(function(){
// alert (id_string);
if( ! $("#" + id_string).val() ){
$("#" + id_string).attr('class','subfield_not_filled').focus();
- StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n";
+ StrAlert += "\t* " + _("%s in tab %s").format(label[i], tab[i]) + "\n";
}
}
if(isempty){
flag = 1;
- StrAlert += "\t* Field " + arr[0] + _(" is mandatory, at least one of its subfields must be filled") + "\n";
+ StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
}
}
if (tabflag[tagsubfieldid][0]==0){
var tag=tagsubfieldid.substr(0,3);
var subfield=tagsubfieldid.substr(3,1);
- StrAlert += "\t* "+_("tag ")+tag+_(" subfield ")+subfield+" "+tabflag[tagsubfieldid][1]+_(" in tab ")+tabflag[tagsubfieldid][2]+"\n";
+ StrAlert += "\t* "+_("tag %s subfield %s %s in tab %s").format(tag, subfield, tabflag[tagsubfieldid][1], tabflag[tagsubfieldid][2]) + "\n";
//StrAlert += "\t* "+label[i]+_(" in tab ")+tab[i]+"\n";
flag=1;
}
if(isempty){
flag = 1;
- StrAlert += _("\t* Field ") + arr[0] + _(" is mandatory, at least one of its subfields must be filled.") + "\n";
+ StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
}
}
if (total_errors > 0) {
var alertString2 = _("Form not submitted because of the following problem(s)");
alertString2 += "\n------------------------------------------------------------------------------------\n";
- alertString2 += "\n- "+ total_errors + _(" mandatory fields empty (highlighted)");
+ alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
alert(alertString2);
return false;
}
function changeTypeofMaterial(form)
{
- if (form.material_type.options[form.material_type.selectedIndex].value != "" && confirm(_("Show values for") +' \'' + form.material_type.options[form.material_type.selectedIndex].text + '\' ' +_("material type?"))) {
+ if (form.material_type.options[form.material_type.selectedIndex].value != "" && confirm(_("Show values for '%s' material type?").format(form.material_type.options[form.material_type.selectedIndex].text))) {
objXmlControlField.setIdMaterial(form.material_type.options[form.material_type.selectedIndex].value);
objXmlControlField.renderTemplate();
renderResult(tr_result, form.result.value, true);
function changeTypeofMaterial(form)
{
- if (form.material_type.options[form.material_type.selectedIndex].value != "" && confirm(_("Show values for") + ' \'' + form.material_type.options[form.material_type.selectedIndex].text + '\' ' + _("material type?"))) {
+ if (form.material_type.options[form.material_type.selectedIndex].value != "" && confirm(_("Show values for '%s' material type?").format(form.material_type.options[form.material_type.selectedIndex].text))) {
objXmlControlField.setIdMaterial(form.material_type.options[form.material_type.selectedIndex].value);
objXmlControlField.renderTemplate();
renderResult(tr_result, form.result.value, true);
return false;
}
else if(page < 1 || page > [% total_pages %] ) {
- alert(_("The page should be a number between 1 and ") + [% total_pages %] + ".");
+ alert(_("The page should be a number between 1 and %s.").format([% total_pages %]));
return false;
}
else {
return false;
}
else if(page < 1 || page > [% total_pages %] ) {
- alert(_("The page should be a number between 1 and ") + [% total_pages %] + ".");
+ alert(_("The page should be a number between 1 and %s.").format([% total_pages %]));
return false;
}
else {
}).done(function (data) {
if (data) {
$('.loading-overlay').hide();
- alert(_("Please log in to Koha and try again. (Error: '" + data + "')"));
+ alert(_("Please log in to Koha and try again. (Error: '%s')").format(data));
} else {
var uploadIter = $.indexedDB("koha").objectStore("transactions").each(uploadTransaction);
uploadIter.done(function() {
function loadRecords(page) {
[% IF (AllowOfflineCirculation) %]
- $(".loading-overlay div").text(_("Loading page " + page + ", please wait..."));
+ $(".loading-overlay div").text(_("Loading page %s, please wait...").format(page));
$(".loading-overlay").show();
$.ajax({
type: "GET",
if (patron.name.length > 0) {
$('.patron-title').text(patron.name);
} else {
- $('.patron-title').text(_("Unrecognized patron") + " (" + barcode + ")");
+ $('.patron-title').text(_("Unrecognized patron (%s)").format(barcode));
}
if (patron.address.length > 0 || patron.address2.length > 0) {
$('#patron-address-1').text(patron.address);
$('#patron-email').html('<span class="empty" id="noemailstored">' + _("No email stored.") + '</span></li>');
}
if (patron.categorycode.length > 0) {
- $('#patron-category').text(_("Category: ") + patron.categorycode);
+ $('#patron-category').text(_("Category: %s").format(patron.categorycode));
} else {
$('#patron-category').html('<span class="empty" id="unknowncategory">' + _("Category code unknown.") + '</span></li>');
}
if (patron.branchcode.length > 0) {
- $('#patron-library').text(_("Home library: ") + patron.branchcode);
+ $('#patron-library').text(_("Home library: %s").format(patron.branchcode));
} else {
$('#patron-library').html('<span class="empty" id="unknowncategory">' + _("Home library unknown.") + '</span></li>');
}
function DeleteConfirm() {
var element_id = selected_layout("delete");
if (element_id>-1) {
- var msg = "Are you sure you want to delete [% label_element %] " + element_id + "?"
+ var msg = _("Are you sure you want to delete %s %s?").format("[% label_element %]", element_id);
var answer = confirm(msg);
if (answer) {
window.location = "/cgi-bin/koha/labels/label-manage.pl?op=delete&label_element=[% label_element %]&element_id=" + element_id;
return(document.layouts.action[selected[0]].value);
}
else {
- alert(_("Please select only one ")+"[% label_element %]"+_(" to")+op+".");
+ alert(_("Please select only one %s to %s.").format("[% label_element %]", op));
return (-1);
}
}
return(document.layouts.action.value);
}
};
- alert(_("Please select a ")+"[% label_element %].");
+ alert(_("Please select a %s.").format("[% label_element %]"));
return (-1);
};
//]]>
$(document).ready(function(){
$('#pay-fines-form').preventDoubleFormSubmit();
$("#woall").click(function(event){
- var msg = _("Are you sure you want to write off %s in outstanding fines? This cannot be undone!");
- msg = msg.replace( "%s", "[% total | format('%.2f') %]" );
+ var msg = _("Are you sure you want to write off %s in outstanding fines? This cannot be undone!").format( "[% total | format('%.2f') %]" );
var answer = confirm(msg);
if (!answer){
event.preventDefault();
});
function ConfirmDelete( list ) {
- return confirm( _("Are you sure you want to delete the list ") + list + "?" );
+ return confirm( _("Are you sure you want to delete the list %s?").format(list) );
}
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
function DeleteConfirm() {
- var msg = _("Are you sure you want to delete batch") + " [% batch_id %]?";
+ var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id %]");
var answer = confirm(msg);
if (answer) {
window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=batch&element_id=[% batch_id %]";
}
getstr = items.join("&");
item_msg = item_num.join(", ");
- var msg = "Are you sure you want to remove card number(s): " + item_msg + " from this batch?"
+ var msg = _("Are you sure you want to remove card number(s): %s from this batch?").format(item_msg);
}
else {
alert(_("Please select at least label to delete."));
function DeleteConfirm() {
var results = selected_images("delete");
if (results.images != -1) {
- var msg = "Are you sure you want to delete image(s): " + results.image_ids + "?";
+ var msg = _("Are you sure you want to delete image(s): %s?").format(results.image_ids);
var answer = confirm(msg);
if (answer) {
window.location = "/cgi-bin/koha/patroncards/image-manage.pl?op=delete&" + results.images;
else if (document.delete_images.action.checked){
return {images:"batch_id="+document.delete_images.action.value, image_ids:document.delete_images.action.value};
};
- alert(_("Please select image(s) to ") + op + ".");
+ alert(_("Please select image(s) to %s.").format(op));
return (-1);
};
$(document).ready(function() {
function DeleteConfirm() {
var element_id = selected_layout("delete");
if (element_id>-1) {
- var msg = _("Are you sure you want to delete") + " [% card_element %] " + element_id + "?"
+ var msg = _("Are you sure you want to delete %s %s?").format("[% card_element %]", element_id);
var answer = confirm(msg);
if (answer) {
window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=[% card_element %]&element_id=" + element_id;
return(document.layouts.action[selected[0]].value);
}
else {
- alert(_("Please select only one ")+"[% card_element %]"+_(" to ") + op + ".");
+ alert(_("Please select only one %s to %s.").format("[% card_element %]", op));
return (-1);
}
}
return(document.layouts.action.value);
}
};
- alert(_("Please select a ")+"[% card_element %].");
+ alert(_("Please select a %s.").format("[% card_element %]"));
return (-1);
};
switch (override_items[itemnumber].holdallowed) {
case 0: msg = _("This item normally cannot be put on hold."); break;
- case 1: msg = _("This item normally cannot be put on hold except for patrons from ") + override_items[itemnumber].homebranch + "."; break;
+ case 1: msg = _("This item normally cannot be put on hold except for patrons from %s.").format(override_items[itemnumber].homebranch); break;
}
msg += "\n\n" + _("Place hold on this item?");
if ( total_errors > 0 ) {
var mes = _("Form not submitted because of the following problem(s)");
mes += "\n------------------------------------------------------------------------------------\n";
- mes += "\n- " + total_errors + _(" mandatory fields empty (highlighted)");
+ mes += "\n- " _("%s mandatory fields empty (highlighted)").format(total_errors);
alert(mes);
return false;
}
[% END %]
if(error){
- alert(_("Cannot test prediction pattern for the following reason(s):") + "\n\n"
- + error_msg);
+ alert(_("Cannot test prediction pattern for the following reason(s): %s").format(error_msg));
return false;
}
var cnfrm = 1;
if(found){
var msg = _("This pattern name already exists. Do you want to modify it?")
- + "\n" + _("Warning: it will modify the pattern for all subscriptions")
- + _("that are using it.");
+ + "\n" + _("Warning: it will modify the pattern for all subscriptions that are using it.");
cnfrm = confirm(msg);
}
// window.alert(_("AJAX approved tag: ") + tag);
};
var failure_approve = function(tag){
- window.alert(_("AJAX failed to approve tag: ") + tag);
+ window.alert(_("AJAX failed to approve tag: %s").format(tag));
};
var success_reject = function(tag){
// window.alert(_("AJAX rejected tag: ") + tag);
};
var failure_reject = function(tag){
- window.alert(_("AJAX failed to reject tag: ") + tag);
+ window.alert(_("AJAX failed to reject tag: %s").format(tag));
};
var success_test = function(tag){
- $('#verdict').html(tag + _(" is permitted!"));
+ $('#verdict').html(_("%s is permitted!").format(tag));
};
var failure_test = function(tag){
- $('#verdict').html(tag + _(" is prohibited!"));
+ $('#verdict').html(_("%s is prohibited!").format(tag));
};
var indeterminate_test = function(tag){
- $('#verdict').html(tag + _(" is neither permitted nor prohibited!"));
+ $('#verdict').html(_("%s is neither permitted nor prohibited!").format(tag));
};
var success_test_call = function() {
}
});
$("*").ajaxError(function(evt, request, settings){
- if ((alerted +=1) <= 1){ window.alert(_("AJAX error")+" (" + alerted + " alert)"); }
+ if ((alerted +=1) <= 1){ window.alert(_("AJAX error (%s alert)").format(alerted)); }
});
$("#tagst").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
var dayMonth = month + '/' + day;
var dateString = year + '/' + month + '/' + day;
if (exception_holidays[dateString] != null) {
- return [true, "exception", _("Exception") + ": "+exception_holidays[dateString].title];
+ return [true, "exception", _("Exception: %s").format(exception_holidays[dateString].title)];
} else if ( week_days[weekDay] != null ){
- return [true, "repeatableweekly", _("Weekly holiday") + ": "+week_days[weekDay].title];
+ return [true, "repeatableweekly", _("Weekly holiday: %s").format(week_days[weekDay].title)];
} else if ( day_month_holidays[dayMonth] != null ) {
- return [true, "repeatableyearly", _("Yearly holiday") + ": "+day_month_holidays[dayMonth].title];
+ return [true, "repeatableyearly", _("Yearly holiday: %s").format(day_month_holidays[dayMonth].title)];
} else if (holidays[dateString] != null) {
- return [true, "holiday", _("Single holiday") + ": "+holidays[dateString].title];
+ return [true, "holiday", _("Single holiday: %s").format(holidays[dateString].title)];
} else {
return [true, "normalday", _("Normal day")];
}
);
if ( aData['match_id'] ) {
+ [% IF ( record_type == 'auth' ) -%]
+ var matching_msg = _("Matches authority %s (score=%s):%s");
+ [%- ELSE -%]
+ var matching_msg = _("Matches biblio %s (score=%s):%s");
+ [%- END %]
$('td:eq(4)', nRow).html(
- [% IF ( record_type == 'auth' ) -%]
- _("Matches authority ")
- [%- ELSE -%]
- _("Matches biblio ")
- [%- END %]
- + aData['match_id']
- + " (" + _("score") + "="
- + aData['score']
- + '):' + '<a target="_blank" href="' + record_details_url
- + aData['match_id'] + '">' + aData['match_citation'] + '</a>'
+ matching_msg.format(aData['match_id'], aData['score'],
+ '<a target="_blank" href="' + record_details_url
+ + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
);
}
var information_category_node = $(select_attr).parent().parent().find('span.information_category');
information_category_node.html("");
if ( category.length > 0 ) {
- information_category_node.html(_("This attribute will be only applied to the patron's category") +' "' + category + '"');
+ information_category_node.html(_("This attribute will be only applied to the patron's category %s").format(category));
}
if ( type == 'select' ) {
var options = '<option value = ""></option>';
var fileSizeInK = Math.round(evt.target.files[0].size/1024);
if (!fileType.match(/comma-separated-values|csv|excel/i)) {
- alert(_("Uploads limited to csv. Incorrect filetype: ")+fileType);
+ alert(_("Uploads limited to csv. Incorrect filetype: %s").format(fileType));
parent.location='quotes-upload.pl';
return;
}
if (fileSizeInK > 512) {
- if (!confirm(evt.target.files[0].name+' '+fileSizeInK+_(" KB Do you really want to upload this file?"))) {
+ if (!confirm(_("%s %s KB Do you really want to upload this file?").format(evt.target.files[0].name, fileSizeInK))) {
parent.location='quotes-upload.pl';
return;
}
success : function(){
var response = JSON.parse(jqXHR.responseText);
if (response.success) {
- alert(response.records+_(" quotes saved."));
+ alert(_("%s quotes saved.").format(response.records));
window.location.reload(true); // is this the best route?
}
else {
- alert(response.records+_(" quotes saved, but an error has occurred. Please ask your administrator to check the server log for more details."));
+ alert(_("%s quotes saved, but an error has occurred. Please ask your administrator to check the server log for more details.").format(response.records));
window.location.reload(true); // is this the best route?
}
},
if (!idsToDelete) {
alert(_("Please select a quote(s) by clicking the quote id(s) you desire to delete."));
}
- else if (confirm(_("Are you sure you wish to delete quote(s) ")+idsToDelete+"?")) {
+ else if (confirm(_("Are you sure you wish to delete quote(s) %s?").format(idsToDelete))) {
oTable.$('.selected').each(function(){
oTable.fnDeleteRow(this);
});
if (!idsToDelete) {
alert(_("Please select a quote(s) by clicking the quote id(s) you desire to delete."));
}
- else if (confirm(_("Are you sure you wish to delete quote(s) ")+idsToDelete+"?")) {
+ else if (confirm(_("Are you sure you wish to delete quote(s) %s?").format(idsToDelete))) {
oTable.$('.selected').each(function(){
var quoteID = $(this).attr('id');
$.ajax({