From 07c29cf780e3319f0d696aa5d823e2d61d70f10a Mon Sep 17 00:00:00 2001 From: dbs Date: Mon, 23 Mar 2009 18:42:12 +0000 Subject: [PATCH] Remove hardcoded URLs for en-US locale; pull the preferred locale from our preferences git-svn-id: svn://svn.open-ils.org/ILS/trunk@12643 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../staff_client/chrome/content/main/constants.js | 27 +++++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index 5f4d62282..af6c40a05 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -1,5 +1,20 @@ dump('Loading constants.js\n'); +/* Get locale from preferences */ +var LOCALE = ''; +try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); + LOCALE = pref.getCharPref('general.useragent.locale'); +} catch (E) { + dump("Failed to fetch a locale from preferences: " + E + "\n"); +} + +/* Fall back to ' + LOCALE + ' if we didn't get a locale from the preferences */ +if (!LOCALE) { + LOCALE = '' + LOCALE + ''; +} + const MODE_RDONLY = 0x01; const MODE_WRONLY = 0x02; const MODE_CREATE = 0x08; @@ -231,11 +246,11 @@ const api = { const urls = { - 'opac' : '/opac/en-US/skin/default/xml/advanced.xml?nps=1', - 'opac_rdetail' : '/opac/en-US/skin/default/xml/rdetail.xml', - 'opac_rresult' : '/opac/en-US/skin/default/xml/rresult.xml', - 'org_tree' : '/opac/common/js/en-US/OrgTree.js', - 'browser' : '/opac/en-US/skin/default/xml/advanced.xml?nps=1', + 'opac' : '/opac/' + LOCALE + '/skin/default/xml/advanced.xml?nps=1', + 'opac_rdetail' : '/opac/' + LOCALE + '/skin/default/xml/rdetail.xml', + 'opac_rresult' : '/opac/' + LOCALE + '/skin/default/xml/rresult.xml', + 'org_tree' : '/opac/common/js/' + LOCALE + '/OrgTree.js', + 'browser' : '/opac/' + LOCALE + '/skin/default/xml/advanced.xml?nps=1', 'fieldmapper' : '/opac/common/js/fmall.js', 'isodate_lib_remote' : '/opac/common/js/DP_DateExtensions.js', 'isodate_lib_local' : 'chrome://open_ils_staff_client/content/OpenILS/util/DP_DateExtensions.js', @@ -327,5 +342,5 @@ const urls = { 'TEST_HTML' : '/xul/server/main/test.html', 'TEST_XUL' : '/xul/server/main/test.xul', 'VANDELAY' : '/vandelay/vandelay.xml', /* XXX how can we get the locale? */ - 'CONIFY' : '/conify/en-US/global/admin.html' /* XXX how can we get the locale? */ + 'CONIFY' : '/conify/' + LOCALE + '/global/admin.html' } -- 2.11.0