From: dbs Date: Wed, 4 Feb 2009 03:55:56 +0000 (+0000) Subject: So, djfiander says "fix the code so it's not case-sensitive", so this seems to fix it. X-Git-Tag: osrf_rel_2_0_1~405 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=16d2e4c6cf7823944c7588fcbebf30f62b9e6b4d;p=OpenSRF.git 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. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1651 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/javascript/DojoSRF.js b/src/javascript/DojoSRF.js index 6b52594..e02ac98 100644 --- a/src/javascript/DojoSRF.js +++ b/src/javascript/DojoSRF.js @@ -17,8 +17,15 @@ if(!dojo._hasResource['DojoSRF']){ 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(); + } }