コード例 #1
0
 /**
  * chargement du fichier de langue
  * 
  * @param	string langue
  * @return	null
  */
 protected static function textLOAD($langue)
 {
     if (count(HTML2PDF::$TEXTES)) {
         return true;
     }
     if (!preg_match('/^([a-z0-9]+)$/isU', $langue)) {
         echo 'ERROR : language code <b>' . $langue . '</b> incorrect.';
         exit;
     }
     $file = dirname(__FILE__) . '/langues/' . strtolower($langue) . '.txt';
     if (!is_file($file)) {
         echo 'ERROR : language code <b>' . $langue . '</b> unknown.<br>';
         echo 'You can create the translation file <b>' . $file . '</b> and send it to me in order to integrate it into a future version.';
         exit;
     }
     $texte = array();
     $infos = file($file);
     foreach ($infos as $val) {
         $val = trim($val);
         $val = explode("\t", $val);
         if (count($val) < 2) {
             continue;
         }
         $t_k = trim($val[0]);
         unset($val[0]);
         $t_v = trim(implode(' ', $val));
         if ($t_k && $t_v) {
             $texte[$t_k] = $t_v;
         }
     }
     HTML2PDF::$TEXTES = $texte;
     return true;
 }