Sometimes it is necessary or desired to change certain text strings of the features like Search and Pagination, that are visible around a table. An example would be to change the word “Search:” to “Filter:” or similar. These text strings are stored in files like this (this is the English file):
return array( 'emptyTable' => 'No data available in table', 'info' => 'Showing _START_ to _END_ of _TOTAL_ entries', 'infoEmpty' => 'Showing 0 to 0 of 0 entries', 'infoFiltered' => '(filtered from _MAX_ total entries)', 'infoPostFix' => '', 'lengthMenu' => 'Show _MENU_ entries', 'loadingRecords' => 'Loading...', 'processing' => 'Processing...', 'search' => 'Search:', 'zeroRecords' => 'No matching records found', 'paginate' => array( 'first' => 'First', 'previous' => 'Previous', 'next' => 'Next', 'last' => 'Last', ), 'aria' => array( 'sortAscending' => ': activate to sort column ascending', 'sortDescending' => ': activate to sort column descending', ), 'decimal' => '', 'thousands' => ',', );Code language: PHP (php)
This content denotes a PHP array with a “key” and a “value”. The “key” is used to retrieve the particular “value” string. Most strings in this file are self-explaining. Two of them are however not used for translations but for setting the data format of a number, e.g. for the sorting feature. Using the
"thousands" parameters, the used number format can be changed. The default values in the example above will result in the traditional English format for a number, “100,000.00”. To use e.g. “100.000,00”, which is more common in Europe, the values have to be changed to
"decimal": "," and
To use this Extension, install and activate it like a regular WordPress plugin. Then copy the “lang-xy_XY.php” file of your language from the “tablepress/i18n/datatables/” folder to the “tablepress-change-datatables-strings” folder. (The “en_US” file is already in that folder, as an example.)
You can now change any string that is on the right side of the
=> in that copied file. Make sure to not remove any of the quotation marks
'. The words that are surrounded by an underscore
_ are placeholders for the numbers or input fields that are automatically added by the DataTables script. You must not alter those (you can however put them in a new place within the string).
With the Extension activated, TablePress will now use the strings from the modified file.