`admin/extend` JS translations and misc

v1.18.x
Peter Jaszkowiak 8 years ago committed by Julian Lam
parent 38eba81933
commit 95bef8f3f6

@ -3,6 +3,8 @@
"active": "Active", "active": "Active",
"inactive": "Inactive", "inactive": "Inactive",
"out-of-date": "Out of Date", "out-of-date": "Out of Date",
"none-found": "No plugins found.",
"none-active": "No Active Plugins",
"find-plugins": "Find Plugins", "find-plugins": "Find Plugins",
"plugin-search": "Plugin Search", "plugin-search": "Plugin Search",
@ -25,5 +27,20 @@
"plugin-item.upgrade": "Upgrade", "plugin-item.upgrade": "Upgrade",
"plugin-item.more-info": "For more information:", "plugin-item.more-info": "For more information:",
"plugin-item.unknown": "Unknown", "plugin-item.unknown": "Unknown",
"plugin-item.unknown-explanation": "The state of this plugin could not be determined, possibly due to a misconfiguration error." "plugin-item.unknown-explanation": "The state of this plugin could not be determined, possibly due to a misconfiguration error.",
"alert.enabled": "Plugin Enabled",
"alert.disabled": "Plugin Disabled",
"alert.upgraded": "Plugin Upgraded",
"alert.installed": "Plugin Installed",
"alert.uninstalled": "Plugin Uninstalled",
"alert.activate-success": "Please restart your NodeBB to fully activate this plugin",
"alert.deactivate-success": "Plugin successfully deactivated",
"alert.upgrade-success": "Please reload your NodeBB to fully upgrade this plugin",
"alert.install-success": "Plugin successfully installed, please activate the plugin.",
"alert.uninstall-success": "The plugin has been successfully deactivated and uninstalled.",
"alert.suggest-error": "<p>NodeBB could not reach the package manager, proceed with installation of latest version?</p><div class=\"alert alert-danger\"><strong>Server returned (%1)</strong>: %2</div>",
"alert.package-manager-unreachable": "<p>NodeBB could not reach the package manager, an upgrade is not suggested at this time.</p>",
"alert.incompatible": "<p>Your version of NodeBB (v%1) is only cleared to upgrade to v%2 of this plugin. Please update your NodeBB if you wish to install a newer version of this plugin.</p>",
"alert.possibly-incompatible": "<div class=\"alert alert-warning\"><p><strong>No Compatibility Information Found</strong></p><p>This plugin did not specify a specific version for installation given your NodeBB version. Full compatibility cannot be guaranteed, and may cause your NodeBB to no longer start properly.</p></div><p>In the event that NodeBB cannot boot properly:</p><pre><code>$ ./nodebb reset plugin=\"%1\"</code></pre><p>Continue installation of latest version of this plugin?</p>"
} }

@ -9,5 +9,9 @@
"enable": "Enable", "enable": "Enable",
"disable": "Disable", "disable": "Disable",
"control-panel": "Rewards Control", "control-panel": "Rewards Control",
"new-reward": "New Reward" "new-reward": "New Reward",
"alert.delete-success": "Successfully deleted reward",
"alert.no-inputs-found": "Illegal reward - no inputs found!",
"alert.save-success": "Successfully saved rewards"
} }

@ -10,5 +10,10 @@
"container.panel": "Panel", "container.panel": "Panel",
"container.panel-header": "Panel Header", "container.panel-header": "Panel Header",
"container.panel-body": "Panel Body", "container.panel-body": "Panel Body",
"container.alert": "Alert" "container.alert": "Alert",
"alert.confirm-delete": "Are you sure you wish to delete this widget?",
"alert.updated": "Widgets Updated",
"alert.update-success": "Successfully updated widgets"
} }

