language.url and language.select.rows mismatch

language.url and language.select.rows mismatch

Thomasat666Thomasat666 Posts: 1Questions: 1Answers: 0
edited December 2018 in Free community support

Hi,

I use datatables (version 1.10.16) and try to set the assets in French using the Internationalisation plugins.

So on datatable init, i set:

"language": {
            "url": "../../global/language/French.json"
}

which is my local translation file. I first used the content of
//cdn.datatables.net/plug-ins/1.10.19/i18n/French.json

that is to say copied the content to my French.json file

Then it don't works, and i see English language on Datatables. If i remove

 "select": {
            "rows": {
                _: "%d lignes séléctionnées",
                0: "Aucune ligne séléctionnée",
                1: "1 ligne séléctionnée"
            } 
    }

everything is working fine (except the select rows string of course).

And if i set all this parameters directly on js file, including the select rows, everythings is also working fine (including the select rows string).

Note i also tried with new parameters names, and everythings is working fine if not using language.url

"language": {
            "processing":     "Traitement en cours...",
            "search":         "Rechercher :",
            "lengthMenu":     "Afficher _MENU_ éléments",
            "info":           "Affichage de l'élement _START_ à _END_ sur _TOTAL_ éléments",
            "infoEmpty":      "Affichage de l'élement 0 à 0 sur 0 éléments",
            "infoFiltered":   "(filtré de _MAX_ éléments au total)",
            "infoPostFix":    "",
            "loadingRecords": "Chargement en cours...",
           "zeroRecords":    "Aucun élément à afficher",
            "emptyTable":     "Aucune donnée disponible dans le tableau",
            "paginate": {
                "first":      "Premier",
                "previous":   "Précédent",
                "next":       "Suivant",
                "last":       "Dernier"
            },
            "aria": {
                "sortAscending":  ": activer pour trier la colonne par ordre croissant",
                 "sortDescending": ": activer pour trier la colonne par ordre décroissant"
            },
            "select": {
                "rows": {
                    _: "%d lignes séléctionnées",
                    0: "Aucune ligne séléctionnée",
                    1: "1 ligne séléctionnée"
                }  
            }
        },

Do you know what's happening ?

Regards,
Thomas

Answers

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Hi @Thomasat666 ,

    This thread here should help explain it, shout back if not,

    Cheers,

    Colin

  • allanallan Posts: 61,702Questions: 1Answers: 10,102 Site admin

    The JSON in the language file isn't actually valid JSON. The rows properties need to be quoted. It works when that is done: https://codesandbox.io/s/8zvnjl67l .

    That was a bug in the language file, but has been fixed in git now, just not yet released.

    Allan

This discussion has been closed.