diff --git a/public/language/en-GB/admin/extend/plugins.json b/public/language/en-GB/admin/extend/plugins.json index 92d8d4a1b9..8f382a290d 100644 --- a/public/language/en-GB/admin/extend/plugins.json +++ b/public/language/en-GB/admin/extend/plugins.json @@ -3,6 +3,8 @@ "active": "Active", "inactive": "Inactive", "out-of-date": "Out of Date", + "none-found": "No plugins found.", + "none-active": "No Active Plugins", "find-plugins": "Find Plugins", "plugin-search": "Plugin Search", @@ -25,5 +27,20 @@ "plugin-item.upgrade": "Upgrade", "plugin-item.more-info": "For more information:", "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": "

NodeBB could not reach the package manager, proceed with installation of latest version?

Server returned (%1): %2
", + "alert.package-manager-unreachable": "

NodeBB could not reach the package manager, an upgrade is not suggested at this time.

", + "alert.incompatible": "

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.

", + "alert.possibly-incompatible": "

No Compatibility Information Found

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.

In the event that NodeBB cannot boot properly:

$ ./nodebb reset plugin=\"%1\"

Continue installation of latest version of this plugin?

" } \ No newline at end of file diff --git a/public/language/en-GB/admin/extend/rewards.json b/public/language/en-GB/admin/extend/rewards.json index 74fa0c6436..5383a90b33 100644 --- a/public/language/en-GB/admin/extend/rewards.json +++ b/public/language/en-GB/admin/extend/rewards.json @@ -9,5 +9,9 @@ "enable": "Enable", "disable": "Disable", "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" } \ No newline at end of file diff --git a/public/language/en-GB/admin/extend/widgets.json b/public/language/en-GB/admin/extend/widgets.json index 88ee38fc7c..477bb15e56 100644 --- a/public/language/en-GB/admin/extend/widgets.json +++ b/public/language/en-GB/admin/extend/widgets.json @@ -10,5 +10,10 @@ "container.panel": "Panel", "container.panel-header": "Panel Header", "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" + } \ No newline at end of file diff --git a/public/src/admin/appearance/themes.js b/public/src/admin/appearance/themes.js index 10daae4430..4b958ed5dd 100644 --- a/public/src/admin/appearance/themes.js +++ b/public/src/admin/appearance/themes.js @@ -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 () { - bootbox.confirm(revert, function (confirm) { - if (confirm) { - socket.emit('admin.themes.set', { - type: 'local', - id: 'nodebb-theme-persona' - }, function (err) { - if (err) { - return app.alertError(err.message); - } - highlightSelectedTheme('nodebb-theme-persona'); - app.alert({ - alert_id: 'admin:theme', - type: 'success', - title: '[[admin/appearance/themes:theme-changed]]', - message: '[[admin/appearance/themes:revert-success]]', - timeout: 3500 - }); + + $('#revert_theme').on('click', function () { + bootbox.confirm('[[admin/appearance/themes:revert-confirm]]', function (confirm) { + if (confirm) { + socket.emit('admin.themes.set', { + type: 'local', + id: 'nodebb-theme-persona' + }, function (err) { + if (err) { + return app.alertError(err.message); + } + highlightSelectedTheme('nodebb-theme-persona'); + app.alert({ + alert_id: 'admin:theme', + type: 'success', + title: '[[admin/appearance/themes:theme-changed]]', + message: '[[admin/appearance/themes:revert-success]]', + timeout: 3500 }); - } - }); + }); + } }); }); diff --git a/public/src/admin/extend/plugins.js b/public/src/admin/extend/plugins.js index 59ef9348ab..d3774922c6 100644 --- a/public/src/admin/extend/plugins.js +++ b/public/src/admin/extend/plugins.js @@ -1,7 +1,7 @@ "use strict"; /* global define, app, socket, bootbox */ -define('admin/extend/plugins', ['jqueryui'], function (jqueryui) { +define('admin/extend/plugins', ['jqueryui', 'translator'], function (jqueryui, translator) { var Plugins = {}; Plugins.init = function () { var pluginsList = $('.plugins'), @@ -9,7 +9,9 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) { pluginID; if (!numPlugins) { - pluginsList.append('
  • No plugins found.

  • '); + translator.translate('
  • [[admin/extend/plugins:none-found]]

  • ', function (html) { + pluginsList.append(html); + }); return; } @@ -23,25 +25,27 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) { if (err) { return app.alertError(err); } - btn.html(' ' + (status.active ? 'Deactivate' : 'Activate')); - 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)); - } + translator.translate(' [[admin/extend/plugins:plugin-item.' + (status.active ? 'deactivate' : 'activate') + ']]', function (buttonText) { + btn.html(buttonText); + btn.toggleClass('btn-warning', status.active).toggleClass('btn-success', !status.active); - app.alert({ - alert_id: 'plugin_toggled', - title: 'Plugin ' + (status.active ? 'Enabled' : 'Disabled'), - 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(); - }); + //clone it to active plugins tab + if (status.active && !$('#active #' + pluginID).length) { + $('#active ul').prepend(pluginEl.clone(true)); } + + 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) { if (err) { - bootbox.confirm('

    NodeBB could not reach the package manager, proceed with installation of latest version?

    Server returned (' + err.status + '): ' + err.responseText + '
    ', function (confirm) { + bootbox.confirm(translator.compile('admin/extend/plugins:alert.suggest-error', err.status, err.responseText), function (confirm) { if (confirm) { Plugins.toggleInstall(pluginID, 'latest'); } else { @@ -92,7 +96,7 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) { Plugins.suggest(pluginID, function (err, payload) { if (err) { - return bootbox.alert('

    NodeBB could not reach the package manager, an upgrade is not suggested at this time.

    '); + return bootbox.alert('[[admin/extend/plugins:alert.package-manager-unreachable]]'); } require(['semver'], function (semver) { @@ -103,7 +107,7 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) { upgrade(pluginID, btn, payload.version); }); } else { - bootbox.alert('

    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 += '

  • ' + plugin + '
  • '; }); 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(); }); @@ -154,11 +161,7 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) { }; function confirmInstall(pluginID, callback) { - bootbox.confirm( - '

    No Compatibility Infomation Found

    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.

    ' + - '

    In the event that NodeBB cannot boot properly:

    ' + - '
    $ ./nodebb reset plugin="' + pluginID + '"
    ' + - '

    Continue installation of latest version of this plugin?

    ', function (confirm) { + bootbox.confirm(translator.compile('admin/extend/plugins:alert.possibly-incompatible', pluginID), function (confirm) { callback(confirm); }); } @@ -179,8 +182,8 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) { if (isActive) { app.alert({ alert_id: 'plugin_upgraded', - title: 'Plugin Upgraded', - message: 'Please reload your NodeBB to fully upgrade this plugin', + title: '[[admin/extend/plugins:alert.upgraded]]', + message: '[[admin/extend/plugins:alert.upgrade-success]]', type: 'warning', timeout: 5000, clickfn: function () { @@ -211,8 +214,8 @@ define('admin/extend/plugins', ['jqueryui'], function (jqueryui) { app.alert({ alert_id: 'plugin_toggled', - title: 'Plugin ' + (pluginData.installed ? 'Installed' : 'Uninstalled'), - message: pluginData.installed ? 'Plugin successfully installed, please activate the plugin.' : 'The plugin has been successfully deactivated and uninstalled.', + title: '[[admin/extend/plugins:alert.' + (pluginData.installed ? 'installed' : 'uninstalled') + ']]', + message: '[[admin/extend/plugins:alert.' + (pluginData.installed ? 'install-success' : 'uninstall-success') + ']]', type: 'info', timeout: 5000 }); diff --git a/public/src/admin/extend/rewards.js b/public/src/admin/extend/rewards.js index 279c0c8d27..642e2fbc66 100644 --- a/public/src/admin/extend/rewards.js +++ b/public/src/admin/extend/rewards.js @@ -32,7 +32,7 @@ define('admin/extend/rewards', ['translator'], function (translator) { if (err) { app.alertError(err.message); } 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), disabled = btn.hasClass('btn-success'), id = $(this).parents('[data-id]').attr('data-id'); - - btn.toggleClass('btn-warning').toggleClass('btn-success').html(disabled ? 'Disable' : 'Enable'); + translator.translate('[[admin/extend/rewards:' + disabled ? 'disable' : 'enable' + ']]', function (text) { + btn.toggleClass('btn-warning').toggleClass('btn-success').html(text); + }); // send disable api call return false; }); @@ -90,7 +91,7 @@ define('admin/extend/rewards', ['translator'], function (translator) { } 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) { @@ -176,7 +177,7 @@ define('admin/extend/rewards', ['translator'], function (translator) { if (err) { app.alertError(err.message); } else { - app.alertSuccess('Successfully saved rewards'); + app.alertSuccess('[[admin/extend/rewards:alert.save-success]]'); } }); } diff --git a/public/src/admin/extend/widgets.js b/public/src/admin/extend/widgets.js index 5b7c3a13e1..6db6b53490 100644 --- a/public/src/admin/extend/widgets.js +++ b/public/src/admin/extend/widgets.js @@ -1,5 +1,5 @@ "use strict"; -/* global define, app, socket */ +/* global define, app, socket, bootbox */ define('admin/extend/widgets', ['jqueryui'], function (jqueryui) { var Widgets = {}; @@ -61,7 +61,7 @@ define('admin/extend/widgets', ['jqueryui'], function (jqueryui) { }).on('click', '.delete-widget', function () { 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) { panel.remove(); } @@ -125,8 +125,8 @@ define('admin/extend/widgets', ['jqueryui'], function (jqueryui) { app.alert({ alert_id: 'admin:widgets', type: 'success', - title: 'Widgets Updated', - message: 'Successfully updated widgets', + title: '[[admin/extend/widgets:alert.updated]]', + message: '[[admin/extend/widgets:alert.update-success]]', timeout: 2500 }); } diff --git a/src/views/admin/extend/plugins.tpl b/src/views/admin/extend/plugins.tpl index 34f93ff424..7afffd5e08 100644 --- a/src/views/admin/extend/plugins.tpl +++ b/src/views/admin/extend/plugins.tpl @@ -58,7 +58,7 @@
    [[admin/extend/plugins:dev-interested]]

    - [[admin/extend/plugins:documentation-info]] + [[admin/extend/plugins:docs-info]]

    diff --git a/src/views/admin/partials/installed_plugin_item.tpl b/src/views/admin/partials/installed_plugin_item.tpl index cd34098616..b76ae9f964 100644 --- a/src/views/admin/partials/installed_plugin_item.tpl +++ b/src/views/admin/partials/installed_plugin_item.tpl @@ -2,7 +2,7 @@
  • - [[admin/extend/plugins:themes]] + [[admin/extend/plugins:plugin-item.themes]]