From 1676fd570b6fda93eab8ab6324afbcb7f7cf6968 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Mon, 24 Aug 2015 18:49:27 +0200 Subject: [PATCH] Use window.translations translated strings in admin-all.js --- themes/grav/js/admin-all.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/themes/grav/js/admin-all.js b/themes/grav/js/admin-all.js index ccc052b8..d9c5e8f9 100644 --- a/themes/grav/js/admin-all.js +++ b/themes/grav/js/admin-all.js @@ -194,7 +194,7 @@ $(function () { } } - toastr.success(result.message || 'Task completed.'); + toastr.success(result.message || translations.PLUGIN_ADMIN.TASK_COMPLETED); for (var setting in toastrBackup) { if (toastrBackup.hasOwnProperty(setting)) { toastr.options[setting] = toastrBackup[setting]; @@ -203,7 +203,7 @@ $(function () { if (url.indexOf(task + 'backup') !== -1) { //Reset backup days count - $('.backups-chart .numeric').html("0 days"); + $('.backups-chart .numeric').html("0 " + translations.PLUGIN_ADMIN.DAYS + ""); var data = { series: [0,100] @@ -239,13 +239,13 @@ $(function () { if (payload) { if (!payload.grav.isUpdatable && !payload.resources.total) { - toastr.success('Everything is up to date!'); + toastr.success(translations.PLUGIN_ADMIN.EVERYTHING_UP_TO_DATE); } else { - var grav = payload.grav.isUpdatable ? 'Grav v' + payload.grav.available : '', - resources = payload.resources.total ? payload.resources.total + ' updates are available' : ''; + var grav = payload.grav.isUpdatable ? 'Grav v' + payload.grav.available : ''; + var resources = payload.resources.total ? payload.resources.total + ' ' + translations.PLUGIN_ADMIN.UPDATES_ARE_AVAILABLE: ''; - if (!resources) { grav += ' is available for update' } - toastr.info(grav + (grav && resources ? ' and ' : '') + resources); + if (!resources) { grav += ' ' + translations.PLUGIN_ADMIN.IS_AVAILABLE_FOR_UPDATE } + toastr.info(grav + (grav && resources ? ' ' + translations.PLUGIN_ADMIN.AND + ' ' : '') + resources); } } } @@ -277,11 +277,11 @@ $(function () { // grav updatable if (grav.isUpdatable) { var icon = ' '; - content = 'Grav v{available} is now available! (Current: v{version}) ', - button = ''; + content = 'Grav v{available} ' + translations.PLUGIN_ADMIN.IS_NOW_AVAILABLE + '! (' + translations.PLUGIN_ADMIN.CURRENT + ': v{version}) ', + button = ''; if (grav.isSymlink) { - button = ''; + button = ''; } content = jQuery.substitute(content, {available: grav.available, version: grav.version}); @@ -290,7 +290,7 @@ $(function () { } $('#grav-update-button').on('click', function() { - $(this).html('Updating... please wait, downloading ' + bytesToSize(grav.assets['grav-update'].size) + '..'); + $(this).html(translations.PLUGIN_ADMIN.UPDATING_PLEASE_WAIT + ' ' + bytesToSize(grav.assets['grav-update'].size) + '..'); }); // dashboard @@ -309,8 +309,8 @@ $(function () { } else { var length, icon = '', - content = '{updates} of your {type} have an update available', - button = 'Update {Type}', + content = '{updates} ' + translations.PLUGIN_ADMIN.OF_YOUR + ' {type} ' + translations.PLUGIN_ADMIN.HAVE_AN_UPDATE_AVAILABLE, + button = '' + translations.PLUGIN_ADMIN.UPDATE + ' {Type}', plugins = $('.grav-update.plugins'), themes = $('.grav-update.themes'), sidebar = {plugins: $('#admin-menu a[href$="/plugins"]'), themes: $('#admin-menu a[href$="/themes"]')}; @@ -342,7 +342,7 @@ $(function () { plugin = $('[data-gpm-plugin="' + key + '"] .gpm-name'); url = plugin.find('a'); if (!plugin.find('.badge.update').length) { - plugin.append('Update available!'); + plugin.append('' + translations.PLUGIN_ADMIN.UPDATE_AVAILABLE + '!'); } }); @@ -357,7 +357,7 @@ $(function () { $.each(resources.themes, function (key, value) { theme = $('[data-gpm-theme="' + key + '"]'); url = theme.find('.gpm-name a'); - theme.append('
UPDATE
'); + theme.append('
' + translations.PLUGIN_ADMIN.UPDATE.toUpperCase() + '
'); }); } @@ -376,7 +376,7 @@ $(function () { resource = resources[type + 's'][slug]; if (resource) { - content = 'v{available} of this ' + type + ' is now available!'; + content = 'v{available} ' + translations.PLUGIN_ADMIN.OF_THIS + ' ' + type + ' ' + translations.PLUGIN_ADMIN.IS_NOW_AVAILABLE + '!'; content = jQuery.substitute(content, { available: resource.available }); button = jQuery.substitute(button, { Type: Type,