Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Separate the variables of internationalized strings in controllers of…

… cake bake.

Signed-off-by: Mark Story <mark@mark-story.com>
  • Loading branch information...
commit d60a66f16b48a0f9cd0623f924c5c486d89fb802 1 parent 473e07a
@jrbasso jrbasso authored markstory committed
Showing with 16 additions and 16 deletions.
  1. +16 −16 cake/console/templates/default/actions/controller_actions.ctp
View
32 cake/console/templates/default/actions/controller_actions.ctp
@@ -27,10 +27,10 @@
function <?php echo $admin ?>view($id = null) {
if (!$id) {
<?php if ($wannaUseSession): ?>
- $this->Session->setFlash(__('Invalid <?php echo strtolower($singularHumanName) ?>', true));
+ $this->Session->setFlash(sprintf(__('Invalid %s', true), '<?php echo strtolower($singularHumanName) ?>'));
$this->redirect(array('action' => 'index'));
<?php else: ?>
- $this->flash(__('Invalid <?php echo strtolower($singularHumanName); ?>', true), array('action' => 'index'));
+ $this->flash(sprintf(__('Invalid %s', true), '<?php echo strtolower($singularHumanName); ?>'), array('action' => 'index'));
<?php endif; ?>
}
$this->set('<?php echo $singularName; ?>', $this-><?php echo $currentModelName; ?>->read(null, $id));
@@ -42,14 +42,14 @@
$this-><?php echo $currentModelName; ?>->create();
if ($this-><?php echo $currentModelName; ?>->save($this->data)) {
<?php if ($wannaUseSession): ?>
- $this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved', true));
+ $this->Session->setFlash(sprintf(__('The %s has been saved', true), '<?php echo strtolower($singularHumanName); ?>'));
$this->redirect(array('action' => 'index'));
<?php else: ?>
- $this->flash(__('<?php echo ucfirst(strtolower($currentModelName)); ?> saved.', true), array('action' => 'index'));
+ $this->flash(sprintf(__('%s saved.', true), '<?php echo ucfirst(strtolower($currentModelName)); ?>'), array('action' => 'index'));
<?php endif; ?>
} else {
<?php if ($wannaUseSession): ?>
- $this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.', true));
+ $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), '<?php echo strtolower($singularHumanName); ?>'));
<?php endif; ?>
}
}
@@ -74,23 +74,23 @@
function <?php echo $admin; ?>edit($id = null) {
if (!$id && empty($this->data)) {
<?php if ($wannaUseSession): ?>
- $this->Session->setFlash(__('Invalid <?php echo strtolower($singularHumanName); ?>', true));
+ $this->Session->setFlash(sprintf(__('Invalid %s', true), '<?php echo strtolower($singularHumanName); ?>'));
$this->redirect(array('action' => 'index'));
<?php else: ?>
- $this->flash(__('Invalid <?php echo strtolower($singularHumanName); ?>', true), array('action' => 'index'));
+ $this->flash(sprintf(__('Invalid %s', true), '<?php echo strtolower($singularHumanName); ?>'), array('action' => 'index'));
<?php endif; ?>
}
if (!empty($this->data)) {
if ($this-><?php echo $currentModelName; ?>->save($this->data)) {
<?php if ($wannaUseSession): ?>
- $this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved', true));
+ $this->Session->setFlash(sprintf(__('The %s has been saved', true), '<?php echo strtolower($singularHumanName); ?>'));
$this->redirect(array('action' => 'index'));
<?php else: ?>
- $this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.', true), array('action' => 'index'));
+ $this->flash(sprintf(__('The %s has been saved.', true), '<?php echo strtolower($singularHumanName); ?>'), array('action' => 'index'));
<?php endif; ?>
} else {
<?php if ($wannaUseSession): ?>
- $this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.', true));
+ $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), '<?php echo strtolower($singularHumanName); ?>'));
<?php endif; ?>
}
}
@@ -117,24 +117,24 @@
function <?php echo $admin; ?>delete($id = null) {
if (!$id) {
<?php if ($wannaUseSession): ?>
- $this->Session->setFlash(__('Invalid id for <?php echo strtolower($singularHumanName); ?>', true));
+ $this->Session->setFlash(sprintf(__('Invalid id for %s', true), '<?php echo strtolower($singularHumanName); ?>'));
$this->redirect(array('action'=>'index'));
<?php else: ?>
- $this->flash(__('Invalid <?php echo strtolower($singularHumanName); ?>', true), array('action' => 'index'));
+ $this->flash(sprintf(__('Invalid %s', true), '<?php echo strtolower($singularHumanName); ?>'), array('action' => 'index'));
<?php endif; ?>
}
if ($this-><?php echo $currentModelName; ?>->delete($id)) {
<?php if ($wannaUseSession): ?>
- $this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted', true));
+ $this->Session->setFlash(sprintf(__('%s deleted', true), '<?php echo ucfirst(strtolower($singularHumanName)); ?>'));
$this->redirect(array('action'=>'index'));
<?php else: ?>
- $this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted', true), array('action' => 'index'));
+ $this->flash(sprintf(__('%s deleted', true), '<?php echo ucfirst(strtolower($singularHumanName)); ?>'), array('action' => 'index'));
<?php endif; ?>
}
<?php if ($wannaUseSession): ?>
- $this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted', true));
+ $this->Session->setFlash(sprintf(__('%s was not deleted', true), '<?php echo ucfirst(strtolower($singularHumanName)); ?>'));
<?php else: ?>
- $this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted', true), array('action' => 'index'));
+ $this->flash(sprintf(__('%s was not deleted', true), '<?php echo ucfirst(strtolower($singularHumanName)); ?>'), array('action' => 'index'));
<?php endif; ?>
$this->redirect(array('action' => 'index'));
}
Please sign in to comment.
Something went wrong with that request. Please try again.