Bugzilla – Attachment 28733 Details for
Bug 12150
Use more placeholders in translatable javascript strings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 12150 - Use more javascript string formatting in intranet for translated strings.
SIGNED-OFF-Bug-12150---Use-more-javascript-string-.patch (text/plain), 18.77 KB, created by
Bernardo Gonzalez Kriegel
on 2014-06-09 12:51:52 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 12150 - Use more javascript string formatting in intranet for translated strings.
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2014-06-09 12:51:52 UTC
Size:
18.77 KB
patch
obsolete
>From 554e73b397efa6c57e7e7d096bd9c287573e9a81 Mon Sep 17 00:00:00 2001 >From: Pasi Kallinen <pasi.kallinen@pttk.fi> >Date: Mon, 28 Apr 2014 08:27:38 +0300 >Subject: [PATCH] [SIGNED-OFF] Bug 12150 - Use more javascript string > formatting in intranet for translated strings. > >http://bugs.koha-community.org/show_bug.cgi?id=12150 > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> > >No bug number on description >No commit message >No test plan >No koha-qa errors > >I only signed this because it's useful for translations >but we can live without it, so is up to QA now > >Tested some easy messages (e.g. syspref saving), and >updated PO files to check new strings. >Inspected the code, I think that there are no errors. >--- > .../prog/en/includes/doc-head-close.inc | 8 +++--- > .../prog/en/includes/merge-record-strings.inc | 3 +-- > koha-tmpl/intranet-tmpl/prog/en/js/basket.js | 11 ++++---- > koha-tmpl/intranet-tmpl/prog/en/js/datatables.js | 4 +-- > koha-tmpl/intranet-tmpl/prog/en/js/members.js | 8 +++--- > koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js | 2 +- > .../intranet-tmpl/prog/en/js/pages/preferences.js | 4 +-- > .../intranet-tmpl/prog/en/js/xmlControlfield.js | 2 +- > .../prog/en/modules/admin/preferences.tt | 2 +- > .../intranet-tmpl/prog/en/modules/circ/offline.tt | 28 ++++++++++---------- > .../prog/en/modules/members/memberentrygen.tt | 8 +++--- > .../modules/tools/marc_modification_templates.tt | 2 +- > 12 files changed, 41 insertions(+), 41 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >index 11f6f38..f6269de 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >@@ -36,13 +36,13 @@ > var MSG_BASKET_EMPTY = _("Your cart is currently empty"); > var MSG_RECORD_IN_BASKET = _("This item is already in your cart"); > var MSG_RECORD_ADDED = _("This item has been added to your cart"); >- var MSG_NRECORDS_ADDED = _(" item(s) added to your cart"); >- var MSG_NRECORDS_IN_BASKET = _("already in your cart"); >+ var MSG_NRECORDS_ADDED = _("%s item(s) added to your cart"); >+ var MSG_NRECORDS_IN_BASKET = _("%s already in your cart"); > var MSG_NO_RECORD_SELECTED = _("No item was selected"); >- var MSG_NO_RECORD_ADDED = _("No item was added to your cart"); >+ var MSG_NO_RECORD_ADDED = _("No item was added to your cart (already in your cart) !"); > var MSG_CONFIRM_DEL_BASKET = _("Are you sure you want to empty your cart?"); > var MSG_CONFIRM_DEL_RECORDS = _("Are you sure you want to remove the selected items?"); >- var MSG_IN_YOUR_CART = _("Items in your cart: "); >+ var MSG_IN_YOUR_CART = _("Items in your cart: %s"); > var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be reserved."); > //]]> > </script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record-strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record-strings.inc >index 822d4b5..6b04e54 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record-strings.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record-strings.inc >@@ -1,6 +1,5 @@ > [%# transletable strings for merge-record.js %] > <script type="text/javascript"> > var MSG_MERGEREC_ALREADY_EXISTS = _("The field is non-repeatable and already exists in the destination record. Therefore, you cannot add it."); >- var MSG_MERGEREC_SUBFIELD_PRE = _("This subfield cannot be added: there is no"); >- var MSG_MERGEREC_SUBFIELD_POST = _("field in the destination record."); >+ var MSG_MERGEREC_SUBFIELD = _("This subfield cannot be added: there is no %s field in the destination record."); > </script> >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/basket.js b/koha-tmpl/intranet-tmpl/prog/en/js/basket.js >index 6dd9c0d..4086385 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/basket.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/basket.js >@@ -184,10 +184,11 @@ function addSelRecords(valSel) { // function for adding a selection of biblios t > var msg = ""; > if (nbAdd) { > if (i > nbAdd) { >- msg = nbAdd+" "+MSG_NRECORDS_ADDED+", "+(i-nbAdd)+" "+MSG_NRECORDS_IN_BASKET; >+ msg = MSG_NRECORDS_ADDED.format(nbAdd); >+ msg += MSG_NRECORDS_IN_BASKET.format((i-nbAdd)); > } > else { >- msg = nbAdd+" "+MSG_NRECORDS_ADDED; >+ msg = MSG_NRECORDS_ADDED.format(nbAdd); > } > } > else { >@@ -195,7 +196,7 @@ function addSelRecords(valSel) { // function for adding a selection of biblios t > msg = MSG_NO_RECORD_SELECTED; > } > else { >- msg = MSG_NO_RECORD_ADDED+" ("+MSG_NRECORDS_IN_BASKET+") !"; >+ msg = MSG_NO_RECORD_ADDED; > } > } > showCartUpdate(msg); >@@ -378,10 +379,10 @@ function showLess() { > function updateBasket(updated_value,target) { > if(target){ > target.$('#basketcount').html(" <span>("+updated_value+")</span>"); >- target.$('#cartDetails').html(MSG_IN_YOUR_CART+updated_value); >+ target.$('#cartDetails').html(MSG_IN_YOUR_CART.format(updated_value)); > } else { > $('#basketcount').html(" <span>("+updated_value+")</span>"); >- $('#cartDetails').html(MSG_IN_YOUR_CART+updated_value); >+ $('#cartDetails').html(MSG_IN_YOUR_CART.format(updated_value)); > } > var basketcount = updated_value; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >index c3b882c..650e577 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >@@ -232,14 +232,14 @@ function replace_html( original_node, type ) { > replace_html_date( original_node, id, format ); > break; > default: >- alert("_(This node can't be replaced)"); >+ alert(_("This node can't be replaced")); > } > } > > // Replace a node with a "From [date] To [date]" element > // Used on tfoot > td > function replace_html_date( original_node, id, format ) { >- var node = $('<span style="white-space:nowrap">' + _("From") + '<input type="text" id="' + id + 'from" readonly="readonly" placeholder=\'' + _("Pick date") + '\' size="7" /><a title="Delete this filter" style="cursor:pointer" onclick=\'$("#' + id + 'from").val("").change();\' >×</a></span><br/><span style="white-space:nowrap">' + _("To") + '<input type="text" id="' + id + 'to" readonly="readonly" placeholder=\'' + _("Pick date") + '\' size="7" /><a title="Delete this filter" style="cursor:pointer" onclick=\'$("#' + id + 'to").val("").change();\' >×</a></span>'); >+ var node = $('<span style="white-space:nowrap">' + _("From") + '<input type="text" id="' + id + 'from" readonly="readonly" placeholder=\'' + _("Pick date") + '\' size="7" /><a title="' + _("Delete this filter") + '" style="cursor:pointer" onclick=\'$("#' + id + 'from").val("").change();\' >×</a></span><br/><span style="white-space:nowrap">' + _("To") + '<input type="text" id="' + id + 'to" readonly="readonly" placeholder=\'' + _("Pick date") + '\' size="7" /><a title="' + _("Delete this filter") + '" style="cursor:pointer" onclick=\'$("#' + id + 'to").val("").change();\' >×</a></span>'); > $(original_node).replaceWith(node); > var script = document.createElement( 'script' ); > script.type = 'text/javascript'; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/members.js b/koha-tmpl/intranet-tmpl/prog/en/js/members.js >index d7c2947..44ea578 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/members.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/members.js >@@ -8,7 +8,7 @@ if (d!=="") { > var ok=1; > var msg; > if ( (date.length < 2) && (ok==1) ) { >- msg = MSG_SEPARATOR+field.name; >+ msg = MSG_SEPARATOR.format(field.name); > alert(msg); ok=0; field.focus(); > return; > } >@@ -17,19 +17,19 @@ if (d!=="") { > var yyyy = date[2]; > // checking days > if ( ((isNaN(dd))||(dd<1)||(dd>31)) && (ok==1) ) { >- msg = MSG_INCORRECT_DAY+field.name; >+ msg = MSG_INCORRECT_DAY.format(field.name); > alert(msg); ok=0; field.focus(); > return false; > } > // checking months > if ( ((isNaN(mm))||(mm<1)||(mm>12)) && (ok==1) ) { >- msg = MSG_INCORRECT_MONTH+field.name; >+ msg = MSG_INCORRECT_MONTH.format(field.name); > alert(msg); ok=0; field.focus(); > return false; > } > // checking years > if ( ((isNaN(yyyy))||(yyyy<amin)||(yyyy>amax)) && (ok==1) ) { >- msg = MSG_INCORRECT_YEAR+field.name; >+ msg = MSG_INCORRECT_YEAR.format(field.name); > alert(msg); ok=0; field.focus(); > return false; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js b/koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js >index 3686a0e..bf1f13a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js >@@ -91,7 +91,7 @@ function toggleField(pField) { > // We select the whole field and removing non-selected subfields, instead of... > > // Alerting the user >- alert(MSG_MERGEREC_SUBFIELD_PRE + " " + field + " " + MSG_MERGEREC_SUBFIELD_POST); >+ alert(MSG_MERGEREC_SUBFIELD.format(field)); > pField.checked = false; > } else { > $(where).nextAll("ul").append(clone); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js >index 80b8429..6932312 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js >@@ -8,7 +8,7 @@ KOHA.Preferences = { > humanMsg.displayAlert( MSG_NOTHING_TO_SAVE ); > return; > } >- KOHA.AJAX.MarkRunning( $( form ).find( '.save-all' ), _( MSG_SAVING ) ); >+ KOHA.AJAX.MarkRunning( $( form ).find( '.save-all' ), MSG_SAVING ); > KOHA.AJAX.Submit( { > data: data, > url: '/cgi-bin/koha/svc/config/systempreferences/', >@@ -21,7 +21,7 @@ KOHA.Preferences = { > modified_prefs.each(function(){ > var modified_pref = $(this).attr("id"); > modified_pref = modified_pref.replace("pref_",""); >- msg += "<strong>"+ MSG_SAVED_PREFERENCE + " " + modified_pref + "</strong>\n"; >+ msg += "<strong>"+ MSG_SAVED_PREFERENCE.format(modified_pref) + "</strong>\n"; > }); > humanMsg.displayAlert(msg); > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js b/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js >index 89e8e97..d995bda 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/xmlControlfield.js >@@ -212,7 +212,7 @@ function changeH4Result(form, h4_result, tr_result, pos, value) > }).responseXML; > if (this.xmlDoc) this.renderTemplate(); > $("*").ajaxError(function(evt, request, settings){ >- alert(_("AJAX error: receiving data from ") + settings.url); >+ alert(_("AJAX error: receiving data from %s").format(settings.url)); > }); > },//loadXmlValues > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >index 63ecaaf..6b77990 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >@@ -18,7 +18,7 @@ > var search_jumped = [% IF ( search_jumped ) %]true[% ELSE %]false[% END %]; > var MSG_NOTHING_TO_SAVE = _("Nothing to save"); > var MSG_SAVING = _("Saving..."); >- var MSG_SAVED_PREFERENCE = _("Saved preference"); >+ var MSG_SAVED_PREFERENCE = _("Saved preference %s"); > var MSG_MODIFIED = _("modified"); > var MSG_MADE_CHANGES = _("You have made changes to system preferences."); > var MSG_CLICK_TO_EXPAND = _("Click to expand this section"); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt >index fe617c1..0a922a5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt >@@ -17,21 +17,21 @@ > <script type="text/javascript"> > //<![CDATA[ > var ALERT_SUCCESSFUL_CHECKIN = _("Checked in item."); >-var ALERT_MATERIALS = _("Note about the accompanying materials: "); >+var ALERT_MATERIALS = _("Note about the accompanying materials: %s"); > var ALERT_RESTRICTED = _("Patron is RESTRICTED"); >-var ALERT_NO_MATCHING_ITEM = _("No item with barcode in offline database (transaction recorded anyway): "); >+var ALERT_NO_MATCHING_ITEM = _("No item with barcode in offline database (transaction recorded anyway): %s"); > var ALERT_NOT_CHECKED_OUT = _("Item not listed as checked out in offline database (transaction recorded anyway)"); > var ALERT_ITEM_WITHDRAWN = _("Item has been withdrawn (transaction recorded anyway)"); > var ALERT_ITEM_RESTRICTED = _("Item is restricted (transaction recorded anyway)"); > var ALERT_ITEM_LOST = _("Item has been lost (transaction recorded anyway)"); >-var ALERT_NO_MATCHING_PATRON = _("No patron cardnumber in offline database (proceeding anyway): "); >+var ALERT_NO_MATCHING_PATRON = _("No patron cardnumber in offline database (proceeding anyway): %s"); > var ALERT_PATRON_GONE_NO_ADDRESS = _("Patron's address is in doubt (proceeding anyway)"); > var ALERT_PATRON_CARD_LOST = _("Patron's card is lost"); >-var ALERT_PATRON_EXPIRED = _("Patron's card is expired"); >-var ALERT_PATRON_BLOCKED_TEMPORARY = _("Patron has had overdue items and is restricted until: "); >+var ALERT_PATRON_EXPIRED = _("Patron's card is expired (%s)"); >+var ALERT_PATRON_BLOCKED_TEMPORARY = _("Patron has had overdue items and is restricted until: %s"); > var ALERT_PATRON_RESTRICTED = _("Patron is restricted"); >-var ALERT_PATRON_FINE = _("Patron has outstanding fines: "); >-var ALERT_PATRON_FINE_OVER_LIMIT = _("Patron fines are over limit: "); >+var ALERT_PATRON_FINE = _("Patron has outstanding fines: %s"); >+var ALERT_PATRON_FINE_OVER_LIMIT = _("Patron fines are over limit: %s"); > var UPLOAD_PENDING_MESSAGE = _("You have transactions in the offline circulation database on this computer that have not been uploaded."); > var NO_UPLOAD_PENDING_MESSAGE = _("You do not have any pending transactions in the offline circulation database on this computer."); > >@@ -79,10 +79,10 @@ function checkin(barcode, item, error) { > function checkAlerts(barcode, item) { > var alerts = []; > if (typeof item === 'undefined') { >- alerts.push(ALERT_NO_MATCHING_ITEM + barcode); >+ alerts.push(ALERT_NO_MATCHING_ITEM.format(barcode)); > } else { > if (typeof item.materials !== 'undefined' && item.materials != null) { >- alerts.push(ALERT_MATERIALS + item.materials); >+ alerts.push(ALERT_MATERIALS.format(item.materials)); > } > } > return alerts; >@@ -321,7 +321,7 @@ function recordFine(amount) { > function checkPatronAlerts(cardnumber, patron) { > var alerts = []; > if (typeof patron === 'undefined') { >- alerts.push(ALERT_NO_MATCHING_PATRON + cardnumber); >+ alerts.push(ALERT_NO_MATCHING_PATRON.format(cardnumber)); > } else { > if (patron.gonenoaddress !== '0') { > alerts.push(ALERT_PATRON_GONE_NO_ADDRESS); >@@ -331,18 +331,18 @@ function checkPatronAlerts(cardnumber, patron) { > } > if (patron.debarred !== null) { > if (patron.debarred != '9999-12-31') { >- alerts.push(ALERT_PATRON_BLOCKED_TEMPORARY + $.datepicker.formatDate(dateformat, new Date(patron.debarred))); >+ alerts.push(ALERT_PATRON_BLOCKED_TEMPORARY.format($.datepicker.formatDate(dateformat, new Date(patron.debarred)))); > } else { > alerts.push(ALERT_PATRON_RESTRICTED); > } > } > if (new Date(patron.dateexpiry) < new Date()) { >- alerts.push(ALERT_PATRON_EXPIRED + ' (' + $.datepicker.formatDate(dateformat, new Date(patron.dateexpiry)) + ')'); >+ alerts.push(ALERT_PATRON_EXPIRED.format($.datepicker.formatDate(dateformat, new Date(patron.dateexpiry)))); > } > if (parseInt(patron.fine) > [% maxoutstanding %]) { >- alerts.push(ALERT_PATRON_FINE_OVER_LIMIT + patron.fine); >+ alerts.push(ALERT_PATRON_FINE_OVER_LIMIT.format(patron.fine)); > } else if (parseInt(patron.fine) > 0) { >- alerts.push(ALERT_PATRON_FINE + patron.fine); >+ alerts.push(ALERT_PATRON_FINE.format(patron.fine)); > } > } > return alerts; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 430543e..858f7f3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -103,10 +103,10 @@ > $(mytables).find(" li[data-category_code='']").show(); > } > >- var MSG_SEPARATOR = _("Separator must be / in field "); >- var MSG_INCORRECT_DAY = _("Invalid day entered in field "); >- var MSG_INCORRECT_MONTH = _("Invalid month entered in field "); >- var MSG_INCORRECT_YEAR = _("Invalid year entered in field "); >+ var MSG_SEPARATOR = _("Separator must be / in field %s"); >+ var MSG_INCORRECT_DAY = _("Invalid day entered in field %s"); >+ var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s"); >+ var MSG_INCORRECT_YEAR = _("Invalid year entered in field %s"); > var MSG_DUPLICATE_PATRON = _("Warning: Duplicate patron"); > var MSG_DUPLICATE_ORGANIZATION = _("Warning: Duplicate organization"); > var MSG_LATE_EXPIRY = _("Warning: Expiration date falls before enrollment date"); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt >index 871fa77..bcf3e56 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt >@@ -202,7 +202,7 @@ function editAction( mmta_id, ordering, action, field_number, from_field, from_s > document.getElementById('description').value = description; > > window.modaction_legend_innerhtml = document.getElementById('modaction_legend').innerhtml; >- document.getElementById('modaction_legend').innerhtml = _("Edit action") + ordering; >+ document.getElementById('modaction_legend').innerhtml = _("Edit action%s").format(ordering); > > window.action_submit_value = document.getElementById('action_submit').value; > document.getElementById('action_submit').value = _("Update action"); >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12150
:
27697
|
28733
|
28774
|
28775