Skip to content

Instantly share code, notes, and snippets.

@zackkatz
Created February 10, 2015 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zackkatz/5e37e21a4ab79783fa9c to your computer and use it in GitHub Desktop.
Save zackkatz/5e37e21a4ab79783fa9c to your computer and use it in GitHub Desktop.
Translate the DataTables script in the GravityView DataTables extension
<?php
/**
* Add this code to your theme's functions.php file
*/
add_filter( 'gravityview/datatables/config/language', 'translate_gv_datatables' );
/**
* If you want to translate DataTables, you can use some of the existing translations
*
* Available on their website: {@link http://www.datatables.net/plug-ins/i18n/}
*
* 1. Visit the Translations page {@link http://www.datatables.net/plug-ins/i18n/}
* 2. Click on the translation you want
* 3. Copy the CDN URL provided
* 4. Paste it where marked in the code below
* 5. Add this code to your theme's `functions.php` file
*
* @param array $settings Existing translation strings
*
* @return array Modified translation strings - use the JSON URL instead
*/
function translate_gv_datatables( $settings ) {
// Replace with your URL here
$url = '//cdn.datatables.net/plug-ins/f2c75b7247b/i18n/French.json';
return array(
'url' => $url
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment