Localization file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
{ "sProcessing": "處理中...", "sLengthMenu": "顯示 _MENU_ 項結果", "sZeroRecords": "沒有符合的結果", "sInfo": "顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項", "sInfoEmpty": "顯示第 0 至 0 項結果,共 0 項", "sInfoFiltered": "(由 _MAX_ 項結果中過濾)", "sInfoPostFix": "", "sSearch": "搜尋:", "sUrl": "", "sEmptyTable": "沒有符合的結果", "sLoadingRecords": "處理中...", "sInfoThousands": ",", "oPaginate": { "sFirst": "第一頁", "sPrevious": "上一頁", "sNext": "下一頁", "sLast": "最後一頁" }, "oAria": { "sSortAscending": ": 升冪排列", "sSortDescending": ": 降冪排列" } } |
Sample code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
function init_dt(){ datatable = $('#member_table').DataTable({ "searching": false, "info": false, "lengthChange": false, "paging": true, "ajax": { 'url': base_url + 'admin/ajax/members', 'data': function(d){ var $c = $('#c-tabs-1'); d.member_type = $("#member_type").val(); d.keyword = $('#keyword').val(); d.keyword_col = $('#keyword_col').val(); d.extra_options = get_value('extra_options[]', $c); } }, //"order": [[ 6, "asc" ], [ 5, "" ]], "columnDefs": [ { "targets": [ 6 ], "visible": true, "searchable": false } ], "drawCallback": function( settings ) { var api = this.api(); //wrap.loaded(settings); }, 'initComplete': function(settings, json){ loaded(settings); }, "language" : { "url": "/plugins/datatable_zhtw.json", paginate: { first: '«', previous: '‹', next: '›', last: '»' }, aria: { paginate: { first: '第一頁', previous: '上一頁', next: '下一頁', last: '最後一頁' } } } }); } |
Display priority:
- Localization file
- paginate option
- aria
Reference:
- Language file:
https://datatables.net/examples/advanced_init/language_file.html - How to use:
https://datatables.net/plug-ins/i18n/