@ -39,29 +39,27 @@ define('admin/appearance/themes', ['translator'], function (translator) {
}); });
} }
}); });
translator.translate('[[admin/appearance/themes:revert-confirm]]', function (revert) { $('#revert_theme').on('click', function () {
$('#revert_theme').on('click', function () { bootbox.confirm('[[admin/appearance/themes:revert-confirm]]', function (confirm) {
bootbox.confirm(revert, function (confirm) { if (confirm) {
if (confirm) { socket.emit('admin.themes.set', {
socket.emit('admin.themes.set', { type: 'local',
type: 'local', id: 'nodebb-theme-persona'
id: 'nodebb-theme-persona' }, function (err) {
}, function (err) { if (err) {
if (err) { return app.alertError(err.message);
return app.alertError(err.message); }
} highlightSelectedTheme('nodebb-theme-persona');
highlightSelectedTheme('nodebb-theme-persona'); app.alert({
app.alert({ alert_id: 'admin:theme',
alert_id: 'admin:theme', type: 'success',
type: 'success', title: '[[admin/appearance/themes:theme-changed]]',
title: '[[admin/appearance/themes:theme-changed]]', message: '[[admin/appearance/themes:revert-success]]',
message: '[[admin/appearance/themes:revert-success]]', timeout: 3500
timeout: 3500
});
}); });
} });
}); }
}); });
}); });

