Plugins i18n using external file
Plugins i18n using external file
signal
Posts: 3Questions: 1Answers: 0
Using file for datatable i18n is useful, but this is not possibile for plugins such as editors os select. These plugins use translate string inside the costructor and is not possibile using an external file ( there's no url object ). Is there a way to add this? Maybe using one single file for all the plugins?
This discussion has been closed.
Answers
Do you mean plugins used by datatables itself or plugins you added?
Hi @signal ,
For Select and for Editor, you can use
i18n()
orlanguage
as in this example, likewise Editor. Those values could be stored in a file and loaded as in this example here.Hope that helps,
Cheers,
Colin
@nessinits plugins used by datatables, like Editors and Select
@colin Sure, but i don't understand how use file with plugin. If you see this example here this is json file, how can i convert this code
select: {
rows: {
_: "You have selected %d rows",
0: "Click a row to select it",
1: "Only 1 row selected"
}
}
and put in the json file?
Hi @signal ,
The best bet is to look at that example above - or this file: http://cdn.datatables.net/plug-ins/1.10.16/i18n/German.json . To add other language extensions, follow the same format, i.e. add this to the end of the file (within the final curly brackets) - see attached file.
Cheers,
Colin
@colin, this can't be done! You can't mix json and js!
Did you see that link I posted above showing it being done... Here it is: https://datatables.net/examples/advanced_init/language_file.html