/**
  *
  * change the language loader method
  *
  */
 public static function setLanguageLoader($loader)
 {
     //make sure the loader is ok
     if (!is_callable($loader)) {
         throw new Exception(SyC::t('sdk', "The language loader is not a valid callback"));
     }
     self::$loadLanguage = $loader;
     //reset the old messages, so that they are reloaded with the new loader
     self::$_messages = null;
 }
 public static function t($category, $message, $params = array())
 {
     //load the translation from file if not done so
     if (!isset(self::$_messages)) {
         //The language is the folder name, and the category is the name of the file
         $messageFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'messages' . DIRECTORY_SEPARATOR . self::$_language . DIRECTORY_SEPARATOR . $category . '.php';
         if (is_file($messageFile)) {
             self::$_messages = (include $messageFile);
         }
         //make sure we have an array for this variable
         if (!is_array(self::$_messages)) {
             self::$_messages = array();
         }
     }
     //check if the text has a valid translation
     if (isset(self::$_messages[$message]) && !empty(self::$_messages[$message])) {
         $message = self::$_messages[$message];
     }
     //return the translated message, with the parameters replaced
     return $params !== array() ? strtr($message, $params) : $message;
 }