Internationalisation

DataTables adds several controls to a document when it enhances a table, many of which utilise language strings in one way or another to convey the usage to the end user. These default strings are in English, but can easily be translated into another language, or customised to suit the exact styling of the data represented by your table.

There are 90+ translations provided by the community ready to be used making integration of DataTables into your native language super easy!

Configuration

The language options used by DataTables are configured through the language configuration option. This is an object with the strings used by each part of DataTables described by a parameter. The full list of language options is available in the language documentation reference.

The language options are configured in exactly the same way as the other configuration options in DataTables, as part of the initialisation object. This example shows how the search string can be altered:

$('#example').DataTable( {
    language: {
        search: "Search in table:"
    }
} );

As with the other initialisation options, you can change as many or as few of the options as you wish. Those you don't provide a value for will use the DataTables defaults. This example shows every language option used to display the DataTables interface in French:

$('#example').DataTable( {
    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"
        }
    }
} );

Ajax loading a translation

For convenience, DataTables provides the option of loading language information from a remote file via Ajax. This is configured through the language.url option. For example we might have:

$('#example').DataTable( {
    language: {
        url: '/localisation/fr_FR.json'
    }
} );

As with the other options in language the file loaded by Ajax can specify as many or as few options as you require for the DataTables language option. Any options which are not specified will use the DataTables default values.

Ordering of numeric data

Numeric data is often presented formatted according to certain rules, such as a given character for a decimal place, a thousands separator and an identification of the numeric type such as a currency symbol. DataTables will automatically detect numeric data types such as currency, percentage values, and values with thousands separators, but by default these all work with a dot (.) as the decimal place, as this is how numbers are represented in Javascript.

DataTables has the ability to use any character as the decimal place for numeric data through the language.decimal option, providing full numeric type detection and ordering for any form of numeric data. For example, many parts of the world use a comma (,) as the decimal place, Unicode defines the decimal separator character (), and a dash (-) is sometimes used in financial documents, etc.

By using the language.decimal option you can tell DataTables what character to look for as the decimal place in the data in your table, so ordering of that data can occur correctly.

As with all language parameters in DataTables, language.decimal can be defined in the initialisation of the table or in a language file which is loaded by Ajax (shown above).

$('#example').DataTable( {
    language: {
        decimal: ",",
    }
} );

Available translations

The DataTables community have collectively submitted more than 50 translations of the default English language strings, which are readily available for you to use in your project. These are available in the plug-ins section of this site.