[open-ils-commits] r19113 - in branches/rel_2_0: Open-ILS/web/js/dojo/openils Open-ILS/web/js/ui/default/cat/authority build/i18n (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jan 4 14:08:32 EST 2011


Author: dbs
Date: 2011-01-04 14:08:27 -0500 (Tue, 04 Jan 2011)
New Revision: 19113

Added:
   branches/rel_2_0/Open-ILS/web/js/dojo/openils/authority/
Modified:
   branches/rel_2_0/Open-ILS/web/js/ui/default/cat/authority/list.js
   branches/rel_2_0/build/i18n/Makefile
Log:
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.


Copied: branches/rel_2_0/Open-ILS/web/js/dojo/openils/authority (from rev 19093, trunk/Open-ILS/web/js/dojo/openils/authority)

Modified: branches/rel_2_0/Open-ILS/web/js/ui/default/cat/authority/list.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/ui/default/cat/authority/list.js	2011-01-04 19:07:43 UTC (rev 19112)
+++ branches/rel_2_0/Open-ILS/web/js/ui/default/cat/authority/list.js	2011-01-04 19:08:27 UTC (rev 19113)
@@ -28,6 +28,8 @@
 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();
 
@@ -82,7 +84,7 @@
             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(){
@@ -95,15 +97,15 @@
             var mergeRole = '<td style="border: 1px solid black; padding-left: 0.5em; padding-right: 1em;">';
             var isTarget = dojo.query('.toMerge').length;
             if (isTarget) {
-                mergeRole += 'Target</td>';
+                mergeRole += auth_strings.TARGET_RECORD + '</td>';
             } else {
-                mergeRole += 'Master</td>';
+                mergeRole += auth_strings.MASTER_RECORD + '</td>';
             }
 
             dojo.place('<tr class="toMerge" id="toMerge_' + auth.id + '"><td>' + mergeRole + '</td><td  style="border: 1px solid black;" id="mergeMeta_' + auth.id + '"></td><td style="border: 1px solid black; padding-left: 1em; padding-right: 1em;" >' + auth.text + '</td></tr>', 'mergebox-tbody', 'last');
             dojo.place('<span class="authmeta" style="font-family: monospace;">' + auth.name + ' ' + auth.ind1 + auth.ind2 + '</span>', '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({
@@ -126,34 +128,36 @@
                 });
 
                 if (!delDlg) {
-                    var content = '<div>Delete the authority record: "' + auth.text + '"?</div>';
+                    var content = '<div>' + dojo.string.substitute(auth_strings.CONFIRM_DELETE_TITLE, [auth.text]) + '</div>';
                     if (parseInt(linkedBibs) > 0) {
-                        content = "<div id='delAuthSum_" + auth.id + "'>Number of linked bibliographic records: " + linkedBibs + "</div>";
+                        content = "<div id='delAuthSum_" + auth.id + "'>"
+                            + dojo.string.substitute(auth_strings.LINKED_BIBS, [linkedBibs])
+                            + "</div>";
                     }
                     content += "<div id='authMARC" + auth.id + "' style='width: 100%; display:none;'>";
                     content += "<hr style='width: 100%;' />";
                     content += marcToHTML(auth_rec.marc());
                     content += "</div><hr style='width: 100%;' /><div>";
-                    content += "<input type='button' dojoType='dijit.form.Button' label='Cancel' onClick='cancelDelete(" + auth.id + ")'/>";
-                    content += "<input type='button' dojoType='dijit.form.Button' label='Delete' onClick='confirmDelete(" + auth.id + ")'/>";
+                    content += "<input type='button' dojoType='dijit.form.Button' label='" + auth_strings.CANCEL + "' onClick='cancelDelete(" + auth.id + ")'/>";
+                    content += "<input type='button' dojoType='dijit.form.Button' label='" + auth_strings.DELETE + "' onClick='confirmDelete(" + auth.id + ")'/>";
                     content += "<input id='viewMARC" + auth.id + "' type='button' "
                         + "style='float:right;' dojoType='dijit.form.Button' "
-                        + "label='View MARC' onClick='viewMARC(" + auth.id + ")'/>";
+                        + "label='" + auth_strings.VIEW_MARC + "' onClick='viewMARC(" + auth.id + ")'/>";
                     content += "<input id='hideMARC" + auth.id + "' type='button' "
                         + "style='display: none; float:right;' dojoType='dijit.form.Button' "
-                        + "label='Hide MARC' onClick='hideMARC(" + auth.id + ")'/>";
+                        + "label='" + auth_strings.HIDE_MARC + "' onClick='hideMARC(" + auth.id + ")'/>";
                     content += "</div>";
                     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();
     });
@@ -207,7 +211,7 @@
     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);
@@ -254,13 +258,13 @@
     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();
             }
         }
@@ -361,7 +365,7 @@
         {   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();
             }

Modified: branches/rel_2_0/build/i18n/Makefile
===================================================================
--- branches/rel_2_0/build/i18n/Makefile	2011-01-04 19:07:43 UTC (rev 19112)
+++ branches/rel_2_0/build/i18n/Makefile	2011-01-04 19:08:27 UTC (rev 19113)
@@ -9,6 +9,7 @@
 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 @@
 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 @@
 	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



More information about the open-ils-commits mailing list