From b64ba40c67ff0900c9ca75945572bde38e48e269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 26 Jun 2017 17:27:48 -0400 Subject: [PATCH] closes #5772 --- package.json | 6 +++--- public/src/modules/translator.js | 2 +- src/middleware/header.js | 7 +++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 5bd0708d1d..af132aad8b 100644 --- a/package.json +++ b/package.json @@ -64,10 +64,10 @@ "nodebb-plugin-soundpack-default": "1.0.0", "nodebb-plugin-spam-be-gone": "0.5.0", "nodebb-rewards-essentials": "0.0.9", - "nodebb-theme-lavender": "4.0.1", - "nodebb-theme-persona": "5.0.10", + "nodebb-theme-lavender": "4.0.2", + "nodebb-theme-persona": "5.0.11", "nodebb-theme-slick": "1.1.0", - "nodebb-theme-vanilla": "6.0.6", + "nodebb-theme-vanilla": "6.0.7", "nodebb-widget-essentials": "3.0.0", "nodemailer": "2.6.4", "nodemailer-sendmail-transport": "1.0.0", diff --git a/public/src/modules/translator.js b/public/src/modules/translator.js index 5296e1eef4..8c68b0c06a 100644 --- a/public/src/modules/translator.js +++ b/public/src/modules/translator.js @@ -617,7 +617,7 @@ // Add directional code if necessary adaptor.translate('[[language:dir]]', function (value) { - if (value) { + if (value && !$('html').attr('data-dir')) { jQuery('html').css('direction', value).attr('data-dir', value); } }); diff --git a/src/middleware/header.js b/src/middleware/header.js index deb8d87cac..d5c3d53e6f 100644 --- a/src/middleware/header.js +++ b/src/middleware/header.js @@ -8,6 +8,7 @@ var user = require('../user'); var meta = require('../meta'); var plugins = require('../plugins'); var navigation = require('../navigation'); +var translator = require('../translator'); var controllers = { api: require('../controllers/api'), @@ -97,6 +98,11 @@ module.exports = function (middleware) { } db.get('uid:' + req.uid + ':confirm:email:sent', next); }, + languageDirection: function (next) { + translator.translate('[[language:dir]]', res.locals.config.userLang, function (translated) { + next(null, translated); + }); + }, navigation: async.apply(navigation.get), tags: async.apply(meta.tags.parse, req, res.locals.metaTags, res.locals.linkTags), banned: async.apply(user.isBanned, req.uid), @@ -135,6 +141,7 @@ module.exports = function (middleware) { templateValues.maintenanceHeader = parseInt(meta.config.maintenanceMode, 10) === 1 && !results.isAdmin; templateValues.defaultLang = meta.config.defaultLang || 'en-GB'; templateValues.userLang = res.locals.config.userLang; + templateValues.languageDirection = results.languageDirection; templateValues.privateUserInfo = parseInt(meta.config.privateUserInfo, 10) === 1; templateValues.privateTagListing = parseInt(meta.config.privateTagListing, 10) === 1;