Datatables change interface language

前端 未结 3 1321
慢半拍i
慢半拍i 2020-12-31 16:15

I am currently using angular-datatables.

How can I see the interface of the table in other languages?

I mean the \"Show entries\", \"Search:\", \"Showing 1

3条回答
  •  执念已碎
    2020-12-31 16:55

    In Angular2+ what worked for me is quite the same as mentioned by @davidkonrad, but without the starting letters (s and o), and adding the language as an attribute of the dtOptions. I.e.:

    this.dtOptions = {
      pagingType: 'full_numbers',
      pageLength: 10,
      dom: 'Bfrtip',
      buttons: [
        /*'print',
        'csv'*/
      ],
      responsive: true,
      /* below is the relevant part, e.g. translated to spanish */ 
      language: {
        processing: "Procesando...",
        search: "Buscar:",
        lengthMenu: "Mostrar _MENU_ éléments",
        info: "Mostrando desde _START_ al _END_ de _TOTAL_ elementos",
        infoEmpty: "Mostrando ningún elemento.",
        infoFiltered: "(filtrado _MAX_ elementos total)",
        infoPostFix: "",
        loadingRecords: "Cargando registros...",
        zeroRecords: "No se encontraron registros",
        emptyTable: "No hay datos disponibles en la tabla",
        paginate: {
          first: "Primero",
          previous: "Anterior",
          next: "Siguiente",
          last: "Último"
        },
        aria: {
          sortAscending: ": Activar para ordenar la tabla en orden ascendente",
          sortDescending: ": Activar para ordenar la tabla en orden descendente"
        }
      }
    };
    

提交回复
热议问题