@ -1,7 +1,7 @@
"use strict"; "use strict";
/* global define, app, socket, bootbox */ /* global define, app, socket, bootbox */
define('admin/extend/plugins', ['jqueryui'], function (jqueryui) { define('admin/extend/plugins', ['jqueryui', 'translator'], function (jqueryui, translator) {
var Plugins = {}; var Plugins = {};
Plugins.init = function () { Plugins.init = function () {
var pluginsList = $('.plugins'), var pluginsList = $('.plugins'),
@ -9,7 +9,9 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
pluginID; pluginID;
if (!numPlugins) { if (!numPlugins) {
pluginsList.append('<li><p><i>No plugins found.</i></p></li>'); translator.translate('<li><p><i>[[admin/extend/plugins:none-found]]</i></p></li>', function (html) {
pluginsList.append(html);
});
return; return;
} }
@ -23,25 +25,27 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
if (err) { if (err) {
return app.alertError(err); return app.alertError(err);
} }
btn.html('<i class="fa fa-power-off"></i> ' + (status.active ? 'Deactivate' : 'Activate')); translator.translate('<i class="fa fa-power-off"></i> [[admin/extend/plugins:plugin-item.' + (status.active ? 'deactivate' : 'activate') + ']]', function (buttonText) {
btn.toggleClass('btn-warning', status.active).toggleClass('btn-success', !status.active); btn.html(buttonText);
btn.toggleClass('btn-warning', status.active).toggleClass('btn-success', !status.active);
//clone it to active plugins tab
if (status.active && !$('#active #' + pluginID).length) {
$('#active ul').prepend(pluginEl.clone(true));
}
app.alert({ //clone it to active plugins tab
alert_id: 'plugin_toggled', if (status.active && !$('#active #' + pluginID).length) {
title: 'Plugin ' + (status.active ? 'Enabled' : 'Disabled'), $('#active ul').prepend(pluginEl.clone(true));
message: status.active ? 'Please restart your NodeBB to fully activate this plugin' : 'Plugin successfully deactivated',
type: status.active ? 'warning' : 'success',
timeout: 5000,
clickfn: function () {
require(['admin/modules/instance'], function (instance) {
instance.restart();
});
} }
app.alert({
alert_id: 'plugin_toggled',
title: '[[admin/extend/plugins:alert.' + (status.active ? 'enabled' : 'disabled') + ']]',
message: '[[admin/extend/plugins:alert.' + (status.active ? 'activate-success' : 'deactivate-success') + ']]',
type: status.active ? 'warning' : 'success',
timeout: 5000,
clickfn: function () {
require(['admin/modules/instance'], function (instance) {
instance.restart();
});
}
});
}); });
}); });
}); });
@ -57,7 +61,7 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
Plugins.suggest(pluginID, function (err, payload) { Plugins.suggest(pluginID, function (err, payload) {
if (err) { if (err) {
bootbox.confirm('<p>NodeBB could not reach the package manager, proceed with installation of latest version?</p><div class="alert alert-danger"><strong>Server returned (' + err.status + ')</strong>: ' + err.responseText + '</div>', function (confirm) { bootbox.confirm(translator.compile('admin/extend/plugins:alert.suggest-error', err.status, err.responseText), function (confirm) {
if (confirm) { if (confirm) {
Plugins.toggleInstall(pluginID, 'latest'); Plugins.toggleInstall(pluginID, 'latest');
} else { } else {
@ -92,7 +96,7 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
Plugins.suggest(pluginID, function (err, payload) { Plugins.suggest(pluginID, function (err, payload) {
if (err) { if (err) {
return bootbox.alert('<p>NodeBB could not reach the package manager, an upgrade is not suggested at this time.</p>'); return bootbox.alert('[[admin/extend/plugins:alert.package-manager-unreachable]]');
} }
require(['semver'], function (semver) { require(['semver'], function (semver) {
@ -103,7 +107,7 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
upgrade(pluginID, btn, payload.version); upgrade(pluginID, btn, payload.version);
}); });
} else { } else {
bootbox.alert('<p>Your version of NodeBB (v' + app.config.version + ') is only cleared to upgrade to v' + payload.version + ' of this plugin. Please update your NodeBB if you wish to install a newer version of this plugin.'); bootbox.alert(translator.compile('admin/extend/plugins:alert.incompatible', app.config.version, payload.version));
} }
}); });
}); });
@ -128,7 +132,10 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
html += '<li class="">' + plugin + '</li>'; html += '<li class="">' + plugin + '</li>';
}); });
if (!activePlugins.length) { if (!activePlugins.length) {
html = 'No Active Plugins'; translator.translate('[[admin/extend/plugins:none-active]]', function (text) {
$('#order-active-plugins-modal .plugin-list').html(text).sortable();
});
return;
} }
$('#order-active-plugins-modal .plugin-list').html(html).sortable(); $('#order-active-plugins-modal .plugin-list').html(html).sortable();
}); });
@ -154,11 +161,7 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
}; };
function confirmInstall(pluginID, callback) { function confirmInstall(pluginID, callback) {
bootbox.confirm( bootbox.confirm(translator.compile('admin/extend/plugins:alert.possibly-incompatible', pluginID), function (confirm) {
'<div class="alert alert-warning"><p><strong>No Compatibility Infomation Found</strong></p><p>This plugin did not specify a specific version for installation given your NodeBB version. Full compatibility cannot be guaranteed, and may cause your NodeBB to no longer start properly.</p></div>' +
'<p>In the event that NodeBB cannot boot properly:</p>' +
'<pre><code>$ ./nodebb reset plugin="' + pluginID + '"</code></pre>' +
'<p>Continue installation of latest version of this plugin?</p>', function (confirm) {
callback(confirm); callback(confirm);
}); });
} }
@ -179,8 +182,8 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
if (isActive) { if (isActive) {
app.alert({ app.alert({
alert_id: 'plugin_upgraded', alert_id: 'plugin_upgraded',
title: 'Plugin Upgraded', title: '[[admin/extend/plugins:alert.upgraded]]',
message: 'Please reload your NodeBB to fully upgrade this plugin', message: '[[admin/extend/plugins:alert.upgrade-success]]',
type: 'warning', type: 'warning',
timeout: 5000, timeout: 5000,
clickfn: function () { clickfn: function () {
@ -211,8 +214,8 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) {
app.alert({ app.alert({
alert_id: 'plugin_toggled', alert_id: 'plugin_toggled',
title: 'Plugin ' + (pluginData.installed ? 'Installed' : 'Uninstalled'), title: '[[admin/extend/plugins:alert.' + (pluginData.installed ? 'installed' : 'uninstalled') + ']]',
message: pluginData.installed ? 'Plugin successfully installed, please activate the plugin.' : 'The plugin has been successfully deactivated and uninstalled.', message: '[[admin/extend/plugins:alert.' + (pluginData.installed ? 'install-success' : 'uninstall-success') + ']]',
type: 'info', type: 'info',
timeout: 5000 timeout: 5000
}); });

@ -32,7 +32,7 @@ define('admin/extend/rewards', ['translator'], function (translator) {
if (err) { if (err) {
app.alertError(err.message); app.alertError(err.message);
} else { } else {
app.alertSuccess('Successfully deleted reward'); app.alertSuccess('[[admin/extend/rewards:alert.delete-success]]');
} }
}); });
@ -43,8 +43,9 @@ define('admin/extend/rewards', ['translator'], function (translator) {
var btn = $(this), var btn = $(this),
disabled = btn.hasClass('btn-success'), disabled = btn.hasClass('btn-success'),
id = $(this).parents('[data-id]').attr('data-id'); id = $(this).parents('[data-id]').attr('data-id');
translator.translate('[[admin/extend/rewards:' + disabled ? 'disable' : 'enable' + ']]', function (text) {
btn.toggleClass('btn-warning').toggleClass('btn-success').html(disabled ? 'Disable' : 'Enable'); btn.toggleClass('btn-warning').toggleClass('btn-success').html(text);
});
// send disable api call // send disable api call
return false; return false;
}); });
@ -90,7 +91,7 @@ define('admin/extend/rewards', ['translator'], function (translator) {
} }
if (!inputs) { if (!inputs) {
return app.alertError('Illegal reward - no inputs found! ' + el.attr('data-selected')); return app.alertError('[[admin/extend/rewards:alert.no-inputs-found]] ' + el.attr('data-selected'));
} }
inputs.forEach(function (input) { inputs.forEach(function (input) {
@ -176,7 +177,7 @@ define('admin/extend/rewards', ['translator'], function (translator) {
if (err) { if (err) {
app.alertError(err.message); app.alertError(err.message);
} else { } else {
app.alertSuccess('Successfully saved rewards'); app.alertSuccess('[[admin/extend/rewards:alert.save-success]]');
} }
}); });
} }

@ -1,5 +1,5 @@
"use strict"; "use strict";
/* global define, app, socket */ /* global define, app, socket, bootbox */
define('admin/extend/widgets', ['jqueryui'], function (jqueryui) { define('admin/extend/widgets', ['jqueryui'], function (jqueryui) {
var Widgets = {}; var Widgets = {};
@ -61,7 +61,7 @@ define('admin/extend/widgets', ['jqueryui'], function (jqueryui) {
}).on('click', '.delete-widget', function () { }).on('click', '.delete-widget', function () {
var panel = $(this).parents('.widget-panel'); var panel = $(this).parents('.widget-panel');
bootbox.confirm('Are you sure you wish to delete this widget?', function (confirm) { bootbox.confirm('[[admin/extend/widgets:alert.confirm-delete]]', function (confirm) {
if (confirm) { if (confirm) {
panel.remove(); panel.remove();
} }
@ -125,8 +125,8 @@ define('admin/extend/widgets', ['jqueryui'], function (jqueryui) {
app.alert({ app.alert({
alert_id: 'admin:widgets', alert_id: 'admin:widgets',
type: 'success', type: 'success',
title: 'Widgets Updated', title: '[[admin/extend/widgets:alert.updated]]',
message: 'Successfully updated widgets', message: '[[admin/extend/widgets:alert.update-success]]',
timeout: 2500 timeout: 2500
}); });
} }

@ -58,7 +58,7 @@
<div class="panel-heading">[[admin/extend/plugins:dev-interested]]</div> <div class="panel-heading">[[admin/extend/plugins:dev-interested]]</div>
<div class="panel-body"> <div class="panel-body">
<p> <p>
[[admin/extend/plugins:documentation-info]] [[admin/extend/plugins:docs-info]]
</p> </p>
</div> </div>
</div> </div>

@ -2,7 +2,7 @@
<li id="{installed.id}" data-plugin-id="{installed.id}" data-version="{installed.version}" class="clearfix <!-- IF installed.active -->active<!-- ENDIF installed.active -->"> <li id="{installed.id}" data-plugin-id="{installed.id}" data-version="{installed.version}" class="clearfix <!-- IF installed.active -->active<!-- ENDIF installed.active -->">
<div class="pull-right controls"> <div class="pull-right controls">
<!-- IF installed.isTheme --> <!-- IF installed.isTheme -->
<a href="{config.relative_path}/admin/appearance/themes" class="btn btn-info">[[admin/extend/plugins:themes]]</a> <a href="{config.relative_path}/admin/appearance/themes" class="btn btn-info">[[admin/extend/plugins:plugin-item.themes]]</a>
<!-- ELSE --> <!-- ELSE -->
<button data-action="toggleActive" class="btn <!-- IF installed.active --> btn-warning<!-- ELSE --> btn-success<!-- ENDIF installed.active -->"> <button data-action="toggleActive" class="btn <!-- IF installed.active --> btn-warning<!-- ELSE --> btn-success<!-- ENDIF installed.active -->">
<i class="fa fa-power-off"></i> <!-- IF installed.active -->[[admin/extend/plugins:plugin-item.deactivate]]<!-- ELSE -->[[admin/extend/plugins:plugin-item.activate]]<!-- ENDIF installed.active --></button> <i class="fa fa-power-off"></i> <!-- IF installed.active -->[[admin/extend/plugins:plugin-item.deactivate]]<!-- ELSE -->[[admin/extend/plugins:plugin-item.activate]]<!-- ENDIF installed.active --></button>

Loading…
Cancel
Save