mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-09 04:52:42 +00:00
Adding a optinal parameter and question for merge action. Refs #147.
This commit is contained in:
parent
84ec53a039
commit
df8895a266
1 changed files with 22 additions and 3 deletions
|
@ -45,6 +45,14 @@ class ExtractTask extends Shell {
|
|||
*/
|
||||
var $__files = array();
|
||||
|
||||
/**
|
||||
* Merge all domains string into the default.pot file
|
||||
*
|
||||
* @var boolean
|
||||
* @access public
|
||||
*/
|
||||
var $__merge = false;
|
||||
|
||||
/**
|
||||
* Current file being processed
|
||||
*
|
||||
|
@ -137,6 +145,14 @@ class ExtractTask extends Shell {
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($this->params['merge'])) {
|
||||
$this->__merge = !(strtolower($this->params['merge']) === 'no');
|
||||
} else {
|
||||
$this->out();
|
||||
$response = $this->in(sprintf(__('Would you like to merge all domains strings into the default.pot file?', true)), array('y', 'n'), 'n');
|
||||
$this->__merge = strtolower($response) === 'y';
|
||||
}
|
||||
|
||||
if (empty($this->__files)) {
|
||||
$this->__searchFiles();
|
||||
}
|
||||
|
@ -176,15 +192,18 @@ class ExtractTask extends Shell {
|
|||
$this->out(__('By default the .pot file(s) will be place in the locale directory of -app', true));
|
||||
$this->out(__('By default -app is ROOT/app', true));
|
||||
$this->hr();
|
||||
$this->out(__('Usage: cake i18n extract [command] [path...]', true));
|
||||
$this->out(__('Usage: cake i18n extract <command> <param1> <param2>...', true));
|
||||
$this->out();
|
||||
$this->out(__('Commands:', true));
|
||||
$this->out(__('Params:', true));
|
||||
$this->out(__(' -app [path...]: directory where your application is located', true));
|
||||
$this->out(__(' -root [path...]: path to install', true));
|
||||
$this->out(__(' -core [path...]: path to cake directory', true));
|
||||
$this->out(__(' -paths [comma separated list of paths, full path is needed]', true));
|
||||
$this->out(__(' -merge [yes|no]: Merge all domains strings into the default.pot file', true));
|
||||
$this->out(__(' -output [path...]: Full path to output directory', true));
|
||||
$this->out(__(' -files: [comma separated list of files, full path to file is needed]', true));
|
||||
$this->out();
|
||||
$this->out(__('Commands:', true));
|
||||
$this->out(__(' cake i18n extract help: Shows this help message.', true));
|
||||
$this->out();
|
||||
}
|
||||
|
@ -322,7 +341,7 @@ class ExtractTask extends Shell {
|
|||
}
|
||||
|
||||
$this->__store($domain, $header, $sentence);
|
||||
if ($domain != 'default') {
|
||||
if ($domain != 'default' && $this->__merge) {
|
||||
$this->__store('default', $header, $sentence);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue