protected function _replaceInCode($stub, $dest)
{
+ $singular = $this->getOption('singular', $this->getOption('name'));
+ $plural = $this->getOption('plural', '');
+
+ $totranslate = [$singular, $plural];
+ $translate = '/*' . "\n";
+ foreach ($totranslate as $str) {
+ if (!$str) {
+ continue;
+ }
+ $translate .= "\t__('" . addcslashes($str, "'") . "')\n";
+ }
+ $translate .= "\t*/";
+
$vars = ['CONTROLLERCLASS' => $this->getControllerClass(),
'ROUTEURL' => $this->getOption('route', $this->getOption('name')),
- 'SINGULAR' => $this->getOption('singular', $this->getOption('name')),
- 'PLURAL' => $this->getOption('plural', ''),
+ 'SINGULAR' => $singular,
+ 'PLURAL' => $plural,
'MODELNAMESPACE' => get_class($this),
'EXTENDS' => '\\' . $this->_getBaseController(),
'BULK' => $this->getOption('bulk', true) ? 'true' : 'false',
'ONEINSTANCE' => $this->getOption('oneinstance', false) ? 'true' : 'false',
- 'USE' => $this->_getUse()];
+ 'USE' => $this->_getUse(),
+ 'TRANSLATE' => $translate];
$res = file_get_contents($stub);
foreach ($vars as $name => $value) {