updating i18n functions, fixes #3451

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5881 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-10-24 01:25:21 +00:00
parent 076f780ed6
commit 6dc81ef856
2 changed files with 24 additions and 0 deletions

View file

@ -1255,6 +1255,9 @@
* @return mixed translated string if $return is false string will be echoed
*/
function __($singular, $return = false) {
if (!$singular) {
return;
}
if (!class_exists('I18n')) {
uses('i18n');
}
@ -1279,6 +1282,9 @@
* @return mixed plural form of translated string if $return is false string will be echoed
*/
function __n($singular, $plural, $count, $return = false) {
if(!$singular) {
return;
}
if (!class_exists('I18n')) {
uses('i18n');
}
@ -1301,6 +1307,9 @@
* @return translated string if $return is false string will be echoed
*/
function __d($domain, $msg, $return = false) {
if (!$msg) {
return;
}
if (!class_exists('I18n')) {
uses('i18n');
}
@ -1324,6 +1333,9 @@
* @return plural form of translated string if $return is false string will be echoed
*/
function __dn($domain, $singular, $plural, $count, $return = false) {
if (!$singular) {
return;
}
if (!class_exists('I18n')) {
uses('i18n');
}
@ -1357,6 +1369,9 @@
* @return translated string if $return is false string will be echoed
*/
function __dc($domain, $msg, $category, $return = false) {
if (!$msg) {
return;
}
if (!class_exists('I18n')) {
uses('i18n');
}
@ -1394,6 +1409,9 @@
* @return plural form of translated string if $return is false string will be echoed
*/
function __dcn($domain, $singular, $plural, $count, $category, $return = false) {
if (!$singular) {
return;
}
if (!class_exists('I18n')) {
uses('i18n');
}
@ -1423,6 +1441,9 @@
* @return translated string if $return is false string will be echoed
*/
function __c($msg, $category, $return = false) {
if (!$msg) {
return;
}
if (!class_exists('I18n')) {
uses('i18n');
}

View file

@ -103,6 +103,9 @@ class I18n extends Object {
* @access public
*/
function translate($singular, $plural = null, $domain = null, $category = 5, $count = null, $directory = null) {
if (!$category) {
$category = 5;
}
$_this =& I18n::getInstance();
$_this->category = $_this->__categories[$category];