mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
closes #4362
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 + '<script id="ajaxify-data" type="application/json">' + ajaxifyData + '</script>';
|
||||
fn(err, translated);
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user