translation changes in the controller ditranslation changes in the

controller dirr
This commit is contained in:
AD7six 2011-03-12 19:59:40 +01:00
parent 8f0c923cf6
commit cb7f0f087e
7 changed files with 27 additions and 27 deletions

View file

@ -68,7 +68,7 @@ class AclComponent extends Component {
list($plugin, $name) = pluginSplit($name); list($plugin, $name) = pluginSplit($name);
$name .= 'Component'; $name .= 'Component';
} else { } else {
throw new CakeException(__('Could not find %s.', $name)); throw new CakeException(__d('cake', 'Could not find %s.', $name));
} }
} }
$this->adapter($name); $this->adapter($name);
@ -92,7 +92,7 @@ class AclComponent extends Component {
$adapter = new $adapter(); $adapter = new $adapter();
} }
if (!$adapter instanceof AclInterface) { 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 = $adapter;
$this->_Instance->initialize($this); $this->_Instance->initialize($this);
@ -163,7 +163,7 @@ class AclComponent extends Component {
* @deprecated * @deprecated
*/ */
public function grant($aro, $aco, $action = "*") { 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); return $this->_Instance->allow($aro, $aco, $action);
} }
@ -177,7 +177,7 @@ class AclComponent extends Component {
* @deprecated * @deprecated
*/ */
public function revoke($aro, $aco, $action = "*") { 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); return $this->_Instance->deny($aro, $aco, $action);
} }
} }
@ -299,12 +299,12 @@ class DbAcl extends Object implements AclInterface {
$acoPath = $this->Aco->node($aco); $acoPath = $this->Aco->node($aco);
if (empty($aroPath) || empty($acoPath)) { 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; return false;
} }
if ($acoPath == null || $acoPath == array()) { 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; return false;
} }
@ -312,7 +312,7 @@ class DbAcl extends Object implements AclInterface {
$acoNode = $acoPath[0]; $acoNode = $acoPath[0];
if ($action != '*' && !in_array('_' . $action, $permKeys)) { 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; return false;
} }
@ -386,7 +386,7 @@ class DbAcl extends Object implements AclInterface {
$save = array(); $save = array();
if ($perms == false) { 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; return false;
} }
if (isset($perms[0])) { if (isset($perms[0])) {

View file

@ -87,7 +87,7 @@ abstract class BaseAuthorize {
public function controller($controller = null) { public function controller($controller = null) {
if ($controller) { if ($controller) {
if (!$controller instanceof 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; $this->_Controller = $controller;
return true; return true;

View file

@ -46,7 +46,7 @@ class ControllerAuthorize extends BaseAuthorize {
public function controller($controller = null) { public function controller($controller = null) {
if ($controller) { if ($controller) {
if (!method_exists($controller, 'isAuthorized')) { 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); return parent::controller($controller);

View file

@ -81,7 +81,7 @@ class CrudAuthorize extends BaseAuthorize {
*/ */
public function authorize($user, CakeRequest $request) { public function authorize($user, CakeRequest $request) {
if (!isset($this->settings['actionMap'][$request->params['action']])) { 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"', 'CrudAuthorize::authorize() - Attempted access of un-mapped action "%1$s" in controller "%2$s"',
$request->action, $request->action,
$request->controller $request->controller

View file

@ -351,7 +351,7 @@ class AuthComponent extends Component {
function __setDefaults() { function __setDefaults() {
$defaults = array( $defaults = array(
'logoutRedirect' => $this->loginAction, '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) { foreach ($defaults as $key => $value) {
if (empty($this->{$key})) { if (empty($this->{$key})) {
@ -411,10 +411,10 @@ class AuthComponent extends Component {
$className = $class . 'Authorize'; $className = $class . 'Authorize';
App::uses($className, $plugin . 'Controller/Component/Auth'); App::uses($className, $plugin . 'Controller/Component/Auth');
if (!class_exists($className)) { 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')) { 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); $settings = array_merge($global, (array)$settings);
$this->_authorizeObjects[] = new $className($this->_Collection, $settings); $this->_authorizeObjects[] = new $className($this->_Collection, $settings);
@ -651,10 +651,10 @@ class AuthComponent extends Component {
$className = $class . 'Authenticate'; $className = $class . 'Authenticate';
App::uses($className, $plugin . 'Controller/Component/Auth'); App::uses($className, $plugin . 'Controller/Component/Auth');
if (!class_exists($className)) { 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')) { 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); $settings = array_merge($global, (array)$settings);
$this->_authenticateObjects[] = new $className($this->_Collection, $settings); $this->_authenticateObjects[] = new $className($this->_Collection, $settings);

2
lib/Cake/Controller/Component/EmailComponent.php Executable file → Normal file
View file

@ -725,7 +725,7 @@ class EmailComponent extends Component {
$formatted = array(); $formatted = array();
if ($this->_lineLength !== null) { 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; $this->lineLength = $this->_lineLength;
} }

View file

@ -127,7 +127,7 @@ class Scaffold {
$this->ScaffoldModel = $this->controller->{$this->modelClass}; $this->ScaffoldModel = $this->controller->{$this->modelClass};
$this->scaffoldTitle = Inflector::humanize($this->viewPath); $this->scaffoldTitle = Inflector::humanize($this->viewPath);
$this->scaffoldActions = $controller->scaffold; $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; $modelClass = $this->controller->modelClass;
$primaryKey = $this->ScaffoldModel->primaryKey; $primaryKey = $this->ScaffoldModel->primaryKey;
$displayField = $this->ScaffoldModel->displayField; $displayField = $this->ScaffoldModel->displayField;
@ -174,7 +174,7 @@ class Scaffold {
$this->ScaffoldModel->id = $request->params['pass'][0]; $this->ScaffoldModel->id = $request->params['pass'][0];
} }
if (!$this->ScaffoldModel->exists()) { 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->ScaffoldModel->recursive = 1;
$this->controller->request->data = $this->ScaffoldModel->read(); $this->controller->request->data = $this->ScaffoldModel->read();
@ -231,10 +231,10 @@ class Scaffold {
*/ */
protected function _scaffoldSave(CakeRequest $request, $action = 'edit') { protected function _scaffoldSave(CakeRequest $request, $action = 'edit') {
$formAction = 'edit'; $formAction = 'edit';
$success = __('updated'); $success = __d('cake', 'updated');
if ($action === 'add') { if ($action === 'add') {
$formAction = 'add'; $formAction = 'add';
$success = __('saved'); $success = __d('cake', 'saved');
} }
if ($this->controller->_beforeScaffold($action)) { if ($this->controller->_beforeScaffold($action)) {
@ -243,7 +243,7 @@ class Scaffold {
$this->ScaffoldModel->id = $request['pass'][0]; $this->ScaffoldModel->id = $request['pass'][0];
} }
if (!$this->ScaffoldModel->exists()) { 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->ScaffoldModel->save($request->data)) {
if ($this->controller->_afterScaffoldSave($action)) { if ($this->controller->_afterScaffoldSave($action)) {
$message = __( $message = __d('cake',
'The %1$s has been %2$s', 'The %1$s has been %2$s',
Inflector::humanize($this->modelKey), Inflector::humanize($this->modelKey),
$success $success
@ -265,7 +265,7 @@ class Scaffold {
} }
} else { } else {
if ($this->_validSession) { 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; $this->ScaffoldModel->id = $id;
if (!$this->ScaffoldModel->exists()) { 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()) { 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); return $this->_sendMessage($message);
} else { } else {
$message = __( $message = __d('cake',
'There was an error deleting the %1$s with id: %2$d', 'There was an error deleting the %1$s with id: %2$d',
Inflector::humanize($this->modelClass), Inflector::humanize($this->modelClass),
$id $id