"; $translations = array(); $filename = $dir.'/'.$file; $po = file($filename); if (!file_exists($filename) || !file_exists($to_dir.'/'.$file)) { continue; } foreach ($po as $line) { $pos = strpos($line, '='); if ($pos) { $variable = (substr($line, 1, $pos-1)); $variable = trim($variable); require $filename; $my_variable_in_english = $$variable; require $to_dir.'/'.$file; $my_variable = $$variable; $translations[] = array('msgid' =>$my_variable_in_english, 'msgstr' =>$my_variable); } } //var_dump($translations); $info['filename'] = explode('.', $info['filename']); $info['filename'] = $info['filename'][0]; $new_po_file = $save_dir_path.'/LC_MESSAGES/'.$info['filename'].'.po'; var_dump($new_po_file); $fp = fopen($new_po_file, 'w'); var_dump($fp); foreach($translations as $item) { $line = 'msgid "'.addslashes($item['msgid']).'"'."\n"; $line .= 'msgstr "'.addslashes($item['msgstr']).'"'."\n\n"; fwrite($fp, $line); } fclose($fp); } closedir($dh); } }