diff --git a/burpui/static/extra/i18n/datatable-fr.json b/burpui/static/extra/i18n/datatable-fr.json new file mode 100644 index 00000000..9f3f6262 --- /dev/null +++ b/burpui/static/extra/i18n/datatable-fr.json @@ -0,0 +1,22 @@ +{ + "sProcessing": "Traitement en cours...", + "sSearch": "Rechercher :", + "sLengthMenu": "Afficher _MENU_ éléments", + "sInfo": "Affichage de l'élément _START_ à _END_ sur _TOTAL_ éléments", + "sInfoEmpty": "Affichage de l'élément 0 à 0 sur 0 élément", + "sInfoFiltered": "(filtré de _MAX_ éléments au total)", + "sInfoPostFix": "", + "sLoadingRecords": "Chargement en cours...", + "sZeroRecords": "Aucun élément à afficher", + "sEmptyTable": "Aucune donnée disponible dans le tableau", + "oPaginate": { + "sFirst": "Premier", + "sPrevious": "Précédent", + "sNext": "Suivant", + "sLast": "Dernier" + }, + "oAria": { + "sSortAscending": ": activer pour trier la colonne par ordre croissant", + "sSortDescending": ": activer pour trier la colonne par ordre décroissant" + } +} diff --git a/burpui/templates/js/client.js b/burpui/templates/js/client.js index f9894c97..301c488c 100644 --- a/burpui/templates/js/client.js +++ b/burpui/templates/js/client.js @@ -27,8 +27,10 @@ * ] * The JSON is then parsed into a table */ +{% import 'macros.html' as macros %} var _client_table = $('#table-client').dataTable( { + {{ macros.translate_datatable() }} {% if session.pageLength -%} pageLength: {{ session.pageLength }}, {% endif -%} diff --git a/burpui/templates/js/clients.js b/burpui/templates/js/clients.js index c61d5568..ef9d8aa9 100644 --- a/burpui/templates/js/clients.js +++ b/burpui/templates/js/clients.js @@ -41,8 +41,10 @@ var __date = { * ] * The JSON is then parsed into a table */ +{% import 'macros.html' as macros %} var _clients_table = $('#table-clients').dataTable( { + {{ macros.translate_datatable() }} {% if session.pageLength -%} pageLength: {{ session.pageLength }}, {% endif -%} diff --git a/burpui/templates/js/servers.js b/burpui/templates/js/servers.js index 4c0232a2..6e2ca6d5 100644 --- a/burpui/templates/js/servers.js +++ b/burpui/templates/js/servers.js @@ -8,7 +8,9 @@ * _servers: function that retrieve up-to-date informations from the burp server * The JSON is then parsed into a table */ +{% import 'macros.html' as macros %} var _servers_table = $('#table-servers').dataTable( { + {{ macros.translate_datatable() }} responsive: true, ajax: { url: '{{ url_for("api.servers_stats") }}', diff --git a/burpui/templates/js/settings.js b/burpui/templates/js/settings.js index e215d8cc..820f8de4 100644 --- a/burpui/templates/js/settings.js +++ b/burpui/templates/js/settings.js @@ -437,16 +437,5 @@ app.controller('ConfigCtrl', ['$scope', '$http', '$scrollspy', function($scope, }; }]); -// Add a smooth scrolling to anchor -$(document).ready(function() { - $('a[href^="#"]').click(function() { - var target = $(this.hash); - if (target.length == 0) target = $('a[name="' + this.hash.substr(1) + '"]'); - if (target.length == 0) target = $('html'); - $('html, body').animate({ scrollTop: target.offset().top }, 500); - return false; - }); - $(".dropdown-menu label, .dropdown-menu input, .dropdown-menu li").click(function(e) { - e.stopPropagation(); - }); -}); +{% import 'macros.html' as macros %} +{{ macros.smooth_scrolling() }} diff --git a/burpui/templates/macros.html b/burpui/templates/macros.html index 3313aa3c..a66e25d0 100644 --- a/burpui/templates/macros.html +++ b/burpui/templates/macros.html @@ -97,3 +97,28 @@ {%- endmacro %} + +{% macro smooth_scrolling() -%} +// Add a smooth scrolling to anchor +$(document).ready(function() { + $('a[href^="#"]').click(function() { + var target = $(this.hash); + if (target.length == 0) target = $('a[name="' + this.hash.substr(1) + '"]'); + if (target.length == 0) target = $('html'); + $('html, body').animate({ scrollTop: target.offset().top }, 500); + return false; + }); + $(".dropdown-menu label, .dropdown-menu input, .dropdown-menu li").click(function(e) { + e.stopPropagation(); + }); +}); +{%- endmacro %} + +{# Loads the datatable translation if needed #} +{% macro translate_datatable() -%} + {% if g.locale and g.locale != 'en' -%} + language: { + url: '{{ url_for("static", filename="extra/i18n/datatable-{}.json".format(g.locale)) }}' + }, + {% endif -%} +{%- endmacro %}