How to make intl work ?

How to make intl work ?

micheld88micheld88 Posts: 12Questions: 3Answers: 0
edited May 2016 in Free community support

Hi !
I'am using DataTables 1.10.5 and I try to make the language example work but it doesn't.

here is my code:

<pre>
<code class="multiline">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css">
    <script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.12.3.min.js">
    </script>
    <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js">
    </script>
    <script type="text/javascript" class="init">
    $(document).ready(function() {
        $('#example').DataTable( {
            "oLanguage": {"sUrl": "i18n/dataTables.french.lang" },
        } );
    } );
  </script>
  </head>
  <body>
    <table id="example" class="display" cellspacing="0" width="100%">
      ... idem Datatables example from https://datatables.net/examples/basic_init/language.html
    </table>
  </body>
</html>
</code>
</pre>

where
dataTables.french.lang is

<pre>
<code class="multiline">
/**
 * French translation
 *  @name French
 *  @anchor French
 *  @author 
 */

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

What is wrong ?

Thanks,
Michel.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,920Questions: 1Answers: 10,153 Site admin
    Answer ✓

    Remove the Javascript comment from the top of the language file. That makes it invalid JSON.

    Use this file or copy the contents into your own local copy.

    Allan

  • micheld88micheld88 Posts: 12Questions: 3Answers: 0

    Thanks Allan !

    Removing the comments do the trick.

    Michel.

This discussion has been closed.