diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index ecd8276c69..8450f1c2ab 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -154,6 +154,7 @@ $(document).ready(function() { templates.parse(tpl_url, data, function(template) { translator.translate(template, function(translatedTemplate) { + translatedTemplate = translator.unescape(translatedTemplate); $('body').addClass(data.bodyClass); $('#content').html(translatedTemplate); diff --git a/public/src/app.js b/public/src/app.js index 4f7b009a30..65276bc798 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -521,6 +521,7 @@ app.cacheBuster = null; if (typeof blockName === 'string') { templates.parse(template, blockName, data, function(html) { translator.translate(html, function(translatedHTML) { + translatedHTML = translator.unescape(translatedHTML); callback($(translatedHTML)); }); }); @@ -528,6 +529,7 @@ app.cacheBuster = null; callback = data, data = blockName; templates.parse(template, data, function(html) { translator.translate(html, function(translatedHTML) { + translatedHTML = translator.unescape(translatedHTML); callback($(translatedHTML)); }); }); diff --git a/public/src/client/topic/events.js b/public/src/client/topic/events.js index ba8c77598e..d65a1c7c47 100644 --- a/public/src/client/topic/events.js +++ b/public/src/client/topic/events.js @@ -114,7 +114,7 @@ define('forum/topic/events', [ } editedPostEl.fadeOut(250, function() { - editedPostEl.html(data.post.content); + editedPostEl.html(translator.unescape(data.post.content)); editedPostEl.find('img:not(.not-responsive)').addClass('img-responsive'); app.replaceSelfLinks(editedPostEl.find('a')); posts.wrapImagesInLinks(editedPostEl.parent()); @@ -186,7 +186,7 @@ define('forum/topic/events', [ if (isDeleted) { postEl.find('[component="post/content"]').translateHtml('[[topic:post_is_deleted]]'); } else { - postEl.find('[component="post/content"]').html(data.content); + postEl.find('[component="post/content"]').html(translator.unescape(data.content)); } } } diff --git a/src/middleware/render.js b/src/middleware/render.js index 9ae7a50253..2a9d0ba5d2 100644 --- a/src/middleware/render.js +++ b/src/middleware/render.js @@ -72,6 +72,7 @@ module.exports = function(middleware) { var language = res.locals.config ? res.locals.config.userLang || 'en_GB' : 'en_GB'; language = req.query.lang || language; translator.translate(str, language, function(translated) { + translated = translator.unescape(translated); translated = translated + ''; fn(err, translated); }); diff --git a/src/posts/parse.js b/src/posts/parse.js index efa5667ccc..1af374305d 100644 --- a/src/posts/parse.js +++ b/src/posts/parse.js @@ -3,6 +3,7 @@ var cache = require('./cache'); var plugins = require('../plugins'); +var translator = require('../../public/src/modules/translator'); module.exports = function(Posts) { @@ -24,6 +25,8 @@ module.exports = function(Posts) { return callback(err); } + data.postData.content = translator.escape(data.postData.content); + if (global.env === 'production' && data.postData.pid) { cache.set(data.postData.pid, data.postData.content); }