[Opensrf-commits] r1651 - trunk/src/javascript

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Feb 3 22:55:58 EST 2009


Author: dbs
Date: 2009-02-03 22:55:56 -0500 (Tue, 03 Feb 2009)
New Revision: 1651

Modified:
   trunk/src/javascript/DojoSRF.js
Log:
So, djfiander says "fix the code so it's not case-sensitive", so this seems to fix it.
OpenSRF locale gets xx-YY, even though Dojo locale is xx-yy.


Modified: trunk/src/javascript/DojoSRF.js
===================================================================
--- trunk/src/javascript/DojoSRF.js	2009-02-02 13:39:08 UTC (rev 1650)
+++ trunk/src/javascript/DojoSRF.js	2009-02-04 03:55:56 UTC (rev 1651)
@@ -17,8 +17,15 @@
 		return this.session_cache[app];
 	}
 
-	OpenSRF.locale = dojo.config.locale;
-	if (!OpenSRF.locale) {
-		OpenSRF.locale = dojo.isIE ? navigator.userLanguage : navigator.language;
-	}
+        localeRE = /^(\w\w)(-\w\w)?$/;
+        localeMatch = localeRE.exec(dojo.config.locale);
+
+        if (!localeMatch[1]) {
+                OpenSRF.locale = dojo.isIE ? navigator.userLanguage : navigator.language;
+        } else {
+                OpenSRF.locale = localeMatch[1].toLowerCase();
+        }
+        if (localeMatch[2]) {
+                OpenSRF.locale = OpenSRF.locale + '-' + localeMatch[2].toUpperCase();
+        }
 }



More information about the opensrf-commits mailing list