From 714355349f30f6d459f8a181eee107da12495484 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Thu, 22 Oct 2015 23:36:57 -0400 Subject: [PATCH] Explicitly set `Accept-Language` to cookie lang So that xhr requests to scratchr2 can get the right language --- src/mixins/api.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mixins/api.jsx b/src/mixins/api.jsx index c65826a17..be344bd32 100644 --- a/src/mixins/api.jsx +++ b/src/mixins/api.jsx @@ -1,5 +1,7 @@ var defaults = require('lodash.defaults'); var xhr = require('xhr'); + +var jar = require('../lib/jar.js'); var log = require('../lib/log.js'); var CookieMixinFactory = require('./cookieMixinFactory.jsx'); @@ -30,6 +32,9 @@ var Api = { }); }.bind(this); + if (typeof jar.get('scratchlanguage') !== 'undefined') { + opts.headers['Accept-Language'] = jar.get('scratchlanguage') + ', en;q=0.8'; + } if (opts.useCsrf) { this.useScratchcsrftoken(function (err, csrftoken) { if (err) return log.error('Error while retrieving CSRF token', err);