Skip to content

Commit

Permalink
translation changes in the view folder
Browse files Browse the repository at this point in the history
  • Loading branch information
AD7six committed Mar 12, 2011
1 parent e2dfafd commit 28eae99
Show file tree
Hide file tree
Showing 33 changed files with 261 additions and 261 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/View/Helper.php
Expand Up @@ -124,7 +124,7 @@ public function __construct(View $View, $settings = array()) {
* @param array $params Array of params for the method.
*/
public function __call($method, $params) {
trigger_error(__('Method %1$s::%2$s does not exist', get_class($this), $method), E_USER_WARNING);
trigger_error(__d('cake', 'Method %1$s::%2$s does not exist', get_class($this), $method), E_USER_WARNING);
}

/**
Expand Down
42 changes: 21 additions & 21 deletions lib/Cake/View/Helper/FormHelper.php
Expand Up @@ -367,7 +367,7 @@ public function end($options = null) {
$submitOptions = $options;

if (!$submit) {
$submit = __('Submit');
$submit = __d('cake', 'Submit');
}
}
$out .= $this->submit($submit, $submitOptions);
Expand Down Expand Up @@ -509,7 +509,7 @@ public function error($field, $text = null, $options = array()) {
if ($text != null) {
$error = $text;
} elseif (is_numeric($error)) {
$error = __('Error in field %s', Inflector::humanize($this->field()));
$error = __d('cake', 'Error in field %s', Inflector::humanize($this->field()));
}
if ($options['escape']) {
$error = h($error);
Expand Down Expand Up @@ -552,7 +552,7 @@ function label($fieldName = null, $text = null, $options = array()) {
if (substr($text, -3) == '_id') {
$text = substr($text, 0, strlen($text) - 3);
}
$text = __(Inflector::humanize(Inflector::underscore($text)));
$text = __d('cake', Inflector::humanize(Inflector::underscore($text)));
}

if (is_string($options)) {
Expand Down Expand Up @@ -621,16 +621,16 @@ public function inputs($fields = null, $blacklist = null) {
}

if ($legend === true) {
$actionName = __('New %s');
$actionName = __d('cake', 'New %s');
$isEdit = (
strpos($this->request->params['action'], 'update') !== false ||
strpos($this->request->params['action'], 'edit') !== false
);
if ($isEdit) {
$actionName = __('Edit %s');
$actionName = __d('cake', 'Edit %s');
}
$modelName = Inflector::humanize(Inflector::underscore($model));
$legend = sprintf($actionName, __($modelName));
$legend = sprintf($actionName, __d('cake', $modelName));
}

$out = null;
Expand Down Expand Up @@ -1046,7 +1046,7 @@ public function radio($fieldName, $options = array(), $attributes = array()) {
$legend = $attributes['legend'];
unset($attributes['legend']);
} elseif (count($options) > 1) {
$legend = __(Inflector::humanize($this->field()));
$legend = __d('cake', Inflector::humanize($this->field()));
}
$label = true;

Expand Down Expand Up @@ -1131,7 +1131,7 @@ public function radio($fieldName, $options = array(), $attributes = array()) {
public function __call($method, $params) {
$options = array();
if (empty($params)) {
throw new CakeException(__('Missing field name for FormHelper::%s', $method));
throw new CakeException(__d('cake', 'Missing field name for FormHelper::%s', $method));
}
if (isset($params[1])) {
$options = $params[1];
Expand Down Expand Up @@ -1347,7 +1347,7 @@ public function postLink($title, $url = null, $options = array(), $confirmMessag
*/
public function submit($caption = null, $options = array()) {
if (!$caption) {
$caption = __('Submit');
$caption = __d('cake', 'Submit');
}
$out = null;
$div = true;
Expand Down Expand Up @@ -2139,18 +2139,18 @@ function __generateOptions($name, $options = array()) {
break;
case 'month':
if ($options['monthNames'] === true) {
$data['01'] = __('January');
$data['02'] = __('February');
$data['03'] = __('March');
$data['04'] = __('April');
$data['05'] = __('May');
$data['06'] = __('June');
$data['07'] = __('July');
$data['08'] = __('August');
$data['09'] = __('September');
$data['10'] = __('October');
$data['11'] = __('November');
$data['12'] = __('December');
$data['01'] = __d('cake', 'January');
$data['02'] = __d('cake', 'February');
$data['03'] = __d('cake', 'March');
$data['04'] = __d('cake', 'April');
$data['05'] = __d('cake', 'May');
$data['06'] = __d('cake', 'June');
$data['07'] = __d('cake', 'July');
$data['08'] = __d('cake', 'August');
$data['09'] = __d('cake', 'September');
$data['10'] = __d('cake', 'October');
$data['11'] = __d('cake', 'November');
$data['12'] = __d('cake', 'December');
} else if (is_array($options['monthNames'])) {
$data = $options['monthNames'];
} else {
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/View/Helper/HtmlHelper.php
Expand Up @@ -940,13 +940,13 @@ public function loadConfig($configFile, $path = CONFIGS) {
$reader = $configFile[1];
}
} else {
throw new ConfigureException(__('Cannot load the configuration file. Wrong "configFile" configuration.'));
throw new ConfigureException(__d('cake', 'Cannot load the configuration file. Wrong "configFile" configuration.'));
}

$readerClass = Inflector::camelize($reader) . 'Reader';
App::uses($readerClass, 'Configure');
if (!class_exists($readerClass)) {
throw new ConfigureException(__('Cannot load the configuration file. Unknown reader.'));
throw new ConfigureException(__d('cake', 'Cannot load the configuration file. Unknown reader.'));
}

$readerObj = new $readerClass($path);
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/View/Helper/JsHelper.php
Expand Up @@ -153,7 +153,7 @@ public function __call($method, $params) {
if (method_exists($this, $method . '_')) {
return call_user_func(array(&$this, $method . '_'), $params);
}
trigger_error(__('JsHelper:: Missing Method %s is undefined', $method), E_USER_WARNING);
trigger_error(__d('cake', 'JsHelper:: Missing Method %s is undefined', $method), E_USER_WARNING);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/View/Helper/MootoolsEngineHelper.php
Expand Up @@ -307,7 +307,7 @@ function drag($options = array()) {
function drop($options = array()) {
if (empty($options['drag'])) {
trigger_error(
__('MootoolsEngine::drop() requires a "drag" option to properly function'), E_USER_WARNING
__d('cake', 'MootoolsEngine::drop() requires a "drag" option to properly function'), E_USER_WARNING
);
return false;
}
Expand Down
10 changes: 5 additions & 5 deletions lib/Cake/View/Helper/NumberHelper.php
Expand Up @@ -88,15 +88,15 @@ public function precision($number, $precision = 3) {
public function toReadableSize($size) {
switch (true) {
case $size < 1024:
return __n('%d Byte', '%d Bytes', $size, $size);
return __dn('cake', '%d Byte', '%d Bytes', $size, $size);
case round($size / 1024) < 1024:
return __('%d KB', $this->precision($size / 1024, 0));
return __d('cake', '%d KB', $this->precision($size / 1024, 0));
case round($size / 1024 / 1024, 2) < 1024:
return __('%.2f MB', $this->precision($size / 1024 / 1024, 2));
return __d('cake', '%.2f MB', $this->precision($size / 1024 / 1024, 2));
case round($size / 1024 / 1024 / 1024, 2) < 1024:
return __('%.2f GB', $this->precision($size / 1024 / 1024 / 1024, 2));
return __d('cake', '%.2f GB', $this->precision($size / 1024 / 1024 / 1024, 2));
default:
return __('%.2f TB', $this->precision($size / 1024 / 1024 / 1024 / 1024, 2));
return __d('cake', '%.2f TB', $this->precision($size / 1024 / 1024 / 1024 / 1024, 2));
}
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/View/Helper/PaginatorHelper.php 100755 → 100644
Expand Up @@ -102,7 +102,7 @@ function __construct(View $View, $settings = array()) {
$classname = $ajaxProvider . 'Helper';
if (!method_exists($classname, 'link')) {
throw new CakeException(sprintf(
__('%s does not implement a link() method, it is incompatible with PaginatorHelper'), $classname
__d('cake', '%s does not implement a link() method, it is incompatible with PaginatorHelper'), $classname
));
}
parent::__construct($View, $settings);
Expand Down Expand Up @@ -306,7 +306,7 @@ public function sort($key, $title = null, $options = array()) {

if (empty($title)) {
$title = $key;
$title = __(Inflector::humanize(preg_replace('/_id$/', '', $title)));
$title = __d('cake', Inflector::humanize(preg_replace('/_id$/', '', $title)));
}
$dir = isset($options['direction']) ? $options['direction'] : 'asc';
unset($options['direction']);
Expand Down Expand Up @@ -553,7 +553,7 @@ public function counter($options = array()) {
array(
'model' => $this->defaultModel(),
'format' => 'pages',
'separator' => __(' of ')
'separator' => __d('cake', ' of ')
),
$options);

Expand Down
58 changes: 29 additions & 29 deletions lib/Cake/View/Helper/TimeHelper.php
Expand Up @@ -82,19 +82,19 @@ public function convertSpecifiers($format, $time = null) {
private function __translateSpecifier($specifier) {
switch ($specifier[1]) {
case 'a':
$abday = __c('abday', 5);
$abday = __cn('cake', 'abday', 5);
if (is_array($abday)) {
return $abday[date('w', $this->__time)];
}
break;
case 'A':
$day = __c('day', 5);
$day = __cn('cake', 'day', 5);
if (is_array($day)) {
return $day[date('w', $this->__time)];
}
break;
case 'c':
$format = __c('d_t_fmt', 5);
$format = __cn('cake', 'd_t_fmt', 5);
if ($format != 'd_t_fmt') {
return $this->convertSpecifiers($format, $this->__time);
}
Expand All @@ -116,13 +116,13 @@ private function __translateSpecifier($specifier) {
return date('jS', $this->__time);
case 'b':
case 'h':
$months = __c('abmon', 5);
$months = __cn('cake', 'abmon', 5);
if (is_array($months)) {
return $months[date('n', $this->__time) -1];
}
return '%b';
case 'B':
$months = __c('mon', 5);
$months = __cn('cake', 'mon', 5);
if (is_array($months)) {
return $months[date('n', $this->__time) -1];
}
Expand All @@ -133,14 +133,14 @@ private function __translateSpecifier($specifier) {
case 'P':
$default = array('am' => 0, 'pm' => 1);
$meridiem = $default[date('a',$this->__time)];
$format = __c('am_pm', 5);
$format = __cn('cake', 'am_pm', 5);
if (is_array($format)) {
$meridiem = $format[$meridiem];
return ($specifier[1] == 'P') ? strtolower($meridiem) : strtoupper($meridiem);
}
break;
case 'r':
$complete = __c('t_fmt_ampm', 5);
$complete = __cn('cake', 't_fmt_ampm', 5);
if ($complete != 't_fmt_ampm') {
return str_replace('%p',$this->__translateSpecifier(array('%p', 'p')),$complete);
}
Expand All @@ -154,13 +154,13 @@ private function __translateSpecifier($specifier) {
case 'u':
return ($weekDay = date('w', $this->__time)) ? $weekDay : 7;
case 'x':
$format = __c('d_fmt', 5);
$format = __cn('cake', 'd_fmt', 5);
if ($format != 'd_fmt') {
return $this->convertSpecifiers($format, $this->__time);
}
break;
case 'X':
$format = __c('t_fmt', 5);
$format = __cn('cake', 't_fmt', 5);
if ($format != 't_fmt') {
return $this->convertSpecifiers($format, $this->__time);
}
Expand Down Expand Up @@ -265,9 +265,9 @@ public function niceShort($dateString = null, $userOffset = null) {
$y = $this->isThisYear($date) ? '' : ' %Y';

if ($this->isToday($dateString, $userOffset)) {
$ret = __('Today, %s', strftime("%H:%M", $date));
$ret = __d('cake', 'Today, %s', strftime("%H:%M", $date));
} elseif ($this->wasYesterday($dateString, $userOffset)) {
$ret = __('Yesterday, %s', strftime("%H:%M", $date));
$ret = __d('cake', 'Yesterday, %s', strftime("%H:%M", $date));
} else {
$format = $this->convertSpecifiers("%b %eS{$y}, %H:%M", $date);
$ret = strftime($format, $date);
Expand Down Expand Up @@ -614,41 +614,41 @@ public function timeAgoInWords($dateTime, $options = array()) {
$diff = $futureTime - $pastTime;

if ($diff > abs($now - $this->fromString($end))) {
$relativeDate = __('on %s', date($format, $inSeconds));
$relativeDate = __d('cake', 'on %s', date($format, $inSeconds));
} else {
if ($years > 0) {
// years and months and days
$relativeDate .= ($relativeDate ? ', ' : '') . $years . ' ' . __n('year', 'years', $years);
$relativeDate .= $months > 0 ? ($relativeDate ? ', ' : '') . $months . ' ' . __n('month', 'months', $months) : '';
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks) : '';
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' ' . __n('day', 'days', $days) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . $years . ' ' . __dn('cake', 'year', 'years', $years);
$relativeDate .= $months > 0 ? ($relativeDate ? ', ' : '') . $months . ' ' . __dn('cake', 'month', 'months', $months) : '';
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', ' : '') . $weeks . ' ' . __dn('cake', 'week', 'weeks', $weeks) : '';
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' ' . __dn('cake', 'day', 'days', $days) : '';
} elseif (abs($months) > 0) {
// months, weeks and days
$relativeDate .= ($relativeDate ? ', ' : '') . $months . ' ' . __n('month', 'months', $months);
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks) : '';
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' ' . __n('day', 'days', $days) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . $months . ' ' . __dn('cake', 'month', 'months', $months);
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', ' : '') . $weeks . ' ' . __dn('cake', 'week', 'weeks', $weeks) : '';
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' ' . __dn('cake', 'day', 'days', $days) : '';
} elseif (abs($weeks) > 0) {
// weeks and days
$relativeDate .= ($relativeDate ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks);
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' ' . __n('day', 'days', $days) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . $weeks . ' ' . __dn('cake', 'week', 'weeks', $weeks);
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' ' . __dn('cake', 'day', 'days', $days) : '';
} elseif (abs($days) > 0) {
// days and hours
$relativeDate .= ($relativeDate ? ', ' : '') . $days . ' ' . __n('day', 'days', $days);
$relativeDate .= $hours > 0 ? ($relativeDate ? ', ' : '') . $hours . ' ' . __n('hour', 'hours', $hours) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . $days . ' ' . __dn('cake', 'day', 'days', $days);
$relativeDate .= $hours > 0 ? ($relativeDate ? ', ' : '') . $hours . ' ' . __dn('cake', 'hour', 'hours', $hours) : '';
} elseif (abs($hours) > 0) {
// hours and minutes
$relativeDate .= ($relativeDate ? ', ' : '') . $hours . ' ' . __n('hour', 'hours', $hours);
$relativeDate .= $minutes > 0 ? ($relativeDate ? ', ' : '') . $minutes . ' ' . __n('minute', 'minutes', $minutes) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . $hours . ' ' . __dn('cake', 'hour', 'hours', $hours);
$relativeDate .= $minutes > 0 ? ($relativeDate ? ', ' : '') . $minutes . ' ' . __dn('cake', 'minute', 'minutes', $minutes) : '';
} elseif (abs($minutes) > 0) {
// minutes only
$relativeDate .= ($relativeDate ? ', ' : '') . $minutes . ' ' . __n('minute', 'minutes', $minutes);
$relativeDate .= ($relativeDate ? ', ' : '') . $minutes . ' ' . __dn('cake', 'minute', 'minutes', $minutes);
} else {
// seconds only
$relativeDate .= ($relativeDate ? ', ' : '') . $seconds . ' ' . __n('second', 'seconds', $seconds);
$relativeDate .= ($relativeDate ? ', ' : '') . $seconds . ' ' . __dn('cake', 'second', 'seconds', $seconds);
}

if (!$backwards) {
$relativeDate = __('%s ago', $relativeDate);
$relativeDate = __d('cake', '%s ago', $relativeDate);
}
}
return $relativeDate;
Expand All @@ -668,7 +668,7 @@ public function timeAgoInWords($dateTime, $options = array()) {
public function wasWithinLast($timeInterval, $dateString, $userOffset = null) {
$tmp = str_replace(' ', '', $timeInterval);
if (is_numeric($tmp)) {
$timeInterval = $tmp . ' ' . __('days');
$timeInterval = $tmp . ' ' . __d('cake', 'days');
}

$date = $this->fromString($dateString, $userOffset);
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/View/View.php
Expand Up @@ -396,7 +396,7 @@ public function render($view = null, $layout = null) {
$layout = $this->layout;
}
if ($this->output === false) {
throw new CakeException(__("Error in view %s, got no content.", $viewFileName));
throw new CakeException(__d('cake', "Error in view %s, got no content.", $viewFileName));
}
if ($layout && $this->autoLayout) {
$this->output = $this->renderLayout($this->output, $layout);
Expand Down Expand Up @@ -439,7 +439,7 @@ public function renderLayout($content_for_layout, $layout = null) {
$this->output = $this->_render($layoutFileName);

if ($this->output === false) {
throw new CakeException(__("Error in layout %s, got no content.", $layoutFileName));
throw new CakeException(__d('cake', "Error in layout %s, got no content.", $layoutFileName));
}

$this->Helpers->trigger('afterLayout', array($layoutFileName));
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/View/errors/error400.ctp
Expand Up @@ -18,9 +18,9 @@
?>
<h2><?php echo $name; ?></h2>
<p class="error">
<strong><?php echo __('Error'); ?>: </strong>
<strong><?php echo __d('cake', 'Error'); ?>: </strong>
<?php printf(
__('The requested address %s was not found on this server.'),
__d('cake', 'The requested address %s was not found on this server.'),
"<strong>'{$url}'</strong>"
); ?>
</p>
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/View/errors/error500.ctp
Expand Up @@ -18,8 +18,8 @@
?>
<h2><?php echo $name; ?></h2>
<p class="error">
<strong><?php echo __('Error'); ?>: </strong>
<?php echo __('An Internal Error Has Occurred.'); ?>
<strong><?php echo __d('cake', 'Error'); ?>: </strong>
<?php echo __d('cake', 'An Internal Error Has Occurred.'); ?>
</p>
<?php
if (Configure::read('debug') > 0 ):
Expand Down

0 comments on commit 28eae99

Please sign in to comment.