From cb7f0f087ec1dfd19b611afded64b896c5316290 Mon Sep 17 00:00:00 2001 From: AD7six Date: Sat, 12 Mar 2011 19:59:40 +0100 Subject: [PATCH] translation changes in the controller ditranslation changes in the controller dirr --- .../Controller/Component/AclComponent.php | 16 +++++++-------- .../Component/Auth/BaseAuthorize.php | 2 +- .../Component/Auth/ControllerAuthorize.php | 2 +- .../Component/Auth/CrudAuthorize.php | 2 +- .../Controller/Component/AuthComponent.php | 10 +++++----- .../Controller/Component/EmailComponent.php | 2 +- lib/Cake/Controller/Scaffold.php | 20 +++++++++---------- 7 files changed, 27 insertions(+), 27 deletions(-) mode change 100755 => 100644 lib/Cake/Controller/Component/EmailComponent.php diff --git a/lib/Cake/Controller/Component/AclComponent.php b/lib/Cake/Controller/Component/AclComponent.php index e8809f864..d0b9dd188 100644 --- a/lib/Cake/Controller/Component/AclComponent.php +++ b/lib/Cake/Controller/Component/AclComponent.php @@ -68,7 +68,7 @@ class AclComponent extends Component { list($plugin, $name) = pluginSplit($name); $name .= 'Component'; } else { - throw new CakeException(__('Could not find %s.', $name)); + throw new CakeException(__d('cake', 'Could not find %s.', $name)); } } $this->adapter($name); @@ -92,7 +92,7 @@ class AclComponent extends Component { $adapter = new $adapter(); } if (!$adapter instanceof AclInterface) { - throw new CakeException(__('AclComponent adapters must implement AclInterface')); + throw new CakeException(__d('cake', 'AclComponent adapters must implement AclInterface')); } $this->_Instance = $adapter; $this->_Instance->initialize($this); @@ -163,7 +163,7 @@ class AclComponent extends Component { * @deprecated */ public function grant($aro, $aco, $action = "*") { - trigger_error(__('AclComponent::grant() is deprecated, use allow() instead'), E_USER_WARNING); + trigger_error(__d('cake', 'AclComponent::grant() is deprecated, use allow() instead'), E_USER_WARNING); return $this->_Instance->allow($aro, $aco, $action); } @@ -177,7 +177,7 @@ class AclComponent extends Component { * @deprecated */ public function revoke($aro, $aco, $action = "*") { - trigger_error(__('AclComponent::revoke() is deprecated, use deny() instead'), E_USER_WARNING); + trigger_error(__d('cake', 'AclComponent::revoke() is deprecated, use deny() instead'), E_USER_WARNING); return $this->_Instance->deny($aro, $aco, $action); } } @@ -299,12 +299,12 @@ class DbAcl extends Object implements AclInterface { $acoPath = $this->Aco->node($aco); if (empty($aroPath) || empty($acoPath)) { - trigger_error(__("DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references:\nAro: ") . print_r($aro, true) . "\nAco: " . print_r($aco, true), E_USER_WARNING); + trigger_error(__d('cake', "DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references:\nAro: ") . print_r($aro, true) . "\nAco: " . print_r($aco, true), E_USER_WARNING); return false; } if ($acoPath == null || $acoPath == array()) { - trigger_error(__("DbAcl::check() - Failed ACO node lookup in permissions check. Node references:\nAro: ") . print_r($aro, true) . "\nAco: " . print_r($aco, true), E_USER_WARNING); + trigger_error(__d('cake', "DbAcl::check() - Failed ACO node lookup in permissions check. Node references:\nAro: ") . print_r($aro, true) . "\nAco: " . print_r($aco, true), E_USER_WARNING); return false; } @@ -312,7 +312,7 @@ class DbAcl extends Object implements AclInterface { $acoNode = $acoPath[0]; if ($action != '*' && !in_array('_' . $action, $permKeys)) { - trigger_error(__("ACO permissions key %s does not exist in DbAcl::check()", $action), E_USER_NOTICE); + trigger_error(__d('cake', "ACO permissions key %s does not exist in DbAcl::check()", $action), E_USER_NOTICE); return false; } @@ -386,7 +386,7 @@ class DbAcl extends Object implements AclInterface { $save = array(); if ($perms == false) { - trigger_error(__('DbAcl::allow() - Invalid node'), E_USER_WARNING); + trigger_error(__d('cake', 'DbAcl::allow() - Invalid node'), E_USER_WARNING); return false; } if (isset($perms[0])) { diff --git a/lib/Cake/Controller/Component/Auth/BaseAuthorize.php b/lib/Cake/Controller/Component/Auth/BaseAuthorize.php index 911bbdb24..7a5245174 100644 --- a/lib/Cake/Controller/Component/Auth/BaseAuthorize.php +++ b/lib/Cake/Controller/Component/Auth/BaseAuthorize.php @@ -87,7 +87,7 @@ abstract class BaseAuthorize { public function controller($controller = null) { if ($controller) { if (!$controller instanceof Controller) { - throw new CakeException(__('$controller needs to be an instance of Controller')); + throw new CakeException(__d('cake', '$controller needs to be an instance of Controller')); } $this->_Controller = $controller; return true; diff --git a/lib/Cake/Controller/Component/Auth/ControllerAuthorize.php b/lib/Cake/Controller/Component/Auth/ControllerAuthorize.php index 275cf6875..816cb836d 100644 --- a/lib/Cake/Controller/Component/Auth/ControllerAuthorize.php +++ b/lib/Cake/Controller/Component/Auth/ControllerAuthorize.php @@ -46,7 +46,7 @@ class ControllerAuthorize extends BaseAuthorize { public function controller($controller = null) { if ($controller) { if (!method_exists($controller, 'isAuthorized')) { - throw new CakeException(__('$controller does not implement an isAuthorized() method.')); + throw new CakeException(__d('cake', '$controller does not implement an isAuthorized() method.')); } } return parent::controller($controller); diff --git a/lib/Cake/Controller/Component/Auth/CrudAuthorize.php b/lib/Cake/Controller/Component/Auth/CrudAuthorize.php index b9fa8329c..1adda536e 100644 --- a/lib/Cake/Controller/Component/Auth/CrudAuthorize.php +++ b/lib/Cake/Controller/Component/Auth/CrudAuthorize.php @@ -81,7 +81,7 @@ class CrudAuthorize extends BaseAuthorize { */ public function authorize($user, CakeRequest $request) { if (!isset($this->settings['actionMap'][$request->params['action']])) { - trigger_error(__( + trigger_error(__d('cake', 'CrudAuthorize::authorize() - Attempted access of un-mapped action "%1$s" in controller "%2$s"', $request->action, $request->controller diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index c4927be0f..34df18bcc 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -351,7 +351,7 @@ class AuthComponent extends Component { function __setDefaults() { $defaults = array( 'logoutRedirect' => $this->loginAction, - 'authError' => __('You are not authorized to access that location.') + 'authError' => __d('cake', 'You are not authorized to access that location.') ); foreach ($defaults as $key => $value) { if (empty($this->{$key})) { @@ -411,10 +411,10 @@ class AuthComponent extends Component { $className = $class . 'Authorize'; App::uses($className, $plugin . 'Controller/Component/Auth'); if (!class_exists($className)) { - throw new CakeException(__('Authorization adapter "%s" was not found.', $class)); + throw new CakeException(__d('cake', 'Authorization adapter "%s" was not found.', $class)); } if (!method_exists($className, 'authorize')) { - throw new CakeException(__('Authorization objects must implement an authorize method.')); + throw new CakeException(__d('cake', 'Authorization objects must implement an authorize method.')); } $settings = array_merge($global, (array)$settings); $this->_authorizeObjects[] = new $className($this->_Collection, $settings); @@ -651,10 +651,10 @@ class AuthComponent extends Component { $className = $class . 'Authenticate'; App::uses($className, $plugin . 'Controller/Component/Auth'); if (!class_exists($className)) { - throw new CakeException(__('Authentication adapter "%s" was not found.', $class)); + throw new CakeException(__d('cake', 'Authentication adapter "%s" was not found.', $class)); } if (!method_exists($className, 'authenticate')) { - throw new CakeException(__('Authentication objects must implement an authenticate method.')); + throw new CakeException(__d('cake', 'Authentication objects must implement an authenticate method.')); } $settings = array_merge($global, (array)$settings); $this->_authenticateObjects[] = new $className($this->_Collection, $settings); diff --git a/lib/Cake/Controller/Component/EmailComponent.php b/lib/Cake/Controller/Component/EmailComponent.php old mode 100755 new mode 100644 index 735a50d63..b260c1561 --- a/lib/Cake/Controller/Component/EmailComponent.php +++ b/lib/Cake/Controller/Component/EmailComponent.php @@ -725,7 +725,7 @@ class EmailComponent extends Component { $formatted = array(); if ($this->_lineLength !== null) { - trigger_error(__('_lineLength cannot be accessed please use lineLength'), E_USER_WARNING); + trigger_error(__d('cake', '_lineLength cannot be accessed please use lineLength'), E_USER_WARNING); $this->lineLength = $this->_lineLength; } diff --git a/lib/Cake/Controller/Scaffold.php b/lib/Cake/Controller/Scaffold.php index 3eb718df1..054e3a1a3 100644 --- a/lib/Cake/Controller/Scaffold.php +++ b/lib/Cake/Controller/Scaffold.php @@ -127,7 +127,7 @@ class Scaffold { $this->ScaffoldModel = $this->controller->{$this->modelClass}; $this->scaffoldTitle = Inflector::humanize($this->viewPath); $this->scaffoldActions = $controller->scaffold; - $title_for_layout = __('Scaffold :: ') . Inflector::humanize($request->action) . ' :: ' . $this->scaffoldTitle; + $title_for_layout = __d('cake', 'Scaffold :: ') . Inflector::humanize($request->action) . ' :: ' . $this->scaffoldTitle; $modelClass = $this->controller->modelClass; $primaryKey = $this->ScaffoldModel->primaryKey; $displayField = $this->ScaffoldModel->displayField; @@ -174,7 +174,7 @@ class Scaffold { $this->ScaffoldModel->id = $request->params['pass'][0]; } if (!$this->ScaffoldModel->exists()) { - throw new NotFoundException(__('Invalid %s', Inflector::humanize($this->modelKey))); + throw new NotFoundException(__d('cake', 'Invalid %s', Inflector::humanize($this->modelKey))); } $this->ScaffoldModel->recursive = 1; $this->controller->request->data = $this->ScaffoldModel->read(); @@ -231,10 +231,10 @@ class Scaffold { */ protected function _scaffoldSave(CakeRequest $request, $action = 'edit') { $formAction = 'edit'; - $success = __('updated'); + $success = __d('cake', 'updated'); if ($action === 'add') { $formAction = 'add'; - $success = __('saved'); + $success = __d('cake', 'saved'); } if ($this->controller->_beforeScaffold($action)) { @@ -243,7 +243,7 @@ class Scaffold { $this->ScaffoldModel->id = $request['pass'][0]; } if (!$this->ScaffoldModel->exists()) { - throw new NotFoundException(__('Invalid %s', Inflector::humanize($this->modelKey))); + throw new NotFoundException(__d('cake', 'Invalid %s', Inflector::humanize($this->modelKey))); } } @@ -254,7 +254,7 @@ class Scaffold { if ($this->ScaffoldModel->save($request->data)) { if ($this->controller->_afterScaffoldSave($action)) { - $message = __( + $message = __d('cake', 'The %1$s has been %2$s', Inflector::humanize($this->modelKey), $success @@ -265,7 +265,7 @@ class Scaffold { } } else { if ($this->_validSession) { - $this->controller->Session->setFlash(__('Please correct errors below.')); + $this->controller->Session->setFlash(__d('cake', 'Please correct errors below.')); } } } @@ -312,13 +312,13 @@ class Scaffold { } $this->ScaffoldModel->id = $id; if (!$this->ScaffoldModel->exists()) { - throw new NotFoundException(__('Invalid %s', Inflector::humanize($this->modelClass))); + throw new NotFoundException(__d('cake', 'Invalid %s', Inflector::humanize($this->modelClass))); } if ($this->ScaffoldModel->delete()) { - $message = __('The %1$s with id: %2$d has been deleted.', Inflector::humanize($this->modelClass), $id); + $message = __d('cake', 'The %1$s with id: %2$d has been deleted.', Inflector::humanize($this->modelClass), $id); return $this->_sendMessage($message); } else { - $message = __( + $message = __d('cake', 'There was an error deleting the %1$s with id: %2$d', Inflector::humanize($this->modelClass), $id