Setting up i18n for plugins in the json file with the language url
Setting up i18n for plugins in the json file with the language url

Good afternoon!
My question is quite simple. I can setup the i18n for my dataTables this way (and it works fine) :
"language": {
"url": "./static/lang/dataTables.french.json",
"select": {
"rows": {
"_": "%d lignes sélectionnées",
"1": "1 ligne sélectionnée"
}
}
}
I was wondering if it was possible to include the i18n messages for the select plugin (or any other plugins) into the i18n json file. This would be cleaner for me since I would have all my i18n messages at the same place. Additionnaly, since I have more than one instance of dataTables to setup, it would prevent me form repeating all the messages for each table.
I gave the example with the select plugin but I have the same question for the editor plugin.
Thank you!
Answers
Hi,
Yes indeed you can. Just copy / paste the
select
property into your language file.Regards,
Allan
Hi Allan,
Thank you for the quick reply. I did as you said for the select plugin and it worked fine.
Can I do something similar with the editor plugin? Is there a language url equivalent for the datatables editor?
Thank you again
No - unfortunately at this time the only way to get language information from a JSON file is to Ajax load it yourself and then pass that in during the Editor initialisation - for example:
Regards,
Allan
I did as you said and it works great.
Thank you for your answer Allan.