示例#1
0
文件: Gettext.php 项目: jankal/mvc
 /**
  * @param string $path
  */
 public static function addTranslation($path)
 {
     $file = new File($path);
     if ($file->exists()) {
         $parts = explode('.', $path);
         $extension = $parts[count($parts) - 1];
         switch ($extension) {
             case 'po':
                 $translations = Translations::fromPoFile($path);
                 break;
             case 'mo':
                 $translations = Translations::fromMoFile($path);
                 break;
             case 'php':
                 $translations = Translations::fromPhpArrayFile($path);
                 break;
         }
         self::$activeTranslation->mergeWith($translations);
         self::$t->loadTranslations(self::$activeTranslation);
     }
 }