Plugin i18n lang file is defect

Plugin i18n lang file is defect

zesszess Posts: 7Questions: 3Answers: 0

Hello,

I use the i18n lang file for german, but at moment it doesn't work. Because the comment /** ... */ part will not ignor.
https://github.com/DataTables/Plugins/blob/master/i18n/German.lang

IF delete the comment part every thing is fine.

Answers

  • allanallan Posts: 48,301Questions: 1Answers: 6,970 Site admin

    That is correct - it is a source file and not intended to be valid JSON. A JSON version is available here.

    Allan

  • vg10vg10 Posts: 11Questions: 3Answers: 1

    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.
    Thanks

  • allanallan Posts: 48,301Questions: 1Answers: 6,970 Site admin

    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.

    Allan

  • MopsterMopster Posts: 1Questions: 0Answers: 0

    +1 for the ISO language codes for the file names :-) would help switching between languages based on the current locale of the user.

  • nurikabenurikabe Posts: 1Questions: 0Answers: 0

    +2 for ISO language codes!

  • allanallan Posts: 48,301Questions: 1Answers: 6,970 Site admin

    +100 from me :smile:. It is coming - I just need to wrap up other things...!

  • rink_attendant_6rink_attendant_6 Posts: 15Questions: 3Answers: 1

    +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?)

  • allanallan Posts: 48,301Questions: 1Answers: 6,970 Site admin

    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.

    Allan

  • lenasterglenasterg Posts: 1Questions: 0Answers: 0

    +1 for the ISO language codes!

  • rink_attendant_6rink_attendant_6 Posts: 15Questions: 3Answers: 1

    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 i18n in the root of the DataTablesSrc repository and make a pull request?

  • allanallan Posts: 48,301Questions: 1Answers: 6,970 Site admin

    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 (@iso probably) in the source lang files and then having a dist or json directory (in the i18n directory) 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.

    Allan

Sign In or Register to comment.