[Opensrf-commits] r1652 - branches/rel_1_0/src/javascript

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Feb 3 22:57:06 EST 2009


Author: dbs
Date: 2009-02-03 22:57:04 -0500 (Tue, 03 Feb 2009)
New Revision: 1652

Modified:
   branches/rel_1_0/src/javascript/DojoSRF.js
Log:
Backport r1651 from trunk - munge locale case for OpenSRF.


Modified: branches/rel_1_0/src/javascript/DojoSRF.js
===================================================================
--- branches/rel_1_0/src/javascript/DojoSRF.js	2009-02-04 03:55:56 UTC (rev 1651)
+++ branches/rel_1_0/src/javascript/DojoSRF.js	2009-02-04 03:57:04 UTC (rev 1652)
@@ -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