i18n()

Since: Editor 2.4.0

Lookup a language token.
Please note - this property requires the Editor extension for DataTables.

Description

This method exposes Editor's translated strings for each lookup based on Javascript object notation string. It is similar to the DataTables i18n() method, but provides an additional parameter to simplify external logic when dealing with optional configuration parameters for objects (e.g. fields). There is also no support for plurals in this method.

This method is only likely to be useful to you if you load additional information into the Editor configuration object, or you are developing a field type plug-in.

Type

i18n( custom, token [, default] )

Look up a translation token from the loaded language configuration.

Parameters:

Returns:

string:
The resolved language token.

Examples

Get default language string:

let editor = new DataTable.Editor(
	// ...
);

editor.i18n('edit.button');
// Results in 'Edit'

Set and get custom i18n data:

let editor = new DataTable.Editor({
	i18n: {
		custom: {
			first: 'First',
			second: 'Second
		}
	}
	// ...
});

editor.i18n('custom.second');
// Results in 'Second'

Related

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