Exemplo n.º 1
0
 /**
  * This method is a total lie. All that is does is fetch the appropriate translation from the appropriate file if it exists
  * @return string
  */
 public static function t($category, $message = NULL, $params = array(), $source = NULL, $language = NULL)
 {
     $category = explode('.', $category);
     $lang = Yii::getPreferredLanguage();
     $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'messages' . DIRECTORY_SEPARATOR . $lang . DIRECTORY_SEPARATOR . $category[1] . '.php';
     if (file_exists($file)) {
         $data = (include $file);
         if (isset($data[$message]) && $data[$message] != "") {
             $message = $data[$message];
         }
     }
     return Yii::translateMessage($message, $params);
 }