Datatables French Language issue

Datatables French Language issue

AniketBAniketB Posts: 1Questions: 1Answers: 0
edited April 2019 in Free community support

I'm using Datatables 1.10.19

I want to localize (internationalize) the table controls.

    var table = $('#table_id').DataTable({
        language: {
            url: "https://cdn.datatables.net/plug-ins/1.10.19/i18n/French.json"
        }
    });

The table controls are displayed in English and not French.

When I use url: "https://cdn.datatables.net/plug-ins/1.10.19/i18n/German.json", the table controls are localized in German language.

Then why is French not working?

Answers

  • awelchawelch Posts: 38Questions: 1Answers: 3
    edited April 2019

    The returned JSON is invalid:

    {
        "sProcessing":     "Traitement en cours...",
        "sSearch":         "Rechercher :",
        "sLengthMenu":     "Afficher _MENU_ éléments",
        "sInfo":           "Affichage de l'élément _START_ à _END_ sur _TOTAL_ éléments",
        "sInfoEmpty":      "Affichage de l'élément 0 à 0 sur 0 élément",
        "sInfoFiltered":   "(filtré de _MAX_ éléments au total)",
        "sInfoPostFix":    "",
        "sLoadingRecords": "Chargement en cours...",
        "sZeroRecords":    "Aucun élément à afficher",
        "sEmptyTable":     "Aucune donnée disponible dans le tableau",
        "oPaginate": {
            "sFirst":      "Premier",
            "sPrevious":   "Précédent",
            "sNext":       "Suivant",
            "sLast":       "Dernier"
        },
        "oAria": {
            "sSortAscending":  ": activer pour trier la colonne par ordre croissant",
            "sSortDescending": ": 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"
                }  
        }
    }
    

    The properties of the rows object are not surrounded by quotes. It should read:

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

    This must be fixed at the CDN.

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

    Yes, sorry. There is a bug in the current release file. I took a pull request to update it without validating the JSON - doh.

    You'll need to host the file locally or use an old version for the moment until the next release.

    Allan

  • MansourofskiMansourofski Posts: 1Questions: 0Answers: 0

    I had found the sollution,
    try this:

       {
            "language": {
                "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/French.json"
            }
        }
    
This discussion has been closed.