[open-ils-commits] r9272 - in trunk/Open-ILS/xul/staff_client/server: cat locale/en-US

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Apr 8 17:55:47 EDT 2008


Author: dbs
Date: 2008-04-08 17:18:36 -0400 (Tue, 08 Apr 2008)
New Revision: 9272

Modified:
   trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.js
   trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.xul
   trunk/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties
Log:
25% of the way through i18n of copy_editor.js


Modified: trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.js	2008-04-08 20:20:21 UTC (rev 9271)
+++ trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.js	2008-04-08 21:18:36 UTC (rev 9272)
@@ -1,3 +1,4 @@
+// vim:noet:sw=4:ts=4
 var g = {};
 g.map_acn = {};
 
@@ -3,4 +4,6 @@
 var xulG = {};
 
+function $(id) { return document.getElementById(id); }
+
 function my_init() {
 	try {
@@ -9,7 +12,9 @@
 		/* setup JSAN and some initial libraries */
 
 		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-		if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
+		if (typeof JSAN == 'undefined') {
+			throw( $('commonStrings').getString('common.jsan.missing') );
+		}
 		JSAN.errorLevel = "die"; // none, warn, or die
 		JSAN.addRepository('/xul/server/');
 		JSAN.use('util.error'); g.error = new util.error();
@@ -97,8 +102,8 @@
             }
 
 			if (g.edit) {
-                document.getElementById('caption').setAttribute('label','Copy Editor'); 
-    			document.getElementById('save').setAttribute('hidden','false'); 
+                $('caption').setAttribute('label', $('catStrings').getString('staff.cat.copy_editor.caption')); 
+    			$('save').setAttribute('hidden','false'); 
     			g.retrieve_templates();
             } else {
 			    $('top_nav').setAttribute('hidden','true');
@@ -110,12 +115,12 @@
 		if (g.copies.length > 0 && g.copies[0].id() < 0) {
 			document.getElementById('copy_notes').setAttribute('hidden','true');
 			g.apply("status",5 /* In Process */);
-			$('save').setAttribute('label','Create Copies');
+			$('save').setAttribute('label', $('catStrings').getString('staff.cat.copy_editor.create_copies'));
 		} else {
 			g.panes_and_field_names.left_pane = 
 				[
 					[
-						"Status",
+						$('catStrings').getString('staff.cat.copy_editor.status'),
 						{ 
 							render: 'typeof fm.status() == "object" ? fm.status().name() : g.data.hash.ccs[ fm.status() ].name()', 
 							input: g.safe_to_edit_copy_status() ? 'c = function(v){ g.apply("status",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( util.functional.map_list( g.data.list.ccs, function(obj) { return [ obj.name(), obj.id(), typeof my_constants.magical_statuses[obj.id()] != "undefined" ? true : false ]; } ).sort() ); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);' : undefined,
@@ -158,8 +163,7 @@
 		g.render();
 
 	} catch(E) {
-		var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
-			"system administrator or software developer the following:\ncat/copy_editor.xul\n" + E + '\n';
+		var err_msg = $("commonStrings").getFormattedString('common.exception', ['cat/copy_editor.js', E]);
 		try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); dump(js2JSON(E)); }
 		alert(err_msg);
 	}
@@ -188,7 +192,7 @@
             false
         );
 	} catch(E) {
-		g.error.standard_unexpected_error_alert('Error retrieving templates',E);
+		g.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_editor.retrieve_templates.error'), E);
 	}
 }
 
@@ -218,7 +222,7 @@
 			g.render();
 		}
 	} catch(E) {
-		g.error.standard_unexpected_error_alert('Error applying template',E);
+		g.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_editor.apply_templates.error'), E);
 	}
 }
 
