how to change language for DataTable

前端 未结 11 1731
灰色年华
灰色年华 2020-12-14 15:11

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

11条回答
  •  北海茫月
    2020-12-14 15:46

    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'
        }
    });
    

提交回复
热议问题