diff --git a/public/language/en-GB/admin/general/dashboard.json b/public/language/en-GB/admin/general/dashboard.json
index dab42d9d00..b82802db1b 100644
--- a/public/language/en-GB/admin/general/dashboard.json
+++ b/public/language/en-GB/admin/general/dashboard.json
@@ -14,6 +14,10 @@
"updates": "Updates",
"running-version": "You are running NodeBB v%1.",
"keep-updated": "Always make sure that your NodeBB is up to date for the latest security patches and bug fixes.",
+ "up-to-date": "
You are up-to-date
",
+ "upgrade-available": "A new version (v%1) has been released. Consider upgrading your NodeBB.
",
+ "prerelease-upgrade-available": "This is an outdated pre-release version of NodeBB. A new version (v%1) has been released. Consider upgrading your NodeBB.
",
+ "prerelease-warning": "This is a pre-release version of NodeBB. Unintended bugs may occur.
",
"notices": "Notices",
@@ -26,6 +30,10 @@
"realtime-chart-updates": "Realtime Chart Updates",
"active-users": "Active Users",
+ "active-users.users": "Users",
+ "active-users.guests": "Guests",
+ "active-users.total": "Total",
+ "active-users.connections": "Connections",
"anonymous-registered-users": "Anonymous vs Registered Users",
"anonymous": "Anonymous",
@@ -38,5 +46,10 @@
"recent": "Recent",
"unread": "Unread",
- "high-presence-topics": "High Presence Topics"
+ "high-presence-topics": "High Presence Topics",
+
+ "graphs.page-views": "Page Views",
+ "graphs.unique-visitors": "Unique Visitors",
+ "graphs.registered-users": "Registered Users",
+ "graphs.anonymous-users": "Anonymous Users"
}
\ No newline at end of file
diff --git a/public/language/en-GB/admin/general/social.json b/public/language/en-GB/admin/general/social.json
index 257e20b54b..23aedfcfaa 100644
--- a/public/language/en-GB/admin/general/social.json
+++ b/public/language/en-GB/admin/general/social.json
@@ -1,4 +1,5 @@
{
"post-sharing": "Post Sharing",
- "info-plugins-additional": "Plugins can add additional networks for sharing posts."
+ "info-plugins-additional": "Plugins can add additional networks for sharing posts.",
+ "save-success": "Successfully saved Post Sharing Networks!"
}
\ No newline at end of file
diff --git a/public/language/en-GB/admin/general/sounds.json b/public/language/en-GB/admin/general/sounds.json
index 42860f4b1c..95ccbde0f1 100644
--- a/public/language/en-GB/admin/general/sounds.json
+++ b/public/language/en-GB/admin/general/sounds.json
@@ -4,5 +4,6 @@
"play-sound": "Play",
"incoming-message": "Incoming Message",
"outgoing-message": "Outgoing Message",
- "upload-new-sound": "Upload New Sound"
+ "upload-new-sound": "Upload New Sound",
+ "saved": "Settings Saved"
}
\ No newline at end of file
diff --git a/public/src/admin/general/dashboard.js b/public/src/admin/general/dashboard.js
index 62ef80313a..f17be6fde2 100644
--- a/public/src/admin/general/dashboard.js
+++ b/public/src/admin/general/dashboard.js
@@ -1,22 +1,22 @@
"use strict";
/*global define, ajaxify, app, socket, utils, bootbox, RELATIVE_PATH*/
-define('admin/general/dashboard', ['semver', 'Chart'], function (semver, Chart) {
+define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (semver, Chart, translator) {
var Admin = {};
var intervals = {
- rooms: false,
- graphs: false
- };
+ rooms: false,
+ graphs: false
+ };
var isMobile = false;
var isPrerelease = /^v?\d+\.\d+\.\d+-.+$/;
var graphData = {
- rooms: {},
- traffic: {}
- };
+ rooms: {},
+ traffic: {}
+ };
var currentGraph = {
- units: 'hours',
- until: undefined
- };
+ units: 'hours',
+ until: undefined
+ };
var DEFAULTS = {
roomInterval: 10000,
@@ -53,23 +53,28 @@ define('admin/general/dashboard', ['semver', 'Chart'], function (semver, Chart)
var version = $('#version').html(),
latestVersion = releases[0].name.slice(1),
- checkEl = $('.version-check');
+ checkEl = $('.version-check'),
+ text;
// Alter box colour accordingly
if (semver.eq(latestVersion, version)) {
checkEl.removeClass('alert-info').addClass('alert-success');
- checkEl.append('You are up-to-date
');
+ text = '[[admin/general/dashboard:up-to-date]]';
} else if (semver.gt(latestVersion, version)) {
checkEl.removeClass('alert-info').addClass('alert-warning');
if (!isPrerelease.test(version)) {
- checkEl.append('A new version (v' + latestVersion + ') has been released. Consider upgrading your NodeBB.
');
+ text = '[[admin/general/dashboard:upgrade-available, ' + latestVersion + ']]';
} else {
- checkEl.append('This is an outdated pre-release version of NodeBB. A new version (v' + latestVersion + ') has been released. Consider upgrading your NodeBB.
');
+ text = '[[admin/general/dashboard:prerelease-upgrade-available, ' + latestVersion + ']]';
}
} else if (isPrerelease.test(version)) {
checkEl.removeClass('alert-info').addClass('alert-info');
- checkEl.append('This is a pre-release version of NodeBB. Unintended bugs may occur. .
');
+ text = '[[admin/general/dashboard:prerelease-warning]]';
}
+
+ translator.translate(text, function (text) {
+ checkEl.append(text);
+ });
});
$('[data-toggle="tooltip"]').tooltip();
@@ -92,26 +97,28 @@ define('admin/general/dashboard', ['semver', 'Chart'], function (semver, Chart)
var html = '' +
'
' + data.onlineRegisteredCount + '
' +
- '
Users
' +
+ '
[[admin/general/dashboard:active-users.users]]
' +
'
' +
'' +
'
' + data.onlineGuestCount + '
' +
- '
Guests
' +
+ '
[[admin/general/dashboard:active-users.guests]]
' +
'
' +
'' +
'
' + (data.onlineRegisteredCount + data.onlineGuestCount) + '
' +
- '
Total
' +
+ '
[[admin/general/dashboard:active-users.total]]
' +
'
' +
'' +
'
' + data.socketCount + '
' +
- '
Connections
' +
+ '
[[admin/general/dashboard:active-users.connections]]
' +
'
';
updateRegisteredGraph(data.onlineRegisteredCount, data.onlineGuestCount);
updatePresenceGraph(data.users);
updateTopicsGraph(data.topics);
- $('#active-users').html(html);
+ translator.translate(html, function (html) {
+ $('#active-users').html(html);
+ });
};
var graphs = {
@@ -168,119 +175,132 @@ define('admin/general/dashboard', ['semver', 'Chart'], function (semver, Chart)
Chart.defaults.global.tooltips.enabled = false;
}
- var data = {
- labels: trafficLabels,
- datasets: [
- {
- label: "Page Views",
- backgroundColor: "rgba(220,220,220,0.2)",
- borderColor: "rgba(220,220,220,1)",
- pointBackgroundColor: "rgba(220,220,220,1)",
- pointHoverBackgroundColor: "#fff",
- pointBorderColor: "#fff",
- pointHoverBorderColor: "rgba(220,220,220,1)",
- data: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
- },
- {
- label: "Unique Visitors",
- backgroundColor: "rgba(151,187,205,0.2)",
- borderColor: "rgba(151,187,205,1)",
- pointBackgroundColor: "rgba(151,187,205,1)",
- pointHoverBackgroundColor: "#fff",
- pointBorderColor: "#fff",
- pointHoverBorderColor: "rgba(151,187,205,1)",
- data: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+ var t = translator.Translator.create();
+ Promise.all([
+ t.translateKey('admin/general/dashboard:graphs.page-views', []),
+ t.translateKey('admin/general/dashboard:graphs.unique-visitors', []),
+ t.translateKey('admin/general/dashboard:graphs.registered-users', []),
+ t.translateKey('admin/general/dashboard:graphs.anonymous-users', []),
+ t.translateKey('admin/general/dashboard:on-categories', []),
+ t.translateKey('admin/general/dashboard:reading-posts', []),
+ t.translateKey('admin/general/dashboard:browsing-topics', []),
+ t.translateKey('admin/general/dashboard:recent', []),
+ t.translateKey('admin/general/dashboard:unread', []),
+ ]).then(function (translations) {
+ var data = {
+ labels: trafficLabels,
+ datasets: [
+ {
+ label: translations[0],
+ backgroundColor: "rgba(220,220,220,0.2)",
+ borderColor: "rgba(220,220,220,1)",
+ pointBackgroundColor: "rgba(220,220,220,1)",
+ pointHoverBackgroundColor: "#fff",
+ pointBorderColor: "#fff",
+ pointHoverBorderColor: "rgba(220,220,220,1)",
+ data: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+ },
+ {
+ label: translations[1],
+ backgroundColor: "rgba(151,187,205,0.2)",
+ borderColor: "rgba(151,187,205,1)",
+ pointBackgroundColor: "rgba(151,187,205,1)",
+ pointHoverBackgroundColor: "#fff",
+ pointBorderColor: "#fff",
+ pointHoverBorderColor: "rgba(151,187,205,1)",
+ data: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+ }
+ ]
+ };
+
+ trafficCanvas.width = $(trafficCanvas).parent().width();
+ graphs.traffic = new Chart(trafficCtx, {
+ type: 'line',
+ data: data,
+ options: {
+ responsive: true,
+ legend: {
+ display: false
+ },
+ scales: {
+ yAxes: [{
+ ticks: {
+ beginAtZero: true
+ }
+ }]
+ }
}
- ]
- };
-
- trafficCanvas.width = $(trafficCanvas).parent().width();
- graphs.traffic = new Chart(trafficCtx, {
- type: 'line',
- data: data,
- options: {
- responsive: true,
- legend: {
- display: false
- },
- scales: {
- yAxes: [{
- ticks: {
- beginAtZero: true
- }
+ });
+
+ graphs.registered = new Chart(registeredCtx, {
+ type: 'doughnut',
+ data: {
+ labels: translations.slice(2, 4),
+ datasets: [{
+ data: [1, 1],
+ backgroundColor: ["#F7464A", "#46BFBD"],
+ hoverBackgroundColor: ["#FF5A5E", "#5AD3D1"]
}]
+ },
+ options: {
+ responsive: true,
+ legend: {
+ display: false
+ }
}
- }
- });
-
- graphs.registered = new Chart(registeredCtx, {
- type: 'doughnut',
- data: {
- labels: ["Registered Users", "Anonymous Users"],
- datasets: [{
- data: [1, 1],
- backgroundColor: ["#F7464A", "#46BFBD"],
- hoverBackgroundColor: ["#FF5A5E", "#5AD3D1"]
- }]
- },
- options: {
- responsive: true,
- legend: {
- display: false
- }
- }
- });
+ });
- graphs.presence = new Chart(presenceCtx, {
- type: 'doughnut',
- data: {
- labels: ["On categories list", "Reading posts", "Browsing topics", "Recent", "Unread"],
- datasets: [{
- data: [1, 1, 1, 1, 1],
- backgroundColor: ["#F7464A", "#46BFBD", "#FDB45C", "#949FB1", "#9FB194"],
- hoverBackgroundColor: ["#FF5A5E", "#5AD3D1", "#FFC870", "#A8B3C5", "#A8B3C5"]
- }]
- },
- options: {
- responsive: true,
- legend: {
- display: false
+ graphs.presence = new Chart(presenceCtx, {
+ type: 'doughnut',
+ data: {
+ labels: translations.slice(4, 9),
+ datasets: [{
+ data: [1, 1, 1, 1, 1],
+ backgroundColor: ["#F7464A", "#46BFBD", "#FDB45C", "#949FB1", "#9FB194"],
+ hoverBackgroundColor: ["#FF5A5E", "#5AD3D1", "#FFC870", "#A8B3C5", "#A8B3C5"]
+ }]
+ },
+ options: {
+ responsive: true,
+ legend: {
+ display: false
+ }
}
- }
- });
+ });
- graphs.topics = new Chart(topicsCtx, {
- type: 'doughnut',
- data: {
- labels: [],
- datasets: [{
- data: [],
- backgroundColor: [],
- hoverBackgroundColor: []
- }]
- },
- options: {
- responsive: true,
- legend: {
- display: false
+ graphs.topics = new Chart(topicsCtx, {
+ type: 'doughnut',
+ data: {
+ labels: [],
+ datasets: [{
+ data: [],
+ backgroundColor: [],
+ hoverBackgroundColor: []
+ }]
+ },
+ options: {
+ responsive: true,
+ legend: {
+ display: false
+ }
}
- }
- });
+ });
- updateTrafficGraph();
+ updateTrafficGraph();
- $(window).on('resize', adjustPieCharts);
- adjustPieCharts();
+ $(window).on('resize', adjustPieCharts);
+ adjustPieCharts();
- $('[data-action="updateGraph"]').on('click', function () {
- var until;
- switch($(this).attr('data-until')) {
- case 'last-month':
- var lastMonth = new Date();
- lastMonth.setDate(lastMonth.getDate() - 30);
- until = lastMonth.getTime();
- }
- updateTrafficGraph($(this).attr('data-units'), until);
+ $('[data-action="updateGraph"]').on('click', function () {
+ var until;
+ switch($(this).attr('data-until')) {
+ case 'last-month':
+ var lastMonth = new Date();
+ lastMonth.setDate(lastMonth.getDate() - 30);
+ until = lastMonth.getTime();
+ }
+ updateTrafficGraph($(this).attr('data-units'), until);
+ });
});
}
diff --git a/public/src/admin/general/navigation.js b/public/src/admin/general/navigation.js
index 4c4256ddd1..3476780942 100644
--- a/public/src/admin/general/navigation.js
+++ b/public/src/admin/general/navigation.js
@@ -12,8 +12,8 @@ define('admin/general/navigation', ['translator', 'iconSelect', 'jqueryui'], fun
$(this).val(translator.unescape($(this).val()));
});
- translator.translate(translator.unescape($('#available').html()), function (html) {
- $('#available').html(html)
+ translator.translate($('#available').html(), function (html) {
+ $('#available').html(translator.unescape(html))
.find('li .drag-item').draggable({
connectToSortable: '#active-navigation',
helper: 'clone',
diff --git a/public/src/admin/general/social.js b/public/src/admin/general/social.js
index 9accf87417..cfcc3d3c52 100644
--- a/public/src/admin/general/social.js
+++ b/public/src/admin/general/social.js
@@ -18,7 +18,7 @@ define('admin/general/social', [], function () {
return app.alertError(err);
}
- app.alertSuccess('Successfully saved Post Sharing Networks!');
+ app.alertSuccess('[[admin/general/social:save-success]]');
});
});
};
diff --git a/public/src/admin/general/sounds.js b/public/src/admin/general/sounds.js
index 0ea87f0917..64926e60db 100644
--- a/public/src/admin/general/sounds.js
+++ b/public/src/admin/general/sounds.js
@@ -23,7 +23,7 @@ define('admin/general/sounds', ['sounds', 'settings'], function (Sounds, Setting
socket.emit('admin.fireEvent', {
name: 'event:sounds.reloadMapping'
});
- app.alertSuccess('Settings Saved');
+ app.alertSuccess('[[admin/general/sounds:saved]]');
});
});
};
diff --git a/src/views/admin/general/dashboard.tpl b/src/views/admin/general/dashboard.tpl
index 2e42dd8430..cc1d8d97ce 100644
--- a/src/views/admin/general/dashboard.tpl
+++ b/src/views/admin/general/dashboard.tpl
@@ -104,7 +104,7 @@
[[admin/general/dashboard:restart-warning]]
- [[maintenance-mode]]
+ [[admin/general/dashboard:maintenance-mode]]
diff --git a/src/views/admin/general/navigation.tpl b/src/views/admin/general/navigation.tpl
index 5143bea7b2..3d3d17f096 100644
--- a/src/views/admin/general/navigation.tpl
+++ b/src/views/admin/general/navigation.tpl
@@ -127,7 +127,7 @@
{available.text} {available.route}
- [[admin/general/navigation:core]] [[plugin]]
+ [[admin/general/navigation:core]] [[admin/general/navigation:plugin]]