v1.18.x
barisusakli 9 years ago
parent 6644c66f94
commit e2f78a9585

@ -326,7 +326,10 @@ app.cacheBuster = null;
return;
}
require(['translator'], function(translator) {
title = config.titleLayout.replace(/{/g, '{').replace(/}/g, '}').replace('{pageTitle}', title).replace('{browserTitle}', config.browserTitle);
title = config.titleLayout.replace(/{/g, '{').replace(/}/g, '}')
.replace('{pageTitle}', function() { return title; })
.replace('{browserTitle}', function() { return config.browserTitle; });
translator.translate(title, function(translated) {
titleObj.titles[0] = translated;
app.alternatingTitle('');

@ -213,13 +213,14 @@
function insertLanguage(text, key, value, variables) {
if (value) {
var variable;
for (var i = 1, ii = variables.length; i < ii; i++) {
variable = S(variables[i]).chompRight(']]').collapseWhitespace().decodeHTMLEntities().escapeHTML().s;
value = value.replace('%' + i, variable);
}
variables.forEach(function(variable, index) {
if (index > 0) {
variable = S(variable).chompRight(']]').collapseWhitespace().decodeHTMLEntities().escapeHTML().s;
value = value.replace('%' + index, function() { return variable; });
}
});
text = text.replace(key, value);
text = text.replace(key, function() { return value; });
} else {
var string = key.split(':');
text = text.replace(key, string[string.length-1].replace(regexes.replace, ''));

@ -105,7 +105,11 @@ helpers.buildTitle = function(pageTitle) {
var browserTitle = validator.escape(meta.config.browserTitle || meta.config.title || 'NodeBB');
pageTitle = pageTitle || '';
var title = titleLayout.replace('{pageTitle}', pageTitle).replace('{browserTitle}', browserTitle);
var title = titleLayout.replace('{pageTitle}', function() {
return pageTitle;
}).replace('{browserTitle}', function() {
return browserTitle;
});
return title;
};

Loading…
Cancel
Save