I store, in a session variable, which language does user wants to translate but I don\'t know to pass it DataTables
I found this explanation on the datatables websit
There are language files uploaded in a CDN on the dataTables website https://datatables.net/plug-ins/i18n/ So you only have to replace "Spanish" with whatever language you are using in the following example.
https://datatables.net/plug-ins/i18n/Spanish
$('table.dataTable').DataTable( {
language: {
url: '//cdn.datatables.net/plug-ins/1.10.15/i18n/Spanish.json'
}
});