Skip to content

Instantly share code, notes, and snippets.

@pfranc
Created July 16, 2012 21:28
Show Gist options
  • Save pfranc/3125181 to your computer and use it in GitHub Desktop.
Save pfranc/3125181 to your computer and use it in GitHub Desktop.
$this->log('Extracting gettext strings');
$xgettext = popen('xgettext --files-from=- --no-location --language=PHP --from-code=UTF-8 --no-wrap --omit-header -j -o "' . $messagesFile . '"', 'w');
foreach ($dirs as $dir) {
$iterator = new RegexIterator(
new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(
$dir,
FilesystemIterator::SKIP_DOTS
)
),
'%.+php$%'
);
foreach($iterator as $entry) {
if (strpos($entry, 'vendor') === FALSE && strpos($entry, 'tests') === FALSE) {
fwrite($xgettext, $entry . "\n");
}
}
}
fclose($xgettext);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment