From d2badbeb22d2e557746f5d2f3d06480ab2ff0bdb Mon Sep 17 00:00:00 2001 From: AD7six Date: Sat, 19 Mar 2011 18:29:31 +0100 Subject: [PATCH] update language domains no domain - the thing being translated comes from the app - so let the user handle that cake - end user cake_error - error messages --- lib/Cake/View/Helper.php | 2 +- lib/Cake/View/Helper/FormHelper.php | 20 +++++++++---------- lib/Cake/View/Helper/HtmlHelper.php | 4 ++-- lib/Cake/View/Helper/JsHelper.php | 2 +- lib/Cake/View/Helper/MootoolsEngineHelper.php | 2 +- lib/Cake/View/Helper/NumberHelper.php | 8 ++++---- lib/Cake/View/Helper/PaginatorHelper.php | 14 ++++++------- lib/Cake/View/Helper/TimeHelper.php | 2 +- lib/Cake/View/View.php | 4 ++-- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/lib/Cake/View/Helper.php b/lib/Cake/View/Helper.php index 91b017ba1b2..92232a79bf4 100644 --- a/lib/Cake/View/Helper.php +++ b/lib/Cake/View/Helper.php @@ -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(__d('cake', 'Method %1$s::%2$s does not exist', get_class($this), $method), E_USER_WARNING); + trigger_error(__d('cake_error', 'Method %1$s::%2$s does not exist', get_class($this), $method), E_USER_WARNING); } /** diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 66b6c88b12a..973786733b7 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -241,12 +241,12 @@ function create($model = null, $options = array()) { $options); $this->_inputDefaults = $options['inputDefaults']; unset($options['inputDefaults']); - + if (!isset($options['id'])) { $domId = isset($options['action']) ? $options['action'] : $this->request['action']; $options['id'] = $this->domId($domId . 'Form'); } - + if ($options['action'] === null && $options['url'] === null) { $options['action'] = $this->request->here(false); } elseif (empty($options['url']) || is_array($options['url'])) { @@ -631,7 +631,7 @@ public function inputs($fields = null, $blacklist = null) { $actionName = __d('cake', 'Edit %s'); } $modelName = Inflector::humanize(Inflector::underscore($model)); - $legend = sprintf($actionName, __d('cake', $modelName)); + $legend = sprintf($actionName, __($modelName)); } $out = null; @@ -1058,7 +1058,7 @@ public function radio($fieldName, $options = array(), $attributes = array()) { $legend = $attributes['legend']; unset($attributes['legend']); } elseif (count($options) > 1) { - $legend = __d('cake', Inflector::humanize($this->field())); + $legend = __(Inflector::humanize($this->field())); } $label = true; @@ -1128,7 +1128,7 @@ public function radio($fieldName, $options = array(), $attributes = array()) { } /** - * Missing method handler - implements various simple input types. Is used to create inputs + * Missing method handler - implements various simple input types. Is used to create inputs * of various types. e.g. `$this->Form->text();` will create `` while * `$this->Form->range();` will create `` * @@ -1151,7 +1151,7 @@ public function radio($fieldName, $options = array(), $attributes = array()) { public function __call($method, $params) { $options = array(); if (empty($params)) { - throw new CakeException(__d('cake', 'Missing field name for FormHelper::%s', $method)); + throw new CakeException(__d('cake_error', 'Missing field name for FormHelper::%s', $method)); } if (isset($params[1])) { $options = $params[1]; @@ -1471,7 +1471,7 @@ public function select($fieldName, $options = array(), $attributes = array()) { $style = null; $tag = null; $attributes += array( - 'class' => null, + 'class' => null, 'escape' => true, 'secure' => null, 'empty' => '', @@ -2023,7 +2023,7 @@ protected function _name($options = array(), $field = null, $key = 'name') { function __selectOptions($elements = array(), $parents = array(), $showParents = null, $attributes = array()) { $select = array(); $attributes = array_merge( - array('escape' => true, 'style' => null, 'value' => null, 'class' => null), + array('escape' => true, 'style' => null, 'value' => null, 'class' => null), $attributes ); $selectedIsEmpty = ($attributes['value'] === '' || $attributes['value'] === null); @@ -2226,7 +2226,7 @@ protected function _initInputField($field, $options = array()) { } else { $secure = (isset($this->request['_Token']) && !empty($this->request['_Token'])); } - + $fieldName = null; if ($secure && !empty($options['name'])) { preg_match_all('/\[(.*?)\]/', $options['name'], $matches); @@ -2242,4 +2242,4 @@ protected function _initInputField($field, $options = array()) { } return $result; } -} +} \ No newline at end of file diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index 4925ba16fda..5bbadc4b4fb 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -940,13 +940,13 @@ public function loadConfig($configFile, $path = CONFIGS) { $reader = $configFile[1]; } } else { - throw new ConfigureException(__d('cake', 'Cannot load the configuration file. Wrong "configFile" configuration.')); + throw new ConfigureException(__d('cake_error', 'Cannot load the configuration file. Wrong "configFile" configuration.')); } $readerClass = Inflector::camelize($reader) . 'Reader'; App::uses($readerClass, 'Configure'); if (!class_exists($readerClass)) { - throw new ConfigureException(__d('cake', 'Cannot load the configuration file. Unknown reader.')); + throw new ConfigureException(__d('cake_error', 'Cannot load the configuration file. Unknown reader.')); } $readerObj = new $readerClass($path); diff --git a/lib/Cake/View/Helper/JsHelper.php b/lib/Cake/View/Helper/JsHelper.php index d705ea7ef66..c12ebfbc3d6 100644 --- a/lib/Cake/View/Helper/JsHelper.php +++ b/lib/Cake/View/Helper/JsHelper.php @@ -153,7 +153,7 @@ public function __call($method, $params) { if (method_exists($this, $method . '_')) { return call_user_func(array(&$this, $method . '_'), $params); } - trigger_error(__d('cake', 'JsHelper:: Missing Method %s is undefined', $method), E_USER_WARNING); + trigger_error(__d('cake_error', 'JsHelper:: Missing Method %s is undefined', $method), E_USER_WARNING); } /** diff --git a/lib/Cake/View/Helper/MootoolsEngineHelper.php b/lib/Cake/View/Helper/MootoolsEngineHelper.php index 13fb1bff4b5..6e1c5066c26 100644 --- a/lib/Cake/View/Helper/MootoolsEngineHelper.php +++ b/lib/Cake/View/Helper/MootoolsEngineHelper.php @@ -307,7 +307,7 @@ function drag($options = array()) { function drop($options = array()) { if (empty($options['drag'])) { trigger_error( - __d('cake', 'MootoolsEngine::drop() requires a "drag" option to properly function'), E_USER_WARNING + __d('cake_error', 'MootoolsEngine::drop() requires a "drag" option to properly function'), E_USER_WARNING ); return false; } diff --git a/lib/Cake/View/Helper/NumberHelper.php b/lib/Cake/View/Helper/NumberHelper.php index fc5b35144f5..011d5d9eb43 100644 --- a/lib/Cake/View/Helper/NumberHelper.php +++ b/lib/Cake/View/Helper/NumberHelper.php @@ -164,7 +164,7 @@ public function format($number, $options = false) { * ### Options * * - `before` - The currency symbol to place before whole numbers ie. '$' - * - `after` - The currency symbol to place after decimal numbers ie. 'c'. Set to boolean false to + * - `after` - The currency symbol to place after decimal numbers ie. 'c'. Set to boolean false to * use no decimal symbol. eg. 0.35 => $0.35. * - `zero` - The text to use for zero values, can be a string or a number. ie. 0, 'Free!' * - `places` - Number of decimal places to use. ie. 2 @@ -215,7 +215,7 @@ public function currency($number, $currency = 'USD', $options = array()) { } } - $position = $options[$symbolKey.'Position'] != 'after' ? 'before' : 'after'; + $position = $options[$symbolKey.'Position'] != 'after' ? 'before' : 'after'; $options[$position] = $options[$symbolKey.'Symbol']; $abs = abs($number); @@ -236,7 +236,7 @@ public function currency($number, $currency = 'USD', $options = array()) { * currency formats easier. * * {{{ $number->addFormat('NOK', array('before' => 'Kr. ')); }}} - * + * * You can now use `NOK` as a shortform when formatting currency amounts. * * {{{ $number->currency($value, 'NOK'); }}} @@ -259,4 +259,4 @@ public function addFormat($formatName, $options) { $this->_currencies[$formatName] = $options + $this->_currencyDefaults; } -} +} \ No newline at end of file diff --git a/lib/Cake/View/Helper/PaginatorHelper.php b/lib/Cake/View/Helper/PaginatorHelper.php index 495d6402b38..0af39f9df06 100644 --- a/lib/Cake/View/Helper/PaginatorHelper.php +++ b/lib/Cake/View/Helper/PaginatorHelper.php @@ -69,7 +69,7 @@ class PaginatorHelper extends AppHelper { * - `escape` Defines if the title field for the link should be escaped (default: true). * - `update` DOM id of the element updated with the results of the AJAX call. * If this key isn't specified Paginator will use plain HTML links. - * - `paging['paramType']` The type of parameters to use when creating links. Valid options are + * - `paging['paramType']` The type of parameters to use when creating links. Valid options are * 'querystring', 'named', and 'route'. See PaginatorComponent::$settings for more information. * - `convertKeys` - A list of keys in url arrays that should be converted to querysting params * if paramType == 'querystring'. @@ -102,7 +102,7 @@ function __construct(View $View, $settings = array()) { $classname = $ajaxProvider . 'Helper'; if (!method_exists($classname, 'link')) { throw new CakeException(sprintf( - __d('cake', '%s does not implement a link() method, it is incompatible with PaginatorHelper'), $classname + __d('cake_error', '%s does not implement a link() method, it is incompatible with PaginatorHelper'), $classname )); } parent::__construct($View, $settings); @@ -306,7 +306,7 @@ public function sort($key, $title = null, $options = array()) { if (empty($title)) { $title = $key; - $title = __d('cake', Inflector::humanize(preg_replace('/_id$/', '', $title))); + $title = __(Inflector::humanize(preg_replace('/_id$/', '', $title))); } $dir = isset($options['direction']) ? $options['direction'] : 'asc'; unset($options['direction']); @@ -314,7 +314,7 @@ public function sort($key, $title = null, $options = array()) { $sortKey = $this->sortKey($options['model']); $defaultModel = $this->defaultModel(); $isSorted = ( - $sortKey === $key || + $sortKey === $key || $sortKey === $defaultModel . '.' . $key || $key === $defaultModel . '.' . $sortKey ); @@ -603,12 +603,12 @@ public function counter($options = array()) { /** * Returns a set of numbers for the paged result set - * uses a modulus to decide how many numbers to show on each side of the current page (default: 8). + * uses a modulus to decide how many numbers to show on each side of the current page (default: 8). * * `$this->Paginator->numbers(array('first' => 2, 'last' => 2));` * * Using the first and last options you can create links to the beginning and end of the page set. - * + * * * ### Options * @@ -862,4 +862,4 @@ public function last($last = 'last >>', $options = array()) { } return $out; } -} +} \ No newline at end of file diff --git a/lib/Cake/View/Helper/TimeHelper.php b/lib/Cake/View/Helper/TimeHelper.php index 3f149add4da..d739cf6fdd8 100644 --- a/lib/Cake/View/Helper/TimeHelper.php +++ b/lib/Cake/View/Helper/TimeHelper.php @@ -752,4 +752,4 @@ public function i18nFormat($date, $format = null, $invalid = false, $userOffset $format = $this->convertSpecifiers($format, $date); return strftime($format, $date); } -} +} \ No newline at end of file diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php index 2f22dbb54af..439ffe88789 100644 --- a/lib/Cake/View/View.php +++ b/lib/Cake/View/View.php @@ -396,7 +396,7 @@ public function render($view = null, $layout = null) { $layout = $this->layout; } if ($this->output === false) { - throw new CakeException(__d('cake', "Error in view %s, got no content.", $viewFileName)); + throw new CakeException(__d('cake_error', "Error in view %s, got no content.", $viewFileName)); } if ($layout && $this->autoLayout) { $this->output = $this->renderLayout($this->output, $layout); @@ -439,7 +439,7 @@ public function renderLayout($content_for_layout, $layout = null) { $this->output = $this->_render($layoutFileName); if ($this->output === false) { - throw new CakeException(__d('cake', "Error in layout %s, got no content.", $layoutFileName)); + throw new CakeException(__d('cake_error', "Error in layout %s, got no content.", $layoutFileName)); } $this->Helpers->trigger('afterLayout', array($layoutFileName));