Browse Source

translation changes in the model dir

AD7six 15 years ago
parent
commit
38180e8951

+ 2 - 2
lib/Cake/Model/AclNode.php

@@ -133,7 +133,7 @@ class AclNode extends AppModel {
 			$model = ClassRegistry::init(array('class' => $name, 'alias' => $name));
 
 			if (empty($model)) {
-				trigger_error(__("Model class '%s' not found in AclNode::node() when trying to bind %s object", $type, $this->alias), E_USER_WARNING);
+				trigger_error(__d('cake', "Model class '%s' not found in AclNode::node() when trying to bind %s object", $type, $this->alias), E_USER_WARNING);
 				return null;
 			}
 
@@ -178,7 +178,7 @@ class AclNode extends AppModel {
 			$result = $db->read($this, $queryData, -1);
 
 			if (!$result) {
-				trigger_error(__("AclNode::node() - Couldn't find %s node identified by \"%s\"", $type, print_r($ref, true)), E_USER_WARNING);
+				trigger_error(__d('cake', "AclNode::node() - Couldn't find %s node identified by \"%s\"", $type, print_r($ref, true)), E_USER_WARNING);
 			}
 		}
 		return $result;

+ 1 - 1
lib/Cake/Model/Behavior/AclBehavior.php

@@ -54,7 +54,7 @@ class AclBehavior extends ModelBehavior {
 		}
 		$model->{$type} = ClassRegistry::init($type);
 		if (!method_exists($model, 'parentNode')) {
-			trigger_error(__('Callback parentNode() not defined in %s', $model->alias), E_USER_WARNING);
+			trigger_error(__d('cake', 'Callback parentNode() not defined in %s', $model->alias), E_USER_WARNING);
 		}
 	}
 

+ 1 - 1
lib/Cake/Model/Behavior/ContainableBehavior.php

