diff --git a/src/Shell/Task/ExtractTask.php b/src/Shell/Task/ExtractTask.php index de95bac1e79..6c79fa80014 100644 --- a/src/Shell/Task/ExtractTask.php +++ b/src/Shell/Task/ExtractTask.php @@ -49,6 +49,13 @@ class ExtractTask extends Shell */ protected $_merge = false; + /** + * Use relative paths in the pot files rather than full path + * + * @var bool + */ + protected $_relativePaths = false; + /** * Current file being processed * @@ -233,6 +240,10 @@ public function main() $this->_merge = strtolower($response) === 'y'; } + if (isset($this->params['relative-paths'])) { + $this->_relativePaths = !(strtolower($this->params['relative-paths']) === 'no'); + } + if (empty($this->_files)) { $this->_searchFiles(); } @@ -321,6 +332,9 @@ public function getOptionParser() ])->addOption('merge', [ 'help' => 'Merge all domain strings into the default.po file.', 'choices' => ['yes', 'no'] + ])->addOption('relative-paths', [ + 'help' => 'Use relative paths in the .pot file', + 'choices' => ['yes', 'no'] ])->addOption('output', [ 'help' => 'Full path to output directory.' ])->addOption('files', [ @@ -447,6 +461,9 @@ protected function _parse($functionName, $map) 'file' => $this->_file, 'line' => $line, ]; + if ($this->_relativePaths) { + $details['file'] = '.' . str_replace(ROOT, '', $details['file']); + } if (isset($plural)) { $details['msgid_plural'] = $plural; }