0

I am using DataTables styling from Datatables column filtering. Right now I would like to have all the text changed to German instead of the default English. I found something from Datatables here: https://datatables.net/examples/advanced_init/language_file.html

I added it to my code below but it doesn't change the language to German. What could I be doing wrong?

$(document).ready(function() {
    $(".se-pre-con").fadeOut("slow");


           $('table thead tr').clone(true).appendTo( 'table thead' );
           $('thead tr:eq(1) th').each( function (i) {
               if(i > 4){
                   $(this).hide()
               }
           })

               $('table').DataTable( {

                "language": {
                    "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json"
                },


                   initComplete: function () {

                       this.api().columns().every( function () {
                           var column = this;

                           console.log(column.index())
                           var select = $('<select><option value=""></option></select>')
                               .appendTo( $(column.header()).empty() )
                               .on( 'change', function () {
                                   var val = $.fn.dataTable.util.escapeRegex(
                                       $(this).val()
                                   );

                                   column
                                       .search( val ? '^'+val+'$' : '', true, false )
                                       .draw();
                               } );

                           column.data().unique().sort().each( function ( d, j ) {
                               select.append( '<option value="'+d+'">'+d+'</option>' )
                           } );
                       } );
                   }
               } );

       } );
JA-pythonista
  • 1,225
  • 1
  • 21
  • 44
  • 1
    https://datatables.net/manual/i18n – raidenace May 18 '20 at 10:32
  • 1
    The same issue is discussed in this question: [Datatables - Language change via JavaScript makes UI elements disappear instead of changing the language](https://stackoverflow.com/questions/60582773/datatables-language-change-via-javascript-makes-ui-elements-disappear-instead). Basically, use a different URL and also include the protocol. – andrewJames May 18 '20 at 12:27

0 Answers0