@@ -359,7 +359,7 @@ class ContainableBehavior extends ModelBehavior {
 
 			if (!isset($Model->{$name}) || !is_object($Model->{$name})) {
 				if ($throwErrors) {
-					trigger_error(__('Model "%s" is not associated with model "%s"', $Model->alias, $name), E_USER_WARNING);
+					trigger_error(__d('cake', 'Model "%s" is not associated with model "%s"', $Model->alias, $name), E_USER_WARNING);
 				}
 				continue;
 			}

+ 2 - 2
lib/Cake/Model/Behavior/TranslateBehavior.php

@@ -55,7 +55,7 @@ class TranslateBehavior extends ModelBehavior {
 		$db = ConnectionManager::getDataSource($model->useDbConfig);
 		if (!$db->connected) {
 			trigger_error(
-				__('Datasource %s for TranslateBehavior of model %s is not connected', $model->useDbConfig, $model->alias),
+				__d('cake', 'Datasource %s for TranslateBehavior of model %s is not connected', $model->useDbConfig, $model->alias),
 				E_USER_ERROR
 			);
 			return false;
@@ -426,7 +426,7 @@ class TranslateBehavior extends ModelBehavior {
 				foreach (array('hasOne', 'hasMany', 'belongsTo', 'hasAndBelongsToMany') as $type) {
 					if (isset($model->{$type}[$association]) || isset($model->__backAssociation[$type][$association])) {
 						trigger_error(
-							__('Association %s is already binded to model %s', $association, $model->alias),
+							__d('cake', 'Association %s is already binded to model %s', $association, $model->alias),
 							E_USER_ERROR
 						);
 						return false;

+ 1 - 1
lib/Cake/Model/BehaviorCollection.php

@@ -219,7 +219,7 @@ class BehaviorCollection extends ObjectCollection {
 		$method = $this->hasMethod($method, true);
 		
 		if ($strict && empty($method)) {
-			trigger_error(__("BehaviorCollection::dispatchMethod() - Method %s not found in any attached behavior", $method), E_USER_WARNING);
+			trigger_error(__d('cake', "BehaviorCollection::dispatchMethod() - Method %s not found in any attached behavior", $method), E_USER_WARNING);
 			return null;
 		}
 		if (empty($method)) {

+ 1 - 1
lib/Cake/Model/CakeSchema.php

@@ -592,7 +592,7 @@ class CakeSchema extends Object {
 				$value['key'] = 'primary';
 			}
 			if (!isset($db->columns[$value['type']])) {
-				trigger_error(__('Schema generation error: invalid column type %s does not exist in DBO', $value['type']), E_USER_NOTICE);
+				trigger_error(__d('cake', 'Schema generation error: invalid column type %s does not exist in DBO', $value['type']), E_USER_NOTICE);
 				continue;
 			} else {
 				$defaultCol = $db->columns[$value['type']];

+ 4 - 4
lib/Cake/Model/Datasource/CakeSession.php

@@ -254,7 +254,7 @@ class CakeSession {
 			self::__overwrite($_SESSION, Set::remove($_SESSION, $name));
 			return (self::check($name) == false);
 		}
-		self::__setError(2, __("%s doesn't exist", $name));
+		self::__setError(2, __d('cake', "%s doesn't exist", $name));
 		return false;
 	}
 
@@ -480,7 +480,7 @@ class CakeSession {
 				foreach ($sessionConfig['ini'] as $setting => $value) {
 					if (ini_set($setting, $value) === false) {
 						throw new CakeSessionException(sprintf(
-							__('Unable to configure the session, setting %s failed.'),
+							__d('cake', 'Unable to configure the session, setting %s failed.'),
 							$setting
 						));
 					}
@@ -514,13 +514,13 @@ class CakeSession {
 		list($plugin, $class) = pluginSplit($handler, true);
 		App::uses($class, $plugin . 'Model/Datasource/Session');
 		if (!class_exists($class)) {
-			throw new CakeSessionException(__('Could not load %s to handle the session.', $class));
+			throw new CakeSessionException(__d('cake', 'Could not load %s to handle the session.', $class));
 		}
 		$handler = new $class();
 		if ($handler instanceof CakeSessionHandlerInterface) {
 			return $handler;
 		}
-		throw new CakeSessionException(__('Chosen SessionHandler does not implement CakeSessionHandlerInterface it cannot be used with an engine key.'));
+		throw new CakeSessionException(__d('cake', 'Chosen SessionHandler does not implement CakeSessionHandlerInterface it cannot be used with an engine key.'));
 	}
 
 /**

+ 1 - 1
lib/Cake/Model/Datasource/Database/Mssql.php

@@ -116,7 +116,7 @@ class DboMssql extends DboSource {
 	function __construct($config, $autoConnect = true) {
 		if ($autoConnect) {
 			if (!function_exists('mssql_min_message_severity')) {
-				trigger_error(__("PHP SQL Server interface is not installed, cannot continue. For troubleshooting information, see http://php.net/mssql/"), E_USER_WARNING);
+				trigger_error(__d('cake', "PHP SQL Server interface is not installed, cannot continue. For troubleshooting information, see http://php.net/mssql/"), E_USER_WARNING);
 			}
 			mssql_min_message_severity(15);
 			mssql_min_error_severity(2);

+ 1 - 1
lib/Cake/Model/Datasource/Database/Mysql.php

@@ -298,7 +298,7 @@ class Mysql extends DboSource {
 		$fields = false;
 		$cols = $this->_execute('SHOW FULL COLUMNS FROM ' . $this->fullTableName($model));
 		if (!$cols) {
-			throw new CakeException(__('Could not describe table for %s', $model->name));
+			throw new CakeException(__d('cake', 'Could not describe table for %s', $model->name));
 		}
 
 		foreach ($cols as $column) {

+ 3 - 3
lib/Cake/Model/Datasource/Database/Oracle.php

@@ -571,7 +571,7 @@ class DboOracle extends DboSource {
  */
 	function constraint($action, $table) {
 		if (empty($table)) {
-			trigger_error(__('Must specify table to operate on constraints'));
+			trigger_error(__d('cake', 'Must specify table to operate on constraints'));
 		}
 
 		$table = strtoupper($table);
@@ -629,7 +629,7 @@ class DboOracle extends DboSource {
 					return $constraints;
 					break;
 				default:
-					trigger_error(__('DboOracle::constraint() accepts only enable, disable, or list'));
+					trigger_error(__d('cake', 'DboOracle::constraint() accepts only enable, disable, or list'));
 			}
 		}
 		return true;
@@ -976,7 +976,7 @@ class DboOracle extends DboSource {
 		if ($query = $this->generateAssociationQuery($model, $linkModel, $type, $association, $assocData, $queryData, $external, $resultSet)) {
 			if (!isset($resultSet) || !is_array($resultSet)) {
 				if (Configure::read('debug') > 0) {
-					echo '<div style = "font: Verdana bold 12px; color: #FF0000">' . __('SQL Error in model %s:', $model->alias) . ' ';
+					echo '<div style = "font: Verdana bold 12px; color: #FF0000">' . __d('cake', 'SQL Error in model %s:', $model->alias) . ' ';
 					if (isset($this->error) && $this->error != null) {
 						echo $this->error;
 					}

+ 1 - 1
lib/Cake/Model/Datasource/Database/Sqlite.php

@@ -392,7 +392,7 @@ class Sqlite extends DboSource {
 		}
 
 		if (!isset($this->columns[$type])) {
-			trigger_error(__('Column type %s does not exist', $type), E_USER_WARNING);
+			trigger_error(__d('cake', 'Column type %s does not exist', $type), E_USER_WARNING);
 			return null;
 		}
 

+ 8 - 8
lib/Cake/Model/Datasource/DboSource.php

@@ -941,11 +941,11 @@ class DboSource extends DataSource {
 		if (Configure::read('debug') > 0) {
 			$out = null;
 			if ($error) {
-				trigger_error('<span style="color:Red;text-align:left"><b>' . __('SQL Error:') . "</b> {$this->error}</span>", E_USER_WARNING);
+				trigger_error('<span style="color:Red;text-align:left"><b>' . __d('cake', 'SQL Error:') . "</b> {$this->error}</span>", E_USER_WARNING);
 			} else {
-				$out = ('<small>[' . __('Aff:%s Num:%s Took:%sms', $this->affected, $this->numRows, $this->took) . ']</small>');
+				$out = ('<small>[' . __d('cake', 'Aff:%s Num:%s Took:%sms', $this->affected, $this->numRows, $this->took) . ']</small>');
 			}
-			pr(sprintf('<p style="text-align:left"><b>' . __('Query:') . '</b> %s %s</p>', $sql, $out));
+			pr(sprintf('<p style="text-align:left"><b>' . __d('cake', 'Query:') . '</b> %s %s</p>', $sql, $out));
 		}
 	}
 
@@ -1169,7 +1169,7 @@ class DboSource extends DataSource {
 		if ($query = $this->generateAssociationQuery($model, $linkModel, $type, $association, $assocData, $queryData, $external, $resultSet)) {
 			if (!is_array($resultSet)) {
 				if (Configure::read('debug') > 0) {
-					echo '<div style = "font: Verdana bold 12px; color: #FF0000">' . __('SQL Error in model %s:', $model->alias) . ' ';
+					echo '<div style = "font: Verdana bold 12px; color: #FF0000">' . __d('cake', 'SQL Error in model %s:', $model->alias) . ' ';
 					if (isset($this->error) && $this->error != null) {
 						echo $this->error;
 					}
@@ -2725,7 +2725,7 @@ class DboSource extends DataSource {
  */
 	public function length($real) {
 		if (!preg_match_all('/([\w\s]+)(?:\((\d+)(?:,(\d+))?\))?(\sunsigned)?(\szerofill)?/', $real, $result)) {
-			trigger_error(__("FIXME: Can't parse field: " . $real), E_USER_WARNING);
+			trigger_error(__d('cake', "FIXME: Can't parse field: " . $real), E_USER_WARNING);
 			$col = str_replace(array(')', 'unsigned'), '', $real);
 			$limit = null;
 
@@ -2833,7 +2833,7 @@ class DboSource extends DataSource {
  */
 	public function createSchema($schema, $tableName = null) {
 		if (!is_a($schema, 'CakeSchema')) {
-			trigger_error(__('Invalid schema object'), E_USER_WARNING);
+			trigger_error(__d('cake', 'Invalid schema object'), E_USER_WARNING);
 			return null;
 		}
 		$out = '';
@@ -2915,12 +2915,12 @@ class DboSource extends DataSource {
 		extract(array_merge(array('null' => true), $column));
 
 		if (empty($name) || empty($type)) {
-			trigger_error(__('Column name or type not defined in schema'), E_USER_WARNING);
+			trigger_error(__d('cake', 'Column name or type not defined in schema'), E_USER_WARNING);
 			return null;
 		}
 
 		if (!isset($this->columns[$type])) {
-			trigger_error(__('Column type %s does not exist', $type), E_USER_WARNING);
+			trigger_error(__d('cake', 'Column type %s does not exist', $type), E_USER_WARNING);
 			return null;
 		}
 

+ 4 - 4
lib/Cake/Model/Model.php

@@ -1005,7 +1005,7 @@ class Model extends Object {
 	public function getColumnTypes() {
 		$columns = $this->schema();
 		if (empty($columns)) {
-			trigger_error(__('(Model::getColumnTypes) Unable to build model field data. If you are using a model without a database table, try implementing schema()'), E_USER_WARNING);
+			trigger_error(__d('cake', '(Model::getColumnTypes) Unable to build model field data. If you are using a model without a database table, try implementing schema()'), E_USER_WARNING);
 		}
 		$cols = array();
 		foreach ($columns as $field => $values) {
@@ -2602,7 +2602,7 @@ class Model extends Object {
 				if (isset($validator['message'])) {
 					$message = $validator['message'];
 				} else {
-					$message = __('This field cannot be left blank');
+					$message = __d('cake', 'This field cannot be left blank');
 				}
 
 				if (
@@ -2650,7 +2650,7 @@ class Model extends Object {
 						} elseif (!is_array($validator['rule'])) {
 							$valid = preg_match($rule, $data[$fieldName]);
 						} elseif (Configure::read('debug') > 0) {
-							trigger_error(__('Could not find validation handler %s for %s', $rule, $fieldName), E_USER_WARNING);
+							trigger_error(__d('cake', 'Could not find validation handler %s for %s', $rule, $fieldName), E_USER_WARNING);
 						}
 
 						if (!$valid || (is_string($valid) && strlen($valid) > 0)) {
@@ -2957,7 +2957,7 @@ class Model extends Object {
 			return array($with, array_unique(array_merge($assoc[$with], $keys)));
 		}
 		trigger_error(
-			__('Invalid join model settings in %s', $model->alias),
+			__d('cake', 'Invalid join model settings in %s', $model->alias),
 			E_USER_WARNING
 		);
 	}