Created
February 10, 2015 15:57
-
-
Save zackkatz/5e37e21a4ab79783fa9c to your computer and use it in GitHub Desktop.
Translate the DataTables script in the GravityView DataTables extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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