Created
December 30, 2013 21:31
-
-
Save paulgibbs/8188490 to your computer and use it in GitHub Desktop.
hack of WordPress' https://develop.svn.wordpress.org/trunk/tools/i18n/extract.php to find gettext strings without a textdomain
This file contains hidden or 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 | |
function extract_from_code( $code, $file_name ) { | |
$translations = new Translations; | |
$function_calls = $this->find_function_calls( array_keys( $this->rules ), $code ); | |
foreach( $function_calls as $call ) { | |
// These lines! | |
if ( in_array( 'buddypress', $call['args'] ) ) { | |
continue; | |
} | |
$entry = $this->entry_from_call( $call, $file_name ); | |
if ( is_array( $entry ) ) | |
foreach( $entry as $single_entry ) | |
$translations->add_entry_or_merge( $single_entry ); | |
elseif ( $entry) | |
$translations->add_entry_or_merge( $entry ); | |
} | |
return $translations; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment