internationalisation of DataTables


Topic: internationalisation of DataTables

Doc asked 6 years ago

Hello. I'm using the "DataTable checkbox example" you give in your datatable documentation. (Tables / Datatables / DataTable checkbox example).

I want to be able to translate in French some descriptions of the datatable, such as : "Show entries" "Search" "Showing 1 to 10 of 16 entries" Pagination : "Previous" and "Next"

Please give me a clear and detailed answer : what is the js code I must add in my js file to make this translation ? If the answer is using a JSON file, please tell me where to get it.

The question was already asked here : https://mdbootstrap.com/support/jquery/datatables-internationalisation-languages-i18n/ But the answers were not very clear. I'd like a piece of working code to copy and paste in my js file "as is".

Thanks in advance.


Piotr Glejzer staff answered 6 years ago

Exactly the in the same way like in this link what did you paste.
https://ibb.co/N9bMxDR

 $('#dt-basic-checkbox').dataTable({

  columnDefs: [{
    orderable: false,
    className: 'select-checkbox',
    targets: 0
  }],
  select: {
    style: 'os',
    selector: 'td:first-child'
  },
  "language": {
    "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"
    },
    "select": {
      "rows": {
        "_": "%d lignes sélectionnées",
        "0": "Aucune ligne sélectionnée",
        "1": "1 ligne sélectionnée"
      }
    }
  }
});
$('.dataTables_length').addClass('bs-select');

Doc answered 6 years ago

It works perfectly. Thank you very much !


Tomek Makowski staff commented 4 years ago

Nice, if any help needed just ask.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.7.4
  • Device: PC
  • Browser: Firefox
  • OS: Windows10 x64
  • Provided sample code: No
  • Provided link: Yes