From d4367331e82ca79718776ad058f98d438789ef86 Mon Sep 17 00:00:00 2001 From: dbs Date: Sun, 23 Jan 2011 18:43:22 +0000 Subject: [PATCH] i18n support for a few OPAC strings 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 | 5 ++++- Open-ILS/web/opac/skin/default/js/myopac.js | 14 ++++++++++---- Open-ILS/web/opac/skin/default/js/result_common.js | 2 ++ Open-ILS/web/opac/skin/default/xml/result/result_table.xml | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/opac/nls/opac.js b/Open-ILS/web/js/dojo/openils/opac/nls/opac.js index 7b9a353d34..917643078e 100644 --- a/Open-ILS/web/js/dojo/openils/opac/nls/opac.js +++ b/Open-ILS/web/js/dojo/openils/opac/nls/opac.js @@ -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" } diff --git a/Open-ILS/web/opac/skin/default/js/myopac.js b/Open-ILS/web/opac/skin/default/js/myopac.js index db63725bce..12af1973c8 100644 --- a/Open-ILS/web/opac/skin/default/js/myopac.js +++ b/Open-ILS/web/opac/skin/default/js/myopac.js @@ -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 { diff --git a/Open-ILS/web/opac/skin/default/js/result_common.js b/Open-ILS/web/opac/skin/default/js/result_common.js index 62f1eed2b0..39dc2382e3 100644 --- a/Open-ILS/web/opac/skin/default/js/result_common.js +++ b/Open-ILS/web/opac/skin/default/js/result_common.js @@ -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 = []; diff --git a/Open-ILS/web/opac/skin/default/xml/result/result_table.xml b/Open-ILS/web/opac/skin/default/xml/result/result_table.xml index 77b35f5f66..9430af684e 100644 --- a/Open-ILS/web/opac/skin/default/xml/result/result_table.xml +++ b/Open-ILS/web/opac/skin/default/xml/result/result_table.xml @@ -193,7 +193,7 @@ 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); }); -- 2.11.0