[open-ils-commits] r12198 - branches/rel_1_4/Open-ILS/xul/staff_client/server/cat (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Feb 17 00:00:07 EST 2009


Author: dbs
Date: 2009-02-17 00:00:04 -0500 (Tue, 17 Feb 2009)
New Revision: 12198

Modified:
   branches/rel_1_4/Open-ILS/xul/staff_client/server/cat/marcedit.js
Log:
Backport r12197 from trunk: en-US is better than no MARC editor tooltips at all; but we really need to HEAD the requested locale

Modified: branches/rel_1_4/Open-ILS/xul/staff_client/server/cat/marcedit.js
===================================================================
--- branches/rel_1_4/Open-ILS/xul/staff_client/server/cat/marcedit.js	2009-02-17 04:59:13 UTC (rev 12197)
+++ branches/rel_1_4/Open-ILS/xul/staff_client/server/cat/marcedit.js	2009-02-17 05:00:04 UTC (rev 12198)
@@ -124,18 +124,26 @@
 
 		// Try to get the locale from our preferences
 		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-        try {
-            const Cc = Components.classes;
-            const Ci = Components.interfaces;
-            locale = Cc["@mozilla.org/preferences-service;1"].
+		try {
+			const Cc = Components.classes;
+			const Ci = Components.interfaces;
+			locale = Cc["@mozilla.org/preferences-service;1"].
 				getService(Ci.nsIPrefBranch).
 				getCharPref("general.useragent.locale");
-        }
+		}
 		catch (e) { }
 
+		// TODO: We should send a HEAD request to check for the existence of the desired file
+		// then fall back to the default locale if preferred locale is not necessary;
+		// however, for now we have a simplistic check:
+		//
+		// we currently have translations for only two locales; in the absence of a
+		// valid locale, default to the almighty en-US
+		if (locale != 'en-US' && locale != 'fr-CA') {
+			locale = 'en-US';
+		}
+
 		// Get the locale-specific tooltips
-		// TODO: We should send a HEAD request to check for the existence of the desired file
-		// then fall back to the default locale if preferred locale is not necessary
 		req.open('GET','/xul/server/locale/' + locale + '/marcedit-tooltips.xml',true);
 
 		context_menus = createComplexXULElement('popupset');



More information about the open-ils-commits mailing list