how to change language for DataTable

前端 未结 11 1765
灰色年华
灰色年华 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 16:04

    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_.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

提交回复
热议问题