Dojo IDL: Set the "Accept-Language" header
authorDan Scott <dscott@laurentian.ca>
Tue, 18 Dec 2012 13:52:55 +0000 (08:52 -0500)
committerDan Scott <dscott@laurentian.ca>
Wed, 19 Dec 2012 14:56:01 +0000 (09:56 -0500)
The internationalization support for /reports/fm_IDL.xml keys off of the
Accept-Language header - which, if not set to ^[a-z]{2}-[A-Z]{2}$, falls
back to en-US. Setting the header in the dojo.xhrGet() request makes
Apache able to serve up the right flavour of /reports/fm_IDL.xml

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Pasi Kallinen <pasi.kallinen@pttk.fi>
Open-ILS/web/js/dojo/fieldmapper/IDL.js

index 7efb967..8ccdca5 100644 (file)
@@ -4,8 +4,7 @@ if(!dojo._hasResource["fieldmapper.IDL"]) {
     dojo.provide("fieldmapper.IDL");
     dojo.declare('fieldmapper.IDL', null, {
     
-        _URL_PATH : '/reports/fm_IDL.xml', // XXX locale?
-        // -- just need to set up xmlent and use '/reports/'+OpenSRF.locale+'/fm_IDL.xml'
+        _URL_PATH : '/reports/fm_IDL.xml',
         NS_REPORTS : 'http://open-ils.org/spec/opensrf/IDL/reporter/v1',
         NS_PERSIST : 'http://open-ils.org/spec/opensrf/IDL/persistence/v1',
         NS_OBJ : 'http://open-ils.org/spec/opensrf/IDL/objects/v1',
@@ -56,6 +55,7 @@ if(!dojo._hasResource["fieldmapper.IDL"]) {
                         handleAs : 'xml',
                         sync : true,
                         timeout : 10000,
+                        headers : {"Accept-Language": OpenSRF.locale},
                         load : function (response) {
                             self._parse(response);
                             fieldmapper.IDL.loaded = true;