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'];
|
||||
|
||||
bootbox.setDefaults({
|
||||
locale: config.defaultLang
|
||||
locale: config.userLang
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,9 +128,9 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting
|
||||
var prevText = bodyEl.val();
|
||||
if (parseInt(tid, 10) !== parseInt(composer.posts[uuid].tid, 10)) {
|
||||
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 {
|
||||
translator.translate('[[modules:composer.user_said, ' + username + ']]\n', onTranslated);
|
||||
translator.translate('[[modules:composer.user_said, ' + username + ']]\n', config.defaultLang, onTranslated);
|
||||
}
|
||||
|
||||
function onTranslated(translated) {
|
||||
@@ -142,7 +142,7 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting
|
||||
};
|
||||
|
||||
composer.newReply = function(tid, pid, title, text) {
|
||||
translator.translate(text, function(translated) {
|
||||
translator.translate(text, config.defaultLang, function(translated) {
|
||||
push({
|
||||
tid: tid,
|
||||
toPid: pid,
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
|
||||
translator.prepareDOM = function() {
|
||||
// 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
|
||||
var languageCode;
|
||||
switch(config.defaultLang) {
|
||||
switch(config.userLang) {
|
||||
case 'cs':
|
||||
languageCode = 'cz';
|
||||
break;
|
||||
@@ -46,7 +46,7 @@
|
||||
break;
|
||||
|
||||
default:
|
||||
languageCode = config.defaultLang;
|
||||
languageCode = config.userLang;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
if (typeof language === 'function') {
|
||||
callback = language;
|
||||
if ('undefined' !== typeof window && config) {
|
||||
language = config.defaultLang || 'en_GB';
|
||||
language = config.userLang || 'en_GB';
|
||||
} else {
|
||||
var meta = require('../../src/meta');
|
||||
language = meta.config.defaultLang || 'en_GB';
|
||||
|
||||
@@ -42,6 +42,7 @@ apiController.getConfig = function(req, res, next) {
|
||||
config.maximumFileSize = meta.config.maximumFileSize;
|
||||
config['theme:id'] = meta.config['theme:id'];
|
||||
config.defaultLang = meta.config.defaultLang || 'en_GB';
|
||||
config.userLang = config.defaultLang;
|
||||
config.environment = process.env.NODE_ENV;
|
||||
config.loggedIn = !!req.user;
|
||||
config['cache-buster'] = meta.config['cache-buster'] || '';
|
||||
@@ -68,7 +69,7 @@ apiController.getConfig = function(req, res, next) {
|
||||
config.topicsPerPage = settings.topicsPerPage;
|
||||
config.postsPerPage = settings.postsPerPage;
|
||||
config.notificationSounds = settings.notificationSounds;
|
||||
config.defaultLang = settings.language || config.defaultLang;
|
||||
config.userLang = settings.language || config.defaultLang;
|
||||
config.openOutgoingLinksInNewTab = settings.openOutgoingLinksInNewTab;
|
||||
config.topicPostSort = settings.topicPostSort || config.topicPostSort;
|
||||
|
||||
|
||||
@@ -396,7 +396,7 @@ middleware.processRender = function(req, res, next) {
|
||||
middleware.renderHeader(req, res, function(err, template) {
|
||||
str = template + str;
|
||||
|
||||
translator.translate(str, res.locals.config.defaultLang, function(translated) {
|
||||
translator.translate(str, res.locals.config.userLang, function(translated) {
|
||||
fn(err, translated);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user