i18n support for a few OPAC strings
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 23 Jan 2011 18:43:22 +0000 (18:43 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 23 Jan 2011 18:43:22 +0000 (18:43 +0000)
Enable translation of the "More copies listed in full record details"
message for the search results library / call number / item /status
lines

Also provide translation support for the hold queue status message,
including singular / plural variants (most languages do not provide
the equivalent of the "item(s)" idiom in English).

Instead of burying the display of hold queue status with a hard
coded "if (false)" test, turn it into a top-level variable for
a bit more exposure.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@19262 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/opac/nls/opac.js
Open-ILS/web/opac/skin/default/js/myopac.js
Open-ILS/web/opac/skin/default/js/result_common.js
Open-ILS/web/opac/skin/default/xml/result/result_table.xml

index 7b9a353..9176430 100644 (file)
@@ -34,5 +34,8 @@
        "SUPPLEMENT_HOLDINGS": "Supplements",
        "SUPPLEMENT_HOLDINGS_ADD": "Additional Supplement Information",
     "PLACE_HOLD": "Place hold",
-    "MORE": "More"
+    "HOLD_STATUS_PLURAL": "hold # ${0} of ${1} total holds and ${2} potential items",
+    "HOLD_STATUS_SINGULAR": "hold # ${0} of ${1} total holds and ${2} potential item",
+    "MORE": "More",
+    "MORE_COPIES_FULL_RECORD": "... more copies listed in full record"
 }
index db63725..12af197 100644 (file)
@@ -3,15 +3,18 @@ attachEvt("common", "run", myOPACInit );
 //attachEvt("common", "loggedIn", myOPACInit );
 attachEvt('common','locationUpdated', myopacReload );
 
+dojo.requireLocalization("openils.opac", "opac");
+
+var opac_strings = dojo.i18n.getLocalization("openils.opac", "opac");
 var fleshedUser = null;
 var fleshedContainers = {};
 var holdCache = {};
 var holdStatusCache = {};
+var showHoldQueuePosition = false;
 var allowPendingAddr = false;
 var myopacEnableRefWorks = false;
 var myopacRefWorksHost = 'http://www.refworks.com';
 
-
 function clearNodes( node, keepArray ) {
        if(!node) return;
        for( var n in keepArray ) node.removeChild(keepArray[n]);
@@ -472,10 +475,13 @@ function myOShowHoldStatus(r) {
                hideMe($n(row, 'myopac_holds_cancel_link'));
        }
 
-    if(false) {
+    if (showHoldQueuePosition) {
         var node = $n(row, 'hold_qstats');
-        // XXX best way to display this info + dojo i18n
-        node.appendChild(text('hold #' + qstats.queue_position+' of '+qstats.queue_position+' and '+qstats.potential_copies+' item(s)'));
+        if (qstats.potential_copies == 1) {
+            node.appendChild(text(dojo.string.substitute(opac_strings.HOLD_STATUS_SINGULAR, [qstats.queue_position, qstats.total_holds, qstats.potential_copies])));
+        } else {
+            node.appendChild(text(dojo.string.substitute(opac_strings.HOLD_STATUS_PLURAL, [qstats.queue_position, qstats.total_holds, qstats.potential_copies])));
+        }
         unHideMe(node);
 
     } else {
index 62f1eed..39dc238 100644 (file)
@@ -1,4 +1,6 @@
 dojo.require('openils.BibTemplate');
+dojo.requireLocalization("openils.opac", "opac");
+var opac_strings = dojo.i18n.getLocalization("openils.opac", "opac");
 
 var recordsHandled = 0;
 var recordsCache = [];
index 77b35f5..9430af6 100644 (file)
                                                                                        item_cnt++;
                                                                                        if (item_cnt >= max_items) {
                                                                                                dojo.create('br', null, cp_entry);
-                                                                                               cp_entry.appendChild(dojo.doc.createTextNode('... more print items listed in full record'));
+                                                                                               cp_entry.appendChild(dojo.doc.createTextNode(opac_strings.MORE_COPIES_FULL_RECORD));
                                                                                        }
                                                                                        output.appendChild(cp_entry);
                                                                                });