mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 07:25:46 +01:00
allow language strings in menu items
This commit is contained in:
@@ -2,46 +2,46 @@
|
|||||||
{
|
{
|
||||||
"id": "unread-count",
|
"id": "unread-count",
|
||||||
"route": "/unread",
|
"route": "/unread",
|
||||||
"title": "[[global:header.unread]]",
|
"title": "\\[\\[global:header.unread\\]\\]",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"iconClass": "fa-inbox",
|
"iconClass": "fa-inbox",
|
||||||
"textClass": "visible-xs-inline",
|
"textClass": "visible-xs-inline",
|
||||||
"text": "[[global:header.unread]]",
|
"text": "\\[\\[global:header.unread\\]\\]",
|
||||||
"properties": {
|
"properties": {
|
||||||
"loggedIn": true
|
"loggedIn": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"route": "/recent",
|
"route": "/recent",
|
||||||
"title": "[[global:header.recent]]",
|
"title": "\\[\\[global:header.recent\\]\\]",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"iconClass": "fa-clock-o",
|
"iconClass": "fa-clock-o",
|
||||||
"textClass": "visible-xs-inline",
|
"textClass": "visible-xs-inline",
|
||||||
"text": "[[global:header.recent]]"
|
"text": "\\[\\[global:header.recen\\t\\]]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"route": "/tags",
|
"route": "/tags",
|
||||||
"title": "[[global:header.tags]]",
|
"title": "\\[\\[global:header.tags\\]\\]",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"iconClass": "fa-tags",
|
"iconClass": "fa-tags",
|
||||||
"textClass": "visible-xs-inline",
|
"textClass": "visible-xs-inline",
|
||||||
"text": "[[global:header.tags]]"
|
"text": "\\[\\[global:header.tag\\s\\]]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"route": "/popular",
|
"route": "/popular",
|
||||||
"title": "[[global:header.popular]]",
|
"title": "\\[\\[global:header.popular\\]\\]",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"iconClass": "fa-fire",
|
"iconClass": "fa-fire",
|
||||||
"textClass": "visible-xs-inline",
|
"textClass": "visible-xs-inline",
|
||||||
"text": "[[global:header.popular]]"
|
"text": "\\[\\[global:header.popula\\r\\]]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"route": "/users",
|
"route": "/users",
|
||||||
"title": "[[global:header.users]]",
|
"title": "\\[\\[global:header.users\\]\\]",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"iconClass": "fa-user",
|
"iconClass": "fa-user",
|
||||||
"textClass": "visible-xs-inline",
|
"textClass": "visible-xs-inline",
|
||||||
"text": "[[global:header.users]]",
|
"text": "\\[\\[global:header.users\\]\\]",
|
||||||
"properties": {
|
"properties": {
|
||||||
"loggedIn": true,
|
"loggedIn": true,
|
||||||
"hideIfPrivate": true
|
"hideIfPrivate": true
|
||||||
@@ -49,31 +49,31 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"route": "/groups",
|
"route": "/groups",
|
||||||
"title": "[[global:header.groups]]",
|
"title": "\\[\\[global:header.groups\\]\\]",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"iconClass": "fa-group",
|
"iconClass": "fa-group",
|
||||||
"textClass": "visible-xs-inline",
|
"textClass": "visible-xs-inline",
|
||||||
"text": "[[global:header.groups]]"
|
"text": "\\[\\[global:header.group\\s\\]]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"route": "/admin",
|
"route": "/admin",
|
||||||
"target": "_top",
|
"target": "_top",
|
||||||
"title": "[[global:header.admin]]",
|
"title": "\\[\\[global:header.admin\\]\\]",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"iconClass": "fa-cogs",
|
"iconClass": "fa-cogs",
|
||||||
"textClass": "visible-xs-inline",
|
"textClass": "visible-xs-inline",
|
||||||
"text": "[[global:header.admin]]",
|
"text": "\\[\\[global:header.admin\\]\\]",
|
||||||
"properties": {
|
"properties": {
|
||||||
"adminOnly": true
|
"adminOnly": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"route": "/search",
|
"route": "/search",
|
||||||
"title": "[[global:header.search]]",
|
"title": "\\[\\[global:header.search\\]\\]",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"iconClass": "fa-search",
|
"iconClass": "fa-search",
|
||||||
"textClass": "visible-xs-inline",
|
"textClass": "visible-xs-inline",
|
||||||
"text": "[[global:header.search]]",
|
"text": "\\[\\[global:header.search\\]\\]",
|
||||||
"properties": {
|
"properties": {
|
||||||
"installed": {
|
"installed": {
|
||||||
"search": true
|
"search": true
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/* global define, app, ajaxify, socket, templates, bootbox */
|
/* global define, app, ajaxify, socket, templates, bootbox, translator */
|
||||||
|
|
||||||
define('admin/general/navigation', function() {
|
define('admin/general/navigation', function() {
|
||||||
var navigation = {},
|
var navigation = {},
|
||||||
@@ -8,6 +8,12 @@ define('admin/general/navigation', function() {
|
|||||||
navigation.init = function() {
|
navigation.init = function() {
|
||||||
available = JSON.parse(ajaxify.variables.get('available'));
|
available = JSON.parse(ajaxify.variables.get('available'));
|
||||||
|
|
||||||
|
$('#enabled').html(translator.unescape($('#enabled').html()));
|
||||||
|
translator.translate(translator.unescape($('#available').html()), function(html) {
|
||||||
|
$('#available').html(html);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#enabled')
|
$('#enabled')
|
||||||
.on('click', '.delete', remove)
|
.on('click', '.delete', remove)
|
||||||
.on('click', '.toggle', toggle)
|
.on('click', '.toggle', toggle)
|
||||||
@@ -33,7 +39,7 @@ define('admin/general/navigation', function() {
|
|||||||
data = id === 'custom' ? {} : available[id];
|
data = id === 'custom' ? {} : available[id];
|
||||||
|
|
||||||
templates.parse('admin/general/navigation', 'enabled', {enabled: [data]}, function(li) {
|
templates.parse('admin/general/navigation', 'enabled', {enabled: [data]}, function(li) {
|
||||||
li = $(li);
|
li = $(translator.unescape(li));
|
||||||
el.after(li);
|
el.after(li);
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
@@ -47,7 +53,7 @@ define('admin/general/navigation', function() {
|
|||||||
data = {};
|
data = {};
|
||||||
|
|
||||||
form.forEach(function(input) {
|
form.forEach(function(input) {
|
||||||
data[input.name] = input.value;
|
data[input.name] = translator.escape(input.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
available.forEach(function(item) {
|
available.forEach(function(item) {
|
||||||
|
|||||||
@@ -4,13 +4,21 @@
|
|||||||
var admin = {},
|
var admin = {},
|
||||||
async = require('async'),
|
async = require('async'),
|
||||||
plugins = require('../plugins'),
|
plugins = require('../plugins'),
|
||||||
db = require('../database');
|
db = require('../database'),
|
||||||
|
translator = require('../../public/src/translator');
|
||||||
|
|
||||||
|
|
||||||
admin.save = function(data, callback) {
|
admin.save = function(data, callback) {
|
||||||
var order = Object.keys(data),
|
var order = Object.keys(data),
|
||||||
items = data.map(function(item, idx) {
|
items = data.map(function(item, idx) {
|
||||||
var data = {};
|
var data = {};
|
||||||
|
|
||||||
|
for (var i in item) {
|
||||||
|
if (item.hasOwnProperty(i)) {
|
||||||
|
item[i] = typeof item[i] === 'string' ? translator.escape(item[i]) : item[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data[idx] = item;
|
data[idx] = item;
|
||||||
return JSON.stringify(data);
|
return JSON.stringify(data);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ var db = require('./database'),
|
|||||||
schemaDate, thisSchemaDate,
|
schemaDate, thisSchemaDate,
|
||||||
|
|
||||||
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
|
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
|
||||||
latestSchema = Date.UTC(2015, 1, 25, 4);
|
latestSchema = Date.UTC(2015, 1, 25, 6);
|
||||||
|
|
||||||
Upgrade.check = function(callback) {
|
Upgrade.check = function(callback) {
|
||||||
db.get('schemaDate', function(err, value) {
|
db.get('schemaDate', function(err, value) {
|
||||||
@@ -943,7 +943,7 @@ Upgrade.upgrade = function(callback) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
thisSchemaDate = Date.UTC(2015, 1, 25, 4);
|
thisSchemaDate = Date.UTC(2015, 1, 25, 6);
|
||||||
if (schemaDate < thisSchemaDate) {
|
if (schemaDate < thisSchemaDate) {
|
||||||
updatesMade = true;
|
updatesMade = true;
|
||||||
winston.info('[2015/02/25] Upgrading menu items to dynamic navigation system');
|
winston.info('[2015/02/25] Upgrading menu items to dynamic navigation system');
|
||||||
|
|||||||
Reference in New Issue
Block a user