mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 08:25:46 +01:00
closes #2015
This commit is contained in:
@@ -147,7 +147,7 @@ var socket,
|
|||||||
app.cacheBuster = config['cache-buster'];
|
app.cacheBuster = config['cache-buster'];
|
||||||
|
|
||||||
bootbox.setDefaults({
|
bootbox.setDefaults({
|
||||||
locale: config.defaultLang
|
locale: config.userLang
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,9 +128,9 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting
|
|||||||
var prevText = bodyEl.val();
|
var prevText = bodyEl.val();
|
||||||
if (parseInt(tid, 10) !== parseInt(composer.posts[uuid].tid, 10)) {
|
if (parseInt(tid, 10) !== parseInt(composer.posts[uuid].tid, 10)) {
|
||||||
var link = '[' + title + '](/topic/' + topicSlug + '/' + (parseInt(postIndex, 10) + 1) + ')';
|
var link = '[' + title + '](/topic/' + topicSlug + '/' + (parseInt(postIndex, 10) + 1) + ')';
|
||||||
translator.translate('[[modules:composer.user_said_in, ' + username + ', ' + link + ']]\n', onTranslated);
|
translator.translate('[[modules:composer.user_said_in, ' + username + ', ' + link + ']]\n', config.defaultLang, onTranslated);
|
||||||
} else {
|
} else {
|
||||||
translator.translate('[[modules:composer.user_said, ' + username + ']]\n', onTranslated);
|
translator.translate('[[modules:composer.user_said, ' + username + ']]\n', config.defaultLang, onTranslated);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTranslated(translated) {
|
function onTranslated(translated) {
|
||||||
@@ -142,7 +142,7 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting
|
|||||||
};
|
};
|
||||||
|
|
||||||
composer.newReply = function(tid, pid, title, text) {
|
composer.newReply = function(tid, pid, title, text) {
|
||||||
translator.translate(text, function(translated) {
|
translator.translate(text, config.defaultLang, function(translated) {
|
||||||
push({
|
push({
|
||||||
tid: tid,
|
tid: tid,
|
||||||
toPid: pid,
|
toPid: pid,
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
|
|
||||||
translator.prepareDOM = function() {
|
translator.prepareDOM = function() {
|
||||||
// Load the appropriate timeago locale file
|
// Load the appropriate timeago locale file
|
||||||
if (config.defaultLang !== 'en_GB' && config.defaultLang !== 'en_US') {
|
if (config.userLang !== 'en_GB' && config.userLang !== 'en_US') {
|
||||||
// Correct NodeBB language codes to timeago codes, if necessary
|
// Correct NodeBB language codes to timeago codes, if necessary
|
||||||
var languageCode;
|
var languageCode;
|
||||||
switch(config.defaultLang) {
|
switch(config.userLang) {
|
||||||
case 'cs':
|
case 'cs':
|
||||||
languageCode = 'cz';
|
languageCode = 'cz';
|
||||||
break;
|
break;
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
languageCode = config.defaultLang;
|
languageCode = config.userLang;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
if (typeof language === 'function') {
|
if (typeof language === 'function') {
|
||||||
callback = language;
|
callback = language;
|
||||||
if ('undefined' !== typeof window && config) {
|
if ('undefined' !== typeof window && config) {
|
||||||
language = config.defaultLang || 'en_GB';
|
language = config.userLang || 'en_GB';
|
||||||
} else {
|
} else {
|
||||||
var meta = require('../../src/meta');
|
var meta = require('../../src/meta');
|
||||||
language = meta.config.defaultLang || 'en_GB';
|
language = meta.config.defaultLang || 'en_GB';
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ apiController.getConfig = function(req, res, next) {
|
|||||||
config.maximumFileSize = meta.config.maximumFileSize;
|
config.maximumFileSize = meta.config.maximumFileSize;
|
||||||
config['theme:id'] = meta.config['theme:id'];
|
config['theme:id'] = meta.config['theme:id'];
|
||||||
config.defaultLang = meta.config.defaultLang || 'en_GB';
|
config.defaultLang = meta.config.defaultLang || 'en_GB';
|
||||||
|
config.userLang = config.defaultLang;
|
||||||
config.environment = process.env.NODE_ENV;
|
config.environment = process.env.NODE_ENV;
|
||||||
config.loggedIn = !!req.user;
|
config.loggedIn = !!req.user;
|
||||||
config['cache-buster'] = meta.config['cache-buster'] || '';
|
config['cache-buster'] = meta.config['cache-buster'] || '';
|
||||||
@@ -68,7 +69,7 @@ apiController.getConfig = function(req, res, next) {
|
|||||||
config.topicsPerPage = settings.topicsPerPage;
|
config.topicsPerPage = settings.topicsPerPage;
|
||||||
config.postsPerPage = settings.postsPerPage;
|
config.postsPerPage = settings.postsPerPage;
|
||||||
config.notificationSounds = settings.notificationSounds;
|
config.notificationSounds = settings.notificationSounds;
|
||||||
config.defaultLang = settings.language || config.defaultLang;
|
config.userLang = settings.language || config.defaultLang;
|
||||||
config.openOutgoingLinksInNewTab = settings.openOutgoingLinksInNewTab;
|
config.openOutgoingLinksInNewTab = settings.openOutgoingLinksInNewTab;
|
||||||
config.topicPostSort = settings.topicPostSort || config.topicPostSort;
|
config.topicPostSort = settings.topicPostSort || config.topicPostSort;
|
||||||
|
|
||||||
|
|||||||
@@ -396,7 +396,7 @@ middleware.processRender = function(req, res, next) {
|
|||||||
middleware.renderHeader(req, res, function(err, template) {
|
middleware.renderHeader(req, res, function(err, template) {
|
||||||
str = template + str;
|
str = template + str;
|
||||||
|
|
||||||
translator.translate(str, res.locals.config.defaultLang, function(translated) {
|
translator.translate(str, res.locals.config.userLang, function(translated) {
|
||||||
fn(err, translated);
|
fn(err, translated);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user