How to load locale json with translation

How to load locale json with translation

inajafinajaf Posts: 13Questions: 8Answers: 0

I am trying to use i18n for data tables, but when I put "url": "/dataTables/i18n/de_de.lang" parameter, it's not working but works with the CDN link. Could it be a folder permission issue? Maybe there is different way to load JSON in language parameter

Answers

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    Do you get an error in the browser's console regarding loading that file? My guess is a 404 not found error which means you will need to look at the server logs to find out why the file is not found.

    Kevin

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Yes, it could be a permission issue, or a case-sensitivity issue, or an http server configuration issue, or... Could be a lot of things :).

    Best bet is to check the server's error log - my guess is there will be a request for a file which results in a 404 return.

    Allan

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Sorry Kevin - overlapping replies - you are too fast ;).

    On the plus side, we both have the same suggestions!

    Allan

  • inajafinajaf Posts: 13Questions: 8Answers: 0

    @kthorngren is there another way to return JSON data without URL parameter in language?

  • colincolin Posts: 15,177Questions: 1Answers: 2,590

    It needs the URL parameter to load from a file, It would be worth checking your paths. It can either be an external source, like this:

    "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json"
    

    or if internal, like yours, because the path starts with a leading /, than means the path is absolute, i.e. from the root of the webserver.

    If you don't want to use a path, the other option is to place those language options into the configuration, like this example,

    Colin

Sign In or Register to comment.