Closed bugriy closed 6 months ago
Hey @bugriy , great question, thanks for asking. The datatables.net
library that we use in itables
does support internationalisation, cf. https://datatables.net/plug-ins/i18n/ and https://datatables.net/reference/option/language
Maybe the second one should be easier to use. Can you try passing a language
dict to the show
method that would be inspired from https://datatables.net/reference/option/language ?
This seems to work (please translate it according to your needs):
import itables.options as opt
opt.language = {
"decimal": "",
"emptyTable": "No data available in table",
"info": "Showing _START_ to _END_ of _TOTAL_ entries",
"infoEmpty": "Showing 0 to 0 of 0 entries",
"infoFiltered": "(filtered from _MAX_ total entries)",
"infoPostFix": "",
"thousands": ",",
"lengthMenu": "Show _MENU_ entries",
"loadingRecords": "Loading...",
"processing": "",
"search": "Search:",
"zeroRecords": "No matching records found",
"paginate": {
"first": "First",
"last": "Last",
"next": "Next",
"previous": "Previous"
},
"aria": {
"sortAscending": ": activate to sort column ascending",
"sortDescending": ": activate to sort column descending"
}
}
Datatables already has a huge list of i18n Plugins (see: https://datatables.net/plug-ins/i18n/) and as far as I understand @mwouts put Plugin-Support on the Roadmap for itables v2.
Up until then, one can just copy the Plug-In Code (in my case German: https://datatables.net/plug-ins/i18n/German.html#Plug-in-code) from the plugin website and pass the whole json to itables.options.language as shown above, thereby saving some effort on translating.
Is it possible to translate "Show", "entries", "Next" to other languages?