@@ -227,7 +231,11 @@
 
 g.save_template = function() {
 	try {
-		var name = window.prompt('Enter template name:','','Save As Template');
+		var name = window.prompt(
+			$('catStrings').getString('staff.cat.copy_editor.save_as_template.prompt'),
+			'',
+			$('catStrings').getString('staff.cat.copy_editor.save_as_template.title')
+		);
 		if (!name) return;
 		g.templates[name] = g.changed;
 		var robj = g.network.simple_request(
@@ -236,19 +244,19 @@
 		if (typeof robj.ilsevent != 'undefined') {
 			throw(robj);
 		} else {
-			alert('Template "' + name + '" saved.');
+			alert($('catStrings').getFormattedString('staff.cat.copy_editor.save_as_template.success', [name]));
 			setTimeout(
 				function() {
 					try {
 						g.retrieve_templates();
 					} catch(E) {
-						g.error.standard_unexpected_error_alert('Error saving template',E);
+						g.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_editor.save_as_template.error'), E);
 					}
 				},0
 			);
 		}
 	} catch(E) {
-		g.error.standard_unexpected_error_alert('Error saving template',E);
+		g.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_editor.save_as_template.error'), E);
 	}
 }
 
@@ -259,7 +267,7 @@
 	try {
 		var name = g.template_menu.value;
 		if (!name) return;
-		if (! window.confirm('Delete template "' + name + '"?') ) return;
+		if (! window.confirm($('catStrings').getFormattedString('staff.cat.copy_editor.delete_template.confirm', [name])) return;
 		delete(g.templates[name]);
 		var robj = g.network.simple_request(
 			'FM_AUS_UPDATE',[ses(),g.data.list.au[0].id(), { 'staff_client.copy_editor.templates' : g.templates }]
@@ -267,19 +275,19 @@
 		if (typeof robj.ilsevent != 'undefined') {
 			throw(robj);
 		} else {
-			alert('Template "' + name + '" deleted.');
+			alert($('catStrings').getFormattedString('staff.cat.copy_editor.delete_template.confirm', [name]));
 			setTimeout(
 				function() {
 					try {
 						g.retrieve_templates();
 					} catch(E) {
-						g.error.standard_unexpected_error_alert('Error deleting template',E);
+						g.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_editor.delete_template.error'), E);
 					}
 				},0
 			);
 		}
 	} catch(E) {
-		g.error.standard_unexpected_error_alert('Error deleting template',E);
+		g.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_editor.delete_template.error'), E);
 	}
 }
 
@@ -290,9 +298,9 @@
 	try {
 		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 		JSAN.use('util.file'); var f = new util.file('');
-        f.export_file( { 'title' : 'Save Templates File As', 'data' : g.templates } );
+        f.export_file( { 'title' : $('catStrings').getString('staff.cat.copy_editor.export_templates.title'), 'data' : g.templates } );
 	} catch(E) {
-		g.error.standard_unexpected_error_alert('Error exporting templates',E);
+		g.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_editor.export_templates.error'), E);
 	}
 }
 
@@ -303,15 +311,19 @@
 	try {
 		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 		JSAN.use('util.file'); var f = new util.file('');
-        var temp = f.import_file( { 'title' : 'Import Templates File' } );
+        var temp = f.import_file( { 'title' : $('catStrings').getString('staff.cat.copy_editor.import_templates.title') } );
 		if (temp) {
 			for (var i in temp) {
 
 				if (g.templates[i]) {
 
 					var r = g.error.yns_alert(
-						'Replace the existing template with the imported template?\n' + g.error.pretty_print( js2JSON( temp[i] ) ),
-						'Template ' + i + ' already exists.','Yes','No',null,'Click here'
+						$('catStrings').getString('staff.cat.copy_editor.import_templates.replace.prompt') + '\n' + g.error.pretty_print( js2JSON( temp[i] ) ),
+						$('catStrings').getFormattedString('staff.cat.copy_editor.import_templates.replace.title', [i]),
+						$('catStrings').getString('staff.cat.copy_editor.import_templates.replace.yes'),
+						$('catStrings').getString('staff.cat.copy_editor.import_templates.replace.no'),
+						null,
+						$('catStrings').getString('staff.cat.copy_editor.import_templates.replace.click_here')
 					);
 
 					if (r == 0 /* Yes */) g.templates[i] = temp[i];

Modified: trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.xul	2008-04-08 20:20:21 UTC (rev 9271)
+++ trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.xul	2008-04-08 21:18:36 UTC (rev 9272)
@@ -11,7 +11,7 @@
 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
 <!-- LOCALIZATION -->
 <!DOCTYPE window PUBLIC "" ""[
-	<!--#include virtual="/opac/locale/en-US/lang.dtd"-->
+	<!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
 ]>
 
 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
@@ -34,6 +34,9 @@
 	<script type="text/javascript" src="/xul/server/main/JSAN.js"/>
 	<script type="text/javascript" src="copy_editor.js"/>
 
+	<messagecatalog id="catStrings" src="/xul/server/locale/<!--#echo var='locale'-->/cat.properties" />
+	<messagecatalog id="commonStrings" src="/xul/server/locale/<!--#echo var='locale'-->/common.properties" />
+
 	<iframe id="brief_display"/>
 
 	<groupbox flex="1" style="overflow: auto">

Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties	2008-04-08 20:20:21 UTC (rev 9271)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties	2008-04-08 21:18:36 UTC (rev 9272)
@@ -100,3 +100,23 @@
 staff.cat.copy_buckets_quick.copy_buckets_new_bucket.title=Bucket Creation
 staff.cat.copy_buckets_quick.copy_buckets_new_bucket.error=Bucket creation failed.
 staff.cat.copy_buckets_quick.addition.error=Addition likely failed for bucket = %1$s and copy ID = %2$s.
+staff.cat.copy_editor.caption=Copy Editor
+staff.cat.copy_editor.create_copies=Create Copies
+staff.cat.copy_editor.status=Status
+staff.cat.copy_editor.retrieve_templates.error=Error retrieving templates
+staff.cat.copy_editor.apply_templates.error=Error applying template
+staff.cat.copy_editor.save_as_template.prompt=Enter template name:
+staff.cat.copy_editor.save_as_template.title=Save As Template
+staff.cat.copy_editor.save_as_template.success=Template "%1$s" saved.
+staff.cat.copy_editor.save_as_template.error=Error saving template
+staff.cat.copy_editor.delete_template.confirm=Delete template "%1$s"?
+staff.cat.copy_editor.delete_template.success=Template "%1$s" deleted.
+staff.cat.copy_editor.delete_template.error=Error deleting template
+staff.cat.copy_editor.export_templates.title=Save Templates File As
+staff.cat.copy_editor.export_templates.error=Error exporting templates
+staff.cat.copy_editor.import_templates.title=Import Templates File
+staff.cat.copy_editor.import_templates.replace.prompt=Replace the existing template with the imported template?
+staff.cat.copy_editor.import_templates.replace.title=Template %1$s already exists.
+staff.cat.copy_editor.import_templates.replace.yes=Yes
+staff.cat.copy_editor.import_templates.replace.no=No
+staff.cat.copy_editor.import_templates.replace.click_here=Click here



More information about the open-ils-commits mailing list