Skip to content

Commit

Permalink
Putting __() in strings that missing internationalization.
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Story <mark@mark-story.com>
  • Loading branch information
jrbasso authored and markstory committed Jan 18, 2010
1 parent 0ac99ed commit 473e07a
Show file tree
Hide file tree
Showing 27 changed files with 61 additions and 78 deletions.
8 changes: 4 additions & 4 deletions cake/libs/cake_session.php
Expand Up @@ -245,7 +245,7 @@ function id($id = null) {
* @deprecated Use CakeSession::delete instead
*/
function del($name) {
trigger_error('CakeSession::del() is deprecated, use CakeSession::delete() instead.', E_USER_WARNING);
trigger_error(__('CakeSession::del() is deprecated, use CakeSession::delete() instead.', true), E_USER_WARNING);
return $this->delete($name);
}

Expand All @@ -259,12 +259,12 @@ function del($name) {
function delete($name) {
if ($this->check($name)) {
if (in_array($name, $this->watchKeys)) {
trigger_error('Deleting session key {' . $name . '}', E_USER_NOTICE);
trigger_error(sprintf(__('Deleting session key {%s}', true), $name), E_USER_NOTICE);
}
$this->__overwrite($_SESSION, Set::remove($_SESSION, $name));
return ($this->check($name) == false);
}
$this->__setError(2, "$name doesn't exist");
$this->__setError(2, sprintf(__("%s doesn't exist", true), $name));
return false;
}

Expand Down Expand Up @@ -423,7 +423,7 @@ function write($name, $value) {
return false;
}
if (in_array($name, $this->watchKeys)) {
trigger_error('Writing session key {' . $name . '}: ' . Debugger::exportVar($value), E_USER_NOTICE);
trigger_error(sprintf(__('Writing session key {%s}: %s', true), $name, Debugger::exportVar($value)), E_USER_NOTICE);
}
$this->__overwrite($_SESSION, Set::insert($_SESSION, $name, $value));
return (Set::classicExtract($_SESSION, $name) === $value);
Expand Down
5 changes: 2 additions & 3 deletions cake/libs/configure.php
Expand Up @@ -261,8 +261,7 @@ function load($fileName) {
}

if (!isset($config)) {
$error = __("Configure::load() - no variable \$config found in %s.php", true);
trigger_error(sprintf($error, $fileName), E_USER_WARNING);
trigger_error(sprintf(__('Configure::load() - no variable $config found in %s.php', true), $fileName), E_USER_WARNING);
return false;
}
return Configure::write($config);
Expand Down Expand Up @@ -398,7 +397,7 @@ function __loadBootstrap($boot) {
$cache = Cache::config('default');

if (empty($cache['settings'])) {
trigger_error('Cache not configured properly. Please check Cache::config(); in APP/config/core.php', E_USER_WARNING);
trigger_error(__('Cache not configured properly. Please check Cache::config(); in APP/config/core.php', true), E_USER_WARNING);
$cache = Cache::config('default', array('engine' => 'File'));
}
$path = $prefix = $duration = null;
Expand Down
4 changes: 2 additions & 2 deletions cake/libs/controller/components/acl.php
Expand Up @@ -248,12 +248,12 @@ function check($aro, $aco, $action = "*") {
$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(__("DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references:\nAro: ", true) . 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(__("DbAcl::check() - Failed ACO node lookup in permissions check. Node references:\nAro: ", true) . print_r($aro, true) . "\nAco: " . print_r($aco, true), E_USER_WARNING);
return false;
}

Expand Down
8 changes: 2 additions & 6 deletions cake/libs/controller/components/auth.php
Expand Up @@ -403,9 +403,7 @@ function startup(&$controller) {
if (isset($controller->Acl)) {
$this->Acl =& $controller->Acl;
} else {
$err = 'Could not find AclComponent. Please include Acl in ';
$err .= 'Controller::$components.';
trigger_error(__($err, true), E_USER_WARNING);
trigger_error(__('Could not find AclComponent. Please include Acl in Controller::$components.', true), E_USER_WARNING);
}
break;
case 'model':
Expand Down Expand Up @@ -514,10 +512,8 @@ function isAuthorized($type = null, $object = null, $user = null) {
case 'crud':
$this->mapActions();
if (!isset($this->actionMap[$this->params['action']])) {
$err = 'Auth::startup() - Attempted access of un-mapped action "%1$s" in';
$err .= ' controller "%2$s"';
trigger_error(
sprintf(__($err, true), $this->params['action'], $this->params['controller']),
sprintf(__('Auth::startup() - Attempted access of un-mapped action "%1$s" in controller "%2$s"', true), $this->params['action'], $this->params['controller']),
E_USER_WARNING
);
} else {
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/controller/components/cookie.php
Expand Up @@ -263,7 +263,7 @@ function read($key = null) {
* @deprecated use delete()
*/
function del($key) {
trigger_error('Deprecated method, use CookieComponent::delete instead', E_USER_WARNING);
trigger_error(__('Deprecated method, use CookieComponent::delete instead', true), E_USER_WARNING);
return $this->delete($key);
}

Expand Down
2 changes: 1 addition & 1 deletion cake/libs/controller/components/email.php
Expand Up @@ -611,7 +611,7 @@ function __wrap($message) {
$formatted = array();

if ($this->_lineLength !== null) {
trigger_error('_lineLength cannot be accessed please use lineLength', E_USER_WARNING);
trigger_error(__('_lineLength cannot be accessed please use lineLength', true), E_USER_WARNING);
$this->lineLength = $this->_lineLength;
}

Expand Down
2 changes: 1 addition & 1 deletion cake/libs/controller/components/request_handler.php
Expand Up @@ -425,7 +425,7 @@ function getReferer() {
* @deprecated use getReferer()
*/
function getReferrer() {
trigger_error('Deprecated method, use RequestHandlerComponent::getReferer instead', E_USER_WARNING);
trigger_error(__('Deprecated method, use RequestHandlerComponent::getReferer instead', true), E_USER_WARNING);
return $this->getReferer();
}

Expand Down
2 changes: 1 addition & 1 deletion cake/libs/controller/components/session.php
Expand Up @@ -141,7 +141,7 @@ function read($name = null) {
* @deprecated use delete
*/
function del($name) {
trigger_error('Deprecated method, use SessionComponent::delete instead', E_USER_WARNING);
trigger_error(__('Deprecated method, use SessionComponent::delete instead', true), E_USER_WARNING);
if ($this->__active === true) {
$this->__start();
return parent::del($name);
Expand Down
10 changes: 5 additions & 5 deletions cake/libs/folder.php
Expand Up @@ -723,7 +723,7 @@ function errors() {
* @access public
*/
function ls($sort = true, $exceptions = false) {
trigger_error('Deprecated method, use Folder::read instead', E_USER_WARNING);
trigger_error(__('Deprecated method, use Folder::read instead', true), E_USER_WARNING);
return $this->read($sort, $exceptions);
}

Expand All @@ -735,7 +735,7 @@ function ls($sort = true, $exceptions = false) {
* @access public
*/
function mkdir($pathname, $mode = 0755) {
trigger_error('Deprecated method, use Folder::create instead', E_USER_WARNING);
trigger_error(__('Deprecated method, use Folder::create instead', true), E_USER_WARNING);
return $this->create($pathname, $mode);
}

Expand All @@ -747,7 +747,7 @@ function mkdir($pathname, $mode = 0755) {
* @access public
*/
function cp($options) {
trigger_error('Deprecated method, use Folder::copy instead', E_USER_WARNING);
trigger_error(__('Deprecated method, use Folder::copy instead', true), E_USER_WARNING);
return $this->copy($options);
}

Expand All @@ -759,7 +759,7 @@ function cp($options) {
* @access public
*/
function mv($options) {
trigger_error('Deprecated method, use Folder::move instead', E_USER_WARNING);
trigger_error(__('Deprecated method, use Folder::move instead', true), E_USER_WARNING);
return $this->move($options);
}

Expand All @@ -771,7 +771,7 @@ function mv($options) {
* @access public
*/
function rm($path) {
trigger_error('Deprecated method, use Folder::delete instead', E_USER_WARNING);
trigger_error(__('Deprecated method, use Folder::delete instead', true), E_USER_WARNING);
return $this->delete($path);
}

Expand Down
2 changes: 1 addition & 1 deletion cake/libs/model/behaviors/acl.php
Expand Up @@ -59,7 +59,7 @@ function setup(&$model, $config = array()) {
$model->{$type} =& ClassRegistry::init($type);
}
if (!method_exists($model, 'parentNode')) {
trigger_error("Callback parentNode() not defined in {$model->alias}", E_USER_WARNING);
trigger_error(sprintf(__('Callback parentNode() not defined in %s', true), $model->alias), E_USER_WARNING);
}
}

Expand Down
2 changes: 1 addition & 1 deletion cake/libs/model/cake_schema.php
Expand Up @@ -545,7 +545,7 @@ function __columns(&$Obj) {
$value['key'] = 'primary';
}
if (!isset($db->columns[$value['type']])) {
trigger_error('Schema generation error: invalid column type ' . $value['type'] . ' does not exist in DBO', E_USER_NOTICE);
trigger_error(sprintf(__('Schema generation error: invalid column type %s does not exist in DBO', true), $value['type']), E_USER_NOTICE);
continue;
} else {
$defaultCol = $db->columns[$value['type']];
Expand Down
3 changes: 1 addition & 2 deletions cake/libs/model/connection_manager.php
Expand Up @@ -181,8 +181,7 @@ function loadDataSource($connName) {
$class = "{$conn['plugin']}.{$conn['classname']}";

if (!App::import('Datasource', $class, false)) {
$error = __('ConnectionManager::loadDataSource - Unable to import DataSource class %s', true);
trigger_error(sprintf($error, $class), E_USER_ERROR);
trigger_error(sprintf(__('ConnectionManager::loadDataSource - Unable to import DataSource class %s', true), $class), E_USER_ERROR);
return null;
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/model/datasources/dbo/dbo_mssql.php
Expand Up @@ -111,7 +111,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(__("PHP SQL Server interface is not installed, cannot continue. For troubleshooting information, see http://php.net/mssql/", true), E_USER_WARNING);
}
mssql_min_message_severity(15);
mssql_min_error_severity(2);
Expand Down
4 changes: 2 additions & 2 deletions cake/libs/model/datasources/dbo/dbo_oracle.php
Expand Up @@ -583,7 +583,7 @@ function truncate($table, $reset = 0) {
*/
function constraint($action, $table) {
if (empty($table)) {
trigger_error(__('Must specify table to operate on constraints'));
trigger_error(__('Must specify table to operate on constraints', true));
}

$table = strtoupper($table);
Expand Down Expand Up @@ -641,7 +641,7 @@ function constraint($action, $table) {
return $constraints;
break;
default:
trigger_error(__('DboOracle::constraint() accepts only enable, disable, or list'));
trigger_error(__('DboOracle::constraint() accepts only enable, disable, or list', true));
}
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions cake/libs/model/datasources/dbo/dbo_sqlite.php
Expand Up @@ -490,12 +490,12 @@ function buildColumn($column) {
extract($column);

if (empty($name) || empty($type)) {
trigger_error('Column name or type not defined in schema', E_USER_WARNING);
trigger_error(__('Column name or type not defined in schema', true), E_USER_WARNING);
return null;
}

if (!isset($this->columns[$type])) {
trigger_error("Column type {$type} does not exist", E_USER_WARNING);
trigger_error(sprintf(__('Column type %s does not exist', true), $type), E_USER_WARNING);
return null;
}

Expand Down
12 changes: 6 additions & 6 deletions cake/libs/model/datasources/dbo_source.php
Expand Up @@ -632,11 +632,11 @@ function showQuery($sql) {
if (Configure::read() > 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>' . __('SQL Error:', true) . "</b> {$this->error}</span>", E_USER_WARNING);
} else {
$out = ("<small>[Aff:{$this->affected} Num:{$this->numRows} Took:{$this->took}ms]</small>");
$out = ('<small>[' . sprintf(__('Aff:%s Num:%s Took:%sms', true), $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>' . __('Query:', true) . '</b> %s %s</p>', $sql, $out));
}
}

Expand Down Expand Up @@ -2386,7 +2386,7 @@ function hasAny(&$Model, $sql) {
*/
function length($real) {
if (!preg_match_all('/([\w\s]+)(?:\((\d+)(?:,(\d+))?\))?(\sunsigned)?(\szerofill)?/', $real, $result)) {
trigger_error(__('FIXME: Can\'t parse field: ' . $real, true), E_USER_WARNING);
trigger_error(__("FIXME: Can't parse field: " . $real, true), E_USER_WARNING);
$col = str_replace(array(')', 'unsigned'), '', $real);
$limit = null;

Expand Down Expand Up @@ -2585,12 +2585,12 @@ function buildColumn($column) {
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(__('Column name or type not defined in schema', true), E_USER_WARNING);
return null;
}

if (!isset($this->columns[$type])) {
trigger_error("Column type {$type} does not exist", E_USER_WARNING);
trigger_error(sprintf(__('Column type %s does not exist', true), $type), E_USER_WARNING);
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions cake/libs/model/db_acl.php
Expand Up @@ -142,7 +142,7 @@ function node($ref = null) {
}

if (empty($model)) {
trigger_error("Model class '$name' not found in AclNode::node() when trying to bind {$this->alias} object", E_USER_WARNING);
trigger_error(sprintf(__("Model class '%s' not found in AclNode::node() when trying to bind %s object", true), $type, $this->alias), E_USER_WARNING);
return null;
}

Expand Down Expand Up @@ -187,7 +187,7 @@ function node($ref = null) {
$result = $db->read($this, $queryData, -1);

if (!$result) {
trigger_error("AclNode::node() - Couldn't find {$type} node identified by \"" . print_r($ref, true) . "\"", E_USER_WARNING);
trigger_error(sprintf(__("AclNode::node() - Couldn't find %s node identified by \"%s\"", true), $type, print_r($ref, true)), E_USER_WARNING);
}
}
return $result;
Expand Down
15 changes: 5 additions & 10 deletions cake/libs/model/model.php
Expand Up @@ -530,7 +530,7 @@ function call__($method, $params) {
* @deprecated Use Model::bindModel() instead.
*/
function bind($model, $options = array(), $permanent = true) {
trigger_error('Deprecated method, use Model::bindModel instead', E_USER_WARNING);
trigger_error(__('Deprecated method, use Model::bindModel instead', true), E_USER_WARNING);
if (!is_array($model)) {
$model = array($model => $options);
}
Expand Down Expand Up @@ -1809,7 +1809,7 @@ function updateAll($fields, $conditions = true) {
* @link http://book.cakephp.org/view/691/remove
*/
function remove($id = null, $cascade = true) {
trigger_error('Deprecated method, use Model::delete instead', E_USER_WARNING);
trigger_error(__('Deprecated method, use Model::delete instead', true), E_USER_WARNING);
return $this->delete($id, $cascade);
}

Expand Down Expand Up @@ -1862,7 +1862,7 @@ function delete($id = null, $cascade = true) {
* @deprecated
*/
function del($id = null, $cascade = true) {
trigger_error('Deprecated method, use Model::delete instead', E_USER_WARNING);
trigger_error(__('Deprecated method, use Model::delete instead', true), E_USER_WARNING);
return $this->delete($id, $cascade);
}

Expand Down Expand Up @@ -2615,12 +2615,7 @@ function invalidFields($options = array()) {
} elseif (!is_array($validator['rule'])) {
$valid = preg_match($rule, $data[$fieldName]);
} elseif (Configure::read('debug') > 0) {
$error = sprintf(
__('Could not find validation handler %s for %s', true),
$rule,
$fieldName
);
trigger_error($error, E_USER_WARNING);
trigger_error(sprintf(__('Could not find validation handler %s for %s', true), $rule, $fieldName), E_USER_WARNING);
}

if (!$valid || (is_string($valid) && strlen($valid) > 0)) {
Expand Down Expand Up @@ -2727,7 +2722,7 @@ function isForeignKey($field) {
* @deprecated
*/
function getDisplayField() {
trigger_error('Deprecated method, use Model::$displayField instead', E_USER_WARNING);
trigger_error(__('Deprecated method, use Model::$displayField instead', true), E_USER_WARNING);
return $this->displayField;
}

Expand Down
2 changes: 1 addition & 1 deletion cake/libs/model/model_behavior.php
Expand Up @@ -441,7 +441,7 @@ function dispatchMethod(&$model, $method, $params = array(), $strict = false) {
$call = null;

if ($strict && !$found) {
trigger_error("BehaviorCollection::dispatchMethod() - Method {$method} not found in any attached behavior", E_USER_WARNING);
trigger_error(sprintf(__("BehaviorCollection::dispatchMethod() - Method %s not found in any attached behavior", true), $method), E_USER_WARNING);
return null;
} elseif ($found) {
$methods = array_combine($methods, array_values($this->__methods));
Expand Down
2 changes: 1 addition & 1 deletion cake/libs/set.php
Expand Up @@ -828,7 +828,7 @@ function diff($val1, $val2 = null) {
* @deprecated
*/
function isEqual($val1, $val2 = null) {
trigger_error('Set::isEqual() is deprecated. Please use standard comparison operators instead.', E_USER_WARNING);
trigger_error(__('Set::isEqual() is deprecated. Please use standard comparison operators instead.', true), E_USER_WARNING);
return ($val1 == $val2);
}

Expand Down
6 changes: 1 addition & 5 deletions cake/libs/view/helpers/paginator.php
Expand Up @@ -92,11 +92,7 @@ function __construct($config = array()) {
App::import('Helper', $ajaxProvider);
$classname = $ajaxProvider . 'Helper';
if (!is_callable(array($classname, 'link'))) {
$message = sprintf(
__('%s does not implement a link() method, it is incompatible with PaginatorHelper', true),
$classname
);
trigger_error($message, E_USER_WARNING);
trigger_error(sprintf(__('%s does not implement a link() method, it is incompatible with PaginatorHelper', true), $classname), E_USER_WARNING);
}
}

Expand Down
2 changes: 1 addition & 1 deletion cake/libs/view/helpers/text.php
Expand Up @@ -273,7 +273,7 @@ function truncate($text, $length = 100, $options = array()) {
* @access public
*/
function trim() {
trigger_error('TextHelper::trim() is deprecated. Use TextHelper::truncate() instead', E_USER_WARNING);
trigger_error(__('TextHelper::trim() is deprecated. Use TextHelper::truncate() instead', true), E_USER_WARNING);
$args = func_get_args();
return call_user_func_array(array(&$this, 'truncate'), $args);
}
Expand Down

0 comments on commit 473e07a

Please sign in to comment.