"; if ( $first_column_line == true ) { //echo "first_column"; $first_column_line = false; }else { $index = explode("/",$column); echo "opening ../lang/" . $index[0] . EOLH; $fhl[++$i] = fopen("../lang/" . $index[0], "wb") or die("can't open lang/" . $index[0]); fwrite($fhl[$i], '{'); if ( $first_column == true ) { $first_column = false; }else { fwrite($fhIndex, ","); } fwrite($fhIndex, '"' . $index[0] . '":"' . $index[1] . '"'); } echo EOLH; }else { if (!empty($fhIndex)) { fwrite($fhIndex, '}'); fclose($fhIndex); unset($fhIndex); } //echo "not first_line =>"; if ( $first_column == true ) { $first_column = false; $index = $column; //echo "first_column = ". $index . "=>"; }else { $i++; if ($first_object == false) // insère la virgule { //echo "not first_object =>"; fwrite($fhl[$i], ", "); } $text = '"' . $index . '":"' . $column .'"'; fwrite($fhl[$i], $text ); //écrit l'objet json echo "writing ***" . $text .'***' . EOLH; fflush($fhl[$i]); } echo EOLH; } //echo EOLH; } if ($first_line == false) { $first_object = false; } $first_line = false; } fclose($fh); foreach( $fhl as $fhx) { fwrite($fhx, '}'); fclose($fhx); } $fh = fopen("../lang/lang.json","r"); $str = fgets($fh); fclose($fh); $lang = json_decode( $str, true); foreach ($lang as $key => $value) { print $key ." : "; if ( getLang($key, true) !== false ) { print json_last_error_msg() . EOLH; }else { print "erreur à l'ouverture du fichier"; } } } ?>