how to change language for DataTable
//Spanish
$('#TableName').DataTable({
"language": {
"sProcessing": "Procesando...",
"sLengthMenu": "Mostrar _MENU_ registros",
"sZeroRecords": "No se encontraron resultados",
"sEmptyTable": "Ningún dato disponible en esta tabla",
"sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
"sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
"sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sUrl": "",
"sInfoThousands": ",",
"sLoadingRecords": "Cargando...",
"oPaginate": {
"sFirst": "Primero",
"sLast": "Último",
"sNext": "Siguiente",
"sPrevious": "Anterior"
},
"oAria": {
"sSortAscending": ": Activar para ordenar la columna de manera ascendente",
"sSortDescending": ": Activar para ordenar la columna de manera descendente"
}
}
});
Also using a cdn:
//cdn.datatables.net/plug-ins/a5734b29083/i18n/Spanish.json
More options: http://www.datatables.net/plug-ins/i18n/English [| Spanish | etc]
You have to either create a language file and then set it using :
"oLanguage": {
"sUrl": "media/language/your_file.txt"
}
Im not sure what server language you are using but something like this would work in PHP :
"oLanguage": {
"sUrl": "media/language/custom_lang_<?php echo $language ?>.txt"
}
Where language
matches the file name for a specific language.
or change individual settings :
"oLanguage": {
"sLengthMenu": "Display _MENU_ records per page",
"sZeroRecords": "Nothing found - sorry",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ records",
"sInfoEmpty": "Showing 0 to 0 of 0 records",
"sInfoFiltered": "(filtered from _MAX_ total records)"
}
For more details read this : http://datatables.net/plug-ins/i18n