Browse Source

Fixes for issue #81.

tags/2.0.0-beta
Qiang Xue 12 years ago
parent
commit
97992bdc89
  1. 9
      framework/YiiBase.php

9
framework/YiiBase.php

@ -600,6 +600,13 @@ class YiiBase
*/ */
public static function t($message, $params = array(), $language = null) public static function t($message, $params = array(), $language = null)
{ {
return self::$app->getI18N()->translate($message, $params, $language); if (self::$app !== null) {
return self::$app->getI18N()->translate($message, $params, $language);
} else {
if (strpos($message, '|') !== false && preg_match('/^([\w\-\\/\.\\\\]+)\|(.*)/', $message, $matches)) {
$message = $matches[2];
}
return is_array($params) ? strtr($message, $params) : $message;
}
} }
} }

Loading…
Cancel
Save