From 9728bb13196afef96725fe29501748b55457bab8 Mon Sep 17 00:00:00 2001 From: dbs Date: Mon, 3 Jan 2011 03:54:04 +0000 Subject: [PATCH] Internationalize the JavaScript portion of the "Manage Authorities" interface We can use the dojo i18n infrastructure to support translations of the "Manage Authorities" interface, but unfortunately we still don't have a TT2 solution for i18n. Still, better to do what we can. git-svn-id: svn://svn.open-ils.org/ILS/trunk@19093 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../web/js/dojo/openils/authority/nls/authority.js | 19 +++++++++++ Open-ILS/web/js/ui/default/cat/authority/list.js | 38 ++++++++++++---------- build/i18n/Makefile | 4 +++ 3 files changed, 44 insertions(+), 17 deletions(-) create mode 100644 Open-ILS/web/js/dojo/openils/authority/nls/authority.js diff --git a/Open-ILS/web/js/dojo/openils/authority/nls/authority.js b/Open-ILS/web/js/dojo/openils/authority/nls/authority.js new file mode 100644 index 0000000000..732b433377 --- /dev/null +++ b/Open-ILS/web/js/dojo/openils/authority/nls/authority.js @@ -0,0 +1,19 @@ +{ + "MASTER_RECORD": "Master", + "TARGET_RECORD": "Target", + "MENU_EDIT": "Edit", + "MENU_MERGE": "Mark for Merge", + "MENU_DELETE": "Delete", + "CONFIRM_DELETE_TITLE": "Delete the authority record: \"${0}\"?", + "LINKED_BIBS": "Number of linked bibliographic records: ${0}", + "CANCEL": "Cancel", + "ACTIONS": "Actions", + "DELETE": "Delete", + "VIEW_MARC": "View MARC", + "HIDE_MARC": "Hide MARC", + "CONFIRM_DELETE_PROMPT": "Confirm deletion of record # ${0}", + "CONFIRM_DELETE_RESULT": "Deleted authority record # ${0}.", + "SAVE": "Save", + "SAVE_RESULT_SUCCESS": "Record was saved.", + "MERGE_RESULT_SUCCESS": "Record merge is complete." +} diff --git a/Open-ILS/web/js/ui/default/cat/authority/list.js b/Open-ILS/web/js/ui/default/cat/authority/list.js index 6c24621822..98baeffb85 100644 --- a/Open-ILS/web/js/ui/default/cat/authority/list.js +++ b/Open-ILS/web/js/ui/default/cat/authority/list.js @@ -14,6 +14,8 @@ dojo.require('openils.CGI'); dojo.require('openils.PermaCrud'); dojo.require('openils.XUL'); dojo.require('openils.widget.OrgUnitFilteringSelect'); +dojo.requireLocalization("openils.authority", "authority"); +var auth_strings = dojo.i18n.getLocalization("openils.authority", "authority"); var cgi = new openils.CGI(); @@ -68,7 +70,7 @@ function displayAuthorities(data) { if (auth_rec) { loadMarcEditor(pcrud, auth_rec); } - }, "label":"Edit"}).placeAt(auth_menu, "first"); + }, "label":auth_strings.MENU_EDIT}).placeAt(auth_menu, "first"); // "Merge" menu item new dijit.MenuItem({"id": "merge_" + auth.id, "onClick":function(){ @@ -81,15 +83,15 @@ function displayAuthorities(data) { var mergeRole = ''; var isTarget = dojo.query('.toMerge').length; if (isTarget) { - mergeRole += 'Target'; + mergeRole += auth_strings.TARGET_RECORD + ''; } else { - mergeRole += 'Master'; + mergeRole += auth_strings.MASTER_RECORD + ''; } dojo.place('' + mergeRole + '' + auth.text + '', 'mergebox-tbody', 'last'); dojo.place('' + auth.name + ' ' + auth.ind1 + auth.ind2 + '', 'mergeMeta_' + auth.id, 'last'); dojo.removeClass('mergebox-div', 'hidden'); - }, "label":"Mark for Merge"}).placeAt(auth_menu, "last"); + }, "label":auth_strings.MENU_MERGE}).placeAt(auth_menu, "last"); // "Delete" menu item new dijit.MenuItem({ @@ -112,34 +114,36 @@ function displayAuthorities(data) { }); if (!delDlg) { - var content = '
Delete the authority record: "' + auth.text + '"?
'; + var content = '
' + dojo.string.substitute(auth_strings.CONFIRM_DELETE_TITLE, [auth.text]) + '
'; if (parseInt(linkedBibs) > 0) { - content = "
Number of linked bibliographic records: " + linkedBibs + "
"; + content = "
" + + dojo.string.substitute(auth_strings.LINKED_BIBS, [linkedBibs]) + + "
"; } content += "
"; - content += ""; - content += ""; + content += ""; + content += ""; content += ""; + + "label='" + auth_strings.VIEW_MARC + "' onClick='viewMARC(" + auth.id + ")'/>"; content += ""; + + "label='" + auth_strings.HIDE_MARC + "' onClick='hideMARC(" + auth.id + ")'/>"; content += "
"; delDlg = new dijit.Dialog({ "id":"delDialog_" + auth.id, - "title":"Confirm deletion of record # " + auth.id, + "title": dojo.string.substitute(auth_strings.CONFIRM_DELETE_PROMPT, [auth.id]), "content": content }); } delDlg.show(); - }, "label":"Delete"}).placeAt(auth_menu, "last"); + }, "label":auth_strings.DELETE}).placeAt(auth_menu, "last"); - auth_mb = new dijit.form.DropDownButton({dropDown: auth_menu, label:"Actions", id:"menu" + auth.id}); + auth_mb = new dijit.form.DropDownButton({dropDown: auth_menu, label: auth_strings.ACTIONS, id:"menu" + auth.id}); auth_mb.placeAt("auth" + auth.id, "first"); auth_menu.startup(); }); @@ -193,7 +197,7 @@ function confirmDelete(recId) { var auth_rec = pcrud.retrieve("are", recId); if (auth_rec) { pcrud.eliminate(auth_rec); - dijit.byId("delDialog_" + recId).attr("content", "Deleted authority record # " + recId); + dijit.byId("delDialog_" + recId).attr("content", dojo.string.substitute(auth_strings.CONFIRM_DELETE_RESULT, [recId])); setTimeout(function() { dijit.byId("delDialog_" + recId).hide(); }, 3000); @@ -240,13 +244,13 @@ function loadMarcEditor(pcrud, rec) { win.xulG = { "record": {"marc": rec.marc(), "rtype": "are"}, "save": { - "label": "Save", + "label": auth_strings.SAVE, "func": function(xmlString) { rec.marc(xmlString); rec.edit_date('now'); rec.ischanged(true); pcrud.update(rec); - alert("Record was saved"); + alert(auth_strings.SAVE_RESULT_SUCCESS); win.close(); } }, @@ -349,7 +353,7 @@ function mergeRecords() { { async: false, params: [openils.User.authtoken, records.shift(), records], oncomplete : function(r) { - alert("Record merge is complete."); + alert(auth_strings.MERGE_RESULT_SUCCESS); clearMergeRecords(); displayRecords(); } diff --git a/build/i18n/Makefile b/build/i18n/Makefile index 28ae7fc244..eec71f55fd 100644 --- a/build/i18n/Makefile +++ b/build/i18n/Makefile @@ -9,6 +9,7 @@ SERVER_PROPSDIR=../../Open-ILS/xul/staff_client/server/locale DOJO_LOCALE := $(shell echo ${LOCALE} | tr '[:upper:]-' '[:lower:]/') DOJO_ACQ_SRC=../../Open-ILS/web/js/dojo/openils/acq/nls DOJO_ACTOR_SRC=../../Open-ILS/web/js/dojo/openils/actor/nls +DOJO_AUTHORITY_SRC=../../Open-ILS/web/js/dojo/openils/authority/nls DOJO_BOOKING_SRC=../../Open-ILS/web/js/dojo/openils/booking/nls DOJO_CIRC_SRC=../../Open-ILS/web/js/dojo/openils/circ/nls DOJO_CON_SRC=../../Open-ILS/web/js/dojo/openils/conify/nls @@ -149,6 +150,7 @@ dtds2pot: dojo2pot: @scripts/dojo_resource.py --pot $(DOJO_ACQ_SRC)/acq.js --output $(PO)/acq.js/acq.js.pot @scripts/dojo_resource.py --pot $(DOJO_ACTOR_SRC)/register.js --output $(PO)/register.js/register.js.pot + @scripts/dojo_resource.py --pot $(DOJO_AUTHORITY_SRC)/authority.js --output $(PO)/authority.js/authority.js.pot @scripts/dojo_resource.py --pot $(DOJO_BOOKING_SRC)/capture.js --output $(PO)/capture.js/capture.js.pot @scripts/dojo_resource.py --pot $(DOJO_BOOKING_SRC)/pickup_and_return.js --output $(PO)/pickup_and_return.js/pickup_and_return.js.pot @scripts/dojo_resource.py --pot $(DOJO_BOOKING_SRC)/pull_list.js --output $(PO)/pull_list.js/pull_list.js.pot @@ -280,6 +282,8 @@ install: updatepo project fmidl2fmidlent fmidlpo2entity-en cp $(PROJECT)/$(LOCALE)/acq.js $(DOJO_ACQ_SRC)/$(DOJO_LOCALE)/acq.js mkdir -p $(DOJO_ACTOR_SRC)/$(DOJO_LOCALE) cp $(PROJECT)/$(LOCALE)/register.js $(DOJO_ACTOR_SRC)/$(DOJO_LOCALE)/register.js + mkdir -p $(DOJO_AUTHORITY_SRC)/$(DOJO_LOCALE) + cp $(PROJECT)/$(LOCALE)/authority.js $(DOJO_AUTHORITY_SRC)/$(DOJO_LOCALE)/authority.js mkdir -p $(DOJO_BOOKING_SRC)/$(DOJO_LOCALE) cp $(PROJECT)/$(LOCALE)/capture.js $(DOJO_BOOKING_SRC)/$(DOJO_LOCALE)/capture.js cp $(PROJECT)/$(LOCALE)/pickup_and_return.js $(DOJO_BOOKING_SRC)/$(DOJO_LOCALE)/pickup_and_return.js -- 2.11.0