I create a data table in my HTML template. It works totally good but I have an issue. I did not create my project in English. So, I have to change some text in the table. Like "search" should be "ara" etc... How can I do that?
<table id="example" class="display table table-hover grid_" >
<thead>
<tr>
<th>Kullanıcı</th>
...
</tr>
</thead>
<body>
...
</tbody>
</table>
<script>
$(document).ready(function() {
$('#example').DataTable( {
select: true
} );
} );
</script>
To change the default texts of datatable, you'll need to fix it while initializing the datatable. There are two methods by which you can include internationalization options in DataTables - loading the language file through an Ajax request (language.url), or at initialization time using the language property. The following example shows how to include the Turkish translation as an Ajax file:
$(document).ready(function() {
$('#example').DataTable( {
language: {
url: 'dataTables.turkish.json'
}
});
});
Or, you can change the default texts by using the language option while initializing the datatable. Here is the example:
$(document).ready(function() {
$('#example').DataTable({
language: {
"emptyTable": "No data available in table",
"lengthMenu": "Show _MENU_ entries",
"info": "Showing _START_ to _END_ of _TOTAL_ entries",
"infoEmpty": "Showing 0 to 0 of 0 entries",
"search": "Search:",
"paginate": {
"first": "First",
"last": "Last",
"next": "Next",
"previous": "Previous"
},
}
});
});
You can also check this links: https://datatables.net/reference/api/i18n() https://datatables.net/reference/option/language
<script>
$(document).ready(function() {
$('#example').DataTable( {
"language": {
"lengthMenu": "Sayfa başına _MENU_ kayıt göster",
"zeroRecords": "Kayıt Bulunamadı",
"info": " _PAGE_ / _PAGES_",
"search": "Ara",
}
} );
} );
</script>