Internationalisation plug-ins

Localisation of the presentation layer is important for any software package, and I aim to make this normally arduous task as easy as possible in DataTables. To this end, a number of contributors have kindly translated the language strings used is DataTables into various different languages. If you translate DataTables into any other languages, please get in touch or send a Github pull request.

How to use

In DataTables there are two initialisation methods by which you can include internationalisation options in DataTables:

  • Loading the language file through an Ajax request (language.url)
  • At initialisation time using the language property.

How you load the translation file will depend on how you are loading DataTables. If you are loading in the browser, use the .json files and set the language.url option. If you are using ESM or CommonJS, you would typically use the language option.

Browser

Loading DataTables' language information directly in the browser is done with the .json files - for example:

var table = new DataTable('#myTable', {
    language: {
        url: 'dataTables.german.json',
    },
});

ES modules

When using ES modules (e.g. with Vite or similar bundler), you can use the datatables.net-plugins package (.mjs files) and include the translations from there:

import DataTable from 'datatables.net';
import languageDE from 'datatables.net-plugins/i18n/de-DE.mjs';

var table = new DataTable('#myTable', {
    language: languageDE,
});

CommonJS

If you are using CommonJS (i.e. in an older version of Node or Webpack), the .js files can be loaded in and the CommonJS loader will return the JSON structure for the translation (note that unlike the other DataTables plug-ins it does not return a function to be executed - just a JSON object):

var $ = require('jquery');
var DataTable = require('datatables.net')(window, $);
var languageDE = require('datatables.net-plugins/i18n/de-DE.js');

var table = new DataTable('#myTable', {
    language: languageDE,
});

Translations