Plugin i18n lang file is defect
Plugin i18n lang file is defect
I use the i18n lang file for german, but at moment it doesn't work. Because the comment /** ... */ part will not ignor.
IF delete the comment part every thing is fine.
This question has an accepted answers - jump to answer
This discussion has been closed.
That is correct - it is a source file and not intended to be valid JSON. A JSON version is available here.
I am having the same problem but I need to support a lot of languages - the only way I could figure out how to download them all was from the github repository where they all come down as .lang files with comments. It is a lot of work to remove the comments from all and rename them to .json. Is there a way to download all the .json i18n files at once? On the plugins page the author says "I aim to make this normally arduous task as easy as possible in DataTables." but having to download one file at a time is actually quite arduous still. Please help.
The language files are a bit of a mess at the moment I'm afraid and I acknowledge that. You can get the files from the CDN, or clone the git repo and modify them to suit your needs. In future I'll update them to use ISO language codes for the file names and store just JSON in the repo since this is a common request.
+1 for the ISO language codes for the file names :-) would help switching between languages based on the current locale of the user.
+2 for ISO language codes!
+100 from me . It is coming - I just need to wrap up other things...!
+1 for the ISO language code file names
Also wondering does this mean they will be published on npm? DataTables language files are amongst the only three front-end dependencies in my project that aren't available over npm (unless they already are?)
Eventually yes they will. I just need to get the time to do it I'm afraid. I don't currently have an estimate of when that will be.
+1 for the ISO language codes!
Is there anything that the community can do to help with this change?
For example, would it help to commit the files (as valid JSON) into a directory named
i18nin the root of the
DataTablesSrcrepository and make a pull request?
Not into the DataTablesSrc repo, but into the Plugins repo.
What I need to find a good way of doing is keeping the meta data in the language files (since that is required to display the plug-ins on this site with the author, etc, information) while also making the files useful in the repo.
What I'm thinking of having is adding the iso code as a meta attribute (
@isoprobably) in the source lang files and then having a
jsondirectory (in the
i18ndirectory) that would be contain valid JSON only (no meta information) and a file name based on the iso code. The dist / json directory should be automatically generated from the make.sh script and the existing lang files.
The other option is to have the meta information in a separate file and have the translation in a valid json file (i.e. there would be a pair of files that are used to describe each language).
I probably prefer the latter - that way the meta information could be valid JSON as well which will be easier to parse and all files could be under their iso code name.
This won't be in the 1.x branch though, which is why I've not made time for it yet. As the next major version of DataTables progresses I will make this change (or someone else can) since that will be the time to change anything that will effect backwards compatibility.