renamed language directories to ICU standard, upgrade script, no longer promoting english at top of list in languages tab, en now en_GB, encompasses Canadian and English English

v1.18.x
Julian Lam 11 years ago
parent d8eec5dd2e
commit 0376e3d574

@ -1,4 +0,0 @@
{
"name": "English",
"code": "en"
}

@ -0,0 +1,4 @@
{
"name": "English (United Kingdom/Canada)",
"code": "en_GB"
}

@ -1,4 +1,4 @@
{
"name": "Português Brasileiro",
"code": "pt_br"
"code": "pt_BR"
}

@ -1,4 +1,4 @@
{
"name": "简体中文",
"code": "zh_cn"
"code": "zh_CN"
}

@ -1,4 +1,4 @@
{
"name": "簡體中文",
"code": "zh_tw"
"code": "zh_TW"
}

@ -31,7 +31,7 @@
translator.prepareDOM = function() {
// Load the appropriate timeago locale file
if (config.defaultLang !== 'en') {
if (config.defaultLang !== 'en_GB') {
// Correct NodeBB language codes to timeago codes, if necessary
var languageCode;
switch(config.defaultLang) {
@ -39,15 +39,15 @@
languageCode = 'cz';
break;
case 'zh_tw':
case 'zh_TW':
languageCode = 'zh-TW';
break;
case 'zh_cn':
case 'zh_CN':
languageCode = 'zh-CN';
break;
case 'pt_br':
case 'pt_BR':
languageCode = 'pt-br';
break;
@ -203,7 +203,7 @@
fs = require('fs'),
winston = require('winston');
utils.walk(path.join(__dirname, '../language', (Meta.config.defaultLang || 'en')), function (err, data) {
utils.walk(path.join(__dirname, '../language', (Meta.config.defaultLang || 'en_GB')), function (err, data) {
var loaded = data.length;
for (var d in data) {

@ -32,15 +32,9 @@ Languages.list = function(callback) {
}
});
}, function(err) {
// Float "en" to the top, otherwise sort alphabetically
// Sort alphabetically
languages = languages.sort(function(a, b) {
if (a.code === 'en') {
return -1;
} else if (b.code === 'en') {
return 1;
} else {
return a.code > b.code;
}
return a.code > b.code ? 1 : -1;
});
callback(err, languages);

@ -47,7 +47,7 @@ var path = require('path'),
config.topicsPerPage = meta.config.topicsPerPage || 20;
config.postsPerPage = meta.config.postsPerPage || 20;
config.maximumFileSize = meta.config.maximumFileSize;
config.defaultLang = meta.config.defaultLang || 'en';
config.defaultLang = meta.config.defaultLang || 'en_GB';
res.json(200, config);
});

@ -19,7 +19,7 @@ var db = require('./database'),
Upgrade.check = function(callback) {
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
var latestSchema = new Date(2014, 0, 27, 12, 35).getTime();
var latestSchema = new Date(2014, 0, 30, 15, 0).getTime();
db.get('schemaDate', function(err, value) {
if (parseInt(value, 10) >= latestSchema) {
@ -404,6 +404,31 @@ Upgrade.upgrade = function(callback) {
winston.info('[2014/1/25] Activating SSO plugins, if set up -- skipped');
next();
}
},
function(next) {
thisSchemaDate = new Date(2014, 0, 30, 15, 0).getTime();
if (schemaDate < thisSchemaDate) {
updatesMade = true;
if (Meta.config.defaultLang === 'en') {
Meta.configs.set('defaultLang', 'en_GB', next);
} else if (Meta.config.defaultLang === 'pt_br') {
Meta.configs.set('defaultLang', 'pt_BR', next);
} else if (Meta.config.defaultLang === 'zh_cn') {
Meta.configs.set('defaultLang', 'zh_CN', next);
} else if (Meta.config.defaultLang === 'zh_tw') {
Meta.configs.set('defaultLang', 'zh_TW', next);
} else {
winston.info('[2014/1/30] Fixing language settings -- skipped');
return next();
}
winston.info('[2014/1/30] Fixing language settings');
next();
} else {
winston.info('[2014/1/30] Fixing language settings -- skipped');
next();
}
}
// Add new schema updates here
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 17!!!

Loading…
Cancel
Save