Skip to content

Commit

Permalink
Updating __() use in scaffold to take advantage of sprintf() being bu…
Browse files Browse the repository at this point in the history
…ilt into __() now.
  • Loading branch information
markstory committed Dec 12, 2010
1 parent daffe3a commit 661195d
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions cake/libs/controller/scaffold.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ protected function _output() {
protected function _scaffoldView(CakeRequest $request) {
if ($this->controller->_beforeScaffold('view')) {

$message = __(sprintf("No id set for %s::view()", Inflector::humanize($this->modelKey)));
$message = __("No id set for %s::view()", Inflector::humanize($this->modelKey));
if (isset($request->params['pass'][0])) {
$this->ScaffoldModel->id = $request->params['pass'][0];
} else {
Expand Down Expand Up @@ -247,7 +247,7 @@ protected function _scaffoldSave(CakeRequest $request, $action = 'edit') {
}

if (!$this->ScaffoldModel->exists()) {
$message = sprintf(__("Invalid id for %s::edit()", true), Inflector::humanize($this->modelKey));
$message = __("Invalid id for %s::edit()", Inflector::humanize($this->modelKey));
return $this->_sendMessage($message);
}
}
Expand All @@ -259,8 +259,8 @@ protected function _scaffoldSave(CakeRequest $request, $action = 'edit') {

if ($this->ScaffoldModel->save($request->data)) {
if ($this->controller->_afterScaffoldSave($action)) {
$message = sprintf(
__('The %1$s has been %2$s'),
$message = __(
'The %1$s has been %2$s',
Inflector::humanize($this->modelKey),
$success
);
Expand Down Expand Up @@ -308,26 +308,21 @@ protected function _scaffoldSave(CakeRequest $request, $action = 'edit') {
*/
protected function _scaffoldDelete(CakeRequest $request) {
if ($this->controller->_beforeScaffold('delete')) {
$message = sprintf(
__("No id set for %s::delete()", true),
Inflector::humanize($this->modelKey)
);
$message = __("No id set for %s::delete()", Inflector::humanize($this->modelKey));
if (isset($request->params['pass'][0])) {
$id = $request->params['pass'][0];
} else {
return $this->_sendMessage($message);
}

if ($this->ScaffoldModel->delete($id)) {
$message = sprintf(
__('The %1$s with id: %2$d has been deleted.', true),
Inflector::humanize($this->modelClass), $id
);
$message = __('The %1$s with id: %2$d has been deleted.', Inflector::humanize($this->modelClass), $id);
return $this->_sendMessage($message);
} else {
$message = sprintf(
__('There was an error deleting the %1$s with id: %2$d', true),
Inflector::humanize($this->modelClass), $id
$message = __(
'There was an error deleting the %1$s with id: %2$d',
Inflector::humanize($this->modelClass),
$id
);
return $this->_sendMessage($message);
}
Expand Down

0 comments on commit 661195d

Please sign in to comment.