From 16d2e4c6cf7823944c7588fcbebf30f62b9e6b4d Mon Sep 17 00:00:00 2001 From: dbs Date: Wed, 4 Feb 2009 03:55:56 +0000 Subject: [PATCH] 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 --- src/javascript/DojoSRF.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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(); + } } -- 2.11.0