{hero}

language.url

Since: DataTables 1.10

Load language information from remote file.

Description

All of the language options DataTables provides can be stored in a file on the server, which DataTables will look up if this parameter is passed. The file must be a valid JSON file, and the object it contains has the same properties as the language object in the initialiser object (a subset of those properties is also valid).

As of DataTables 1.12, you can use a remote language file as well as local language options, and the local options will take priority.

There are a wide range of translations readily available on this site, in the internationalisation plug-ins.

Note that when this parameter is set, DataTables' initialisation will be asynchronous due to the Ajax data load. That is to say that the table will not be drawn until the Ajax request has completed. As such, any actions that require the table to have completed its initialisation should be placed into the initComplete callback.

Type

This option can be given in the following type(s):

Examples

Load language information from a remote file:

$('#example').DataTable({
	language: {
		url: '/dataTables/i18n/de_de.lang'
	}
});

Remote file and local string override:

$('#example').DataTable({
	language: {
		search: 'In der Tabelle finden',
		url: '/dataTables/i18n/de_de.lang'
	}
});

Performing an action after Ajax loading language strings:

$('#example').dataTable({
	language: {
		url: '/dataTables/i18n/de_de.lang'
	},
	initComplete: function () {
		var api = this.api();

		// Put the sum of column 5 into the footer cell
		$(api.column(5).footer()).html(
			api
				.column(5)
				.data()
				.reduce(function (a, b) {
					return a + b;
				})
		);
	}
});

Related

The following options are directly related and may also be useful in your application development.