From b3d7c06c60002a473bb3289acd283276542cabb7 Mon Sep 17 00:00:00 2001 From: D9ping Date: Tue, 11 Sep 2018 21:00:23 +0200 Subject: [PATCH] Translatable strings in bandwidthcharts.js. Signed-off-by: D9ping --- includes/bandwidth.php | 18 +++++++++++++----- js/bandwidthcharts.js | 17 ++++++++++------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/includes/bandwidth.php b/includes/bandwidth.php index 11bdd5a..175642b 100644 --- a/includes/bandwidth.php +++ b/includes/bandwidth.php @@ -27,7 +27,8 @@ function DisplayBandwidth(&$extraFooterScripts)

- - +
@@ -49,7 +49,8 @@ foreach ($interfacesWlo as $interface) {

- ' , @@ -76,7 +77,14 @@ foreach ($interfacesWlo as $interface) {
+ 'vendor/raphael/raphael.min.js', 'defer'=>false); $extraFooterScripts[] = array('src'=>'vendor/morrisjs/morris.min.js', 'defer'=>false); diff --git a/js/bandwidthcharts.js b/js/bandwidthcharts.js index 55c6c51..ac2ecaf 100644 --- a/js/bandwidthcharts.js +++ b/js/bandwidthcharts.js @@ -1,4 +1,4 @@ -(function($) { +(function($, _t) { "use strict"; /** @@ -9,7 +9,8 @@ element: placeholder, xkey: 'date', ykeys: ['rx', 'tx'], - labels: ['Received '+datasizeunits, 'Send '+datasizeunits] // NOI18N + labels: [_t['send']+' '+datasizeunits.toUpperCase(), + _t['receive']+' '+datasizeunits.toUpperCase()] }); return barchart; @@ -19,7 +20,9 @@ * Create a bootstrap data table. */ function CreateDataTable(placeholder, timeunits) { - $("#"+placeholder).append('
daterxtx
'); + $("#"+placeholder).append(''+ + '
daterxtx
'); } /** @@ -62,8 +65,8 @@ data: jsondata, columns: [ { "data": "date" }, - { "data": "rx", "title": "received "+datasizeunits }, - { "data": "tx", "title": "send "+datasizeunits }] + { "data": "rx", "title": _t['send']+' '+datasizeunits.toUpperCase() }, + { "data": "tx", "title": _t['receive']+' '+datasizeunits.toUpperCase() }] }); }).fail(function(xhr, textStatus) { if (window.console) { @@ -74,7 +77,7 @@ }); } - $( document ).ready(function() { + $(document).ready(function() { $('#tabbarBandwidth a[data-toggle="tab"]').on('shown.bs.tab', ShowBandwidthChartHandler); $('#cbxInterfacedaily').on('change', ShowBandwidthChartHandler); $('#cbxInterfaceweekly').on('change', ShowBandwidthChartHandler); @@ -82,5 +85,5 @@ ShowBandwidthChartHandler(); }); -})(jQuery); +})(jQuery, t);