diff --git a/public/language/cs/global.json b/public/language/cs/global.json index fae988616c..3c8ac5a7a8 100644 --- a/public/language/cs/global.json +++ b/public/language/cs/global.json @@ -27,5 +27,11 @@ "header.profile": "Můj profil", "notifications.loading": "Načítání upozornění", - "chats.loading": "Načítání grafů" + "chats.loading": "Načítání grafů", + + "motd.welcome": "Vítejte na NodeBB, diskusní platformou budoucnosti.", + "motd.get": "Získat NodeBB", + "motd.fork": "Fork", + "motd.like": "To se mi líbí", + "motd.follow": "Sledovat" } diff --git a/public/language/de/global.json b/public/language/de/global.json index 51dd759117..925597bc57 100644 --- a/public/language/de/global.json +++ b/public/language/de/global.json @@ -27,5 +27,11 @@ "header.profile": "Profil", "notifications.loading": "Benachrichtigungen laden", - "chats.loading": "Nachrichten werden geladen" + "chats.loading": "Nachrichten werden geladen", + + "motd.welcome": "Willkommen auf NodeBB, der Diskussionsplattform der Zukunft.", + "motd.get": "Bekommen NodeBB", + "motd.fork": "Fork", + "motd.like": "Gefällt mir", + "motd.follow": "Folgen" } diff --git a/public/language/en/global.json b/public/language/en/global.json index 7fb54239af..6c41d49b2a 100644 --- a/public/language/en/global.json +++ b/public/language/en/global.json @@ -27,5 +27,11 @@ "header.profile": "Profile", "notifications.loading": "Loading Notifications", - "chats.loading": "Loading Chats" + "chats.loading": "Loading Chats", + + "motd.welcome": "Welcome to NodeBB, the discussion platform of the future.", + "motd.get": "Get NodeBB", + "motd.fork": "Fork", + "motd.like": "Like", + "motd.follow": "Follow" } diff --git a/public/language/es/global.json b/public/language/es/global.json index ab14fef5fd..706e856015 100644 --- a/public/language/es/global.json +++ b/public/language/es/global.json @@ -8,7 +8,7 @@ "404.message": "Al parecer lo que estas buscando no existe. Te recomendamos que vuelvas al inicio.", "500.title": "Error Interno.", "500.message": "Ooops! Algo salio mal!, No te alarmes. Nuestros simios hiperinteligentes lo solucionarán", - + "register": "Registrarse", "login": "Conectarse", @@ -27,5 +27,11 @@ "header.profile": "Perfil", "notifications.loading": "Cargando Notificaciones", - "chats.loading": "Cargando Chats" + "chats.loading": "Cargando Chats", + + "motd.welcome": "Bienvenido a NodeBB, la plataforma de debate sobre el futuro.", + "motd.get": "Obtener", + "motd.fork": "Fork", + "motd.like": "Me gusta", + "motd.follow": "Seguir" } \ No newline at end of file diff --git a/public/language/fr/global.json b/public/language/fr/global.json index e454103779..402f455708 100644 --- a/public/language/fr/global.json +++ b/public/language/fr/global.json @@ -27,5 +27,11 @@ "header.profile": "Profile", "notifications.loading": "Chargement des Notifications", - "chats.loading": "Chargement des Chats" + "chats.loading": "Chargement des Chats", + + "motd.welcome": "Bienvenue à NodeBB, la plate-forme de discussion sur l'avenir.", + "motd.get": "Obtenir NodeBB", + "motd.fork": "Fork", + "motd.like": "J'aime", + "motd.follow": "Suivre" } diff --git a/public/language/it/global.json b/public/language/it/global.json index eefc575898..9a79189a9c 100644 --- a/public/language/it/global.json +++ b/public/language/it/global.json @@ -27,5 +27,11 @@ "header.profile": "Profilo", "notifications.loading": "Caricamento delle Notifiche", - "chats.loading": "Caricamento delle Chat" + "chats.loading": "Caricamento delle Chat", + + "motd.welcome": "Benvenuti al NodeBB, la piattaforma di discussione del futuro.", + "motd.get": "Ottenere NodeBB", + "motd.fork": "Fork", + "motd.like": "Mi piace", + "motd.follow": "Segui" } \ No newline at end of file diff --git a/src/routes/api.js b/src/routes/api.js index 59bc61264c..9953d19567 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -12,6 +12,7 @@ var path = require('path'), categories = require('../categories'), categoryTools = require('../categoryTools') utils = require('../../public/src/utils'), + translator = require('../../public/src/translator'), pkg = require('../../package.json'), meta = require('../meta'); @@ -51,10 +52,12 @@ var path = require('path'), app.get('/home', function (req, res) { var uid = (req.user) ? req.user.uid : 0; categories.getAllCategories(uid, function (err, data) { + // Remove disabled categories data.categories = data.categories.filter(function (category) { return (!category.disabled || parseInt(category.disabled, 10) === 0); }); + // Retrieve category information for / function iterator(category, callback) { categories.getRecentReplies(category.cid, uid, parseInt(category.numRecentReplies, 10), function (err, posts) { category.posts = posts; @@ -64,10 +67,20 @@ var path = require('path'), } async.each(data.categories, iterator, function (err) { + // Assemble the MOTD + var motdString; + if (!meta.config.motd) { + // Construct default MOTD + translator.mget(['global:motd.welcome', 'global:motd.get', 'global:motd.fork', 'global:motd.like', 'global:motd.follow'], function(err, strings) { + motdString = '
\n\n# NodeBB v' + pkg.version + '\n' + strings[0]; + }); + } else { + motdString = meta.config.motd; + } data.motd_class = (parseInt(meta.config.show_motd, 10) === 1 || meta.config.show_motd === undefined) ? '' : ' none'; data.motd_class += (meta.config.motd && meta.config.motd.length > 0 ? '' : ' default'); - data.motd = require('marked')(meta.config.motd || "\n\n# NodeBB v" + pkg.version + "\nWelcome to NodeBB, the discussion platform of the future."); + data.motd = require('marked')(motdString); res.json(data); }); });