Backport r12197 from trunk: en-US is better than no MARC editor tooltips at all;...
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 17 Feb 2009 05:00:41 +0000 (05:00 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 17 Feb 2009 05:00:41 +0000 (05:00 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_4_0@12199 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/cat/marcedit.js

index 293c971..aee2bed 100644 (file)
@@ -124,18 +124,26 @@ function my_init() {
 
                // 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) { }
 
-               // 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
+               // 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
                req.open('GET','/xul/server/locale/' + locale + '/marcedit-tooltips.xml',true);
 
                context_menus = createComplexXULElement('popupset');