From 295672f5987f40e7c6ee0cca05f9658374d4b2c7 Mon Sep 17 00:00:00 2001 From: Brian Lim Date: Sun, 17 Jan 2016 21:44:03 -0500 Subject: [PATCH] Set language cookie on initial load --- src/node/hooks/express/specialpages.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/node/hooks/express/specialpages.js b/src/node/hooks/express/specialpages.js index 15e853db4..e8d7795a6 100644 --- a/src/node/hooks/express/specialpages.js +++ b/src/node/hooks/express/specialpages.js @@ -2,6 +2,7 @@ var path = require('path'); var eejs = require('ep_etherpad-lite/node/eejs'); var toolbar = require("ep_etherpad-lite/node/utils/toolbar"); var hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks'); +var settings = require('../../utils/Settings'); exports.expressCreateServer = function (hook_name, args, cb) { // expose current stats @@ -33,6 +34,13 @@ exports.expressCreateServer = function (hook_name, args, cb) { //serve pad.html under /p args.app.get('/p/:pad', function(req, res, next) { + // Set language for pad editor for the first time + // Or if language cookie doesn't exist + if (req.cookies.language === undefined) + { + res.cookie('language', settings.padOptions.lang); + } + // The below might break for pads being rewritten var isReadOnly = req.url.indexOf("/p/r.") === 0; @@ -54,7 +62,7 @@ exports.expressCreateServer = function (hook_name, args, cb) { hooks.callAll("padInitToolbar", { toolbar: toolbar }); - + res.send(eejs.require("ep_etherpad-lite/templates/timeslider.html", { req: req, toolbar: toolbar