root/c3crm/sugarcrm/trunk/translate.php
Revision 626 (by jianting, 02/12/06 15:55:26) |
---|
<?php $GLOBALS['sugarEntry'] = true; ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="zh-tw"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <form method="post"> <?php //echo '$app_list_strings = array ('; $bk = chr(10); $qo = ' '; //echo $string = chr(60).'?php'.$bk.'$'; $string = ''; $lang = "zh_cn"; @unlink('include/language/'.$lang.'.lang.php_old'); @copy('include/language/'.$lang.'.lang.php', 'include/language/'.$lang.'.lang.php_old'); if(isset($_POST['go']) && $_POST['go']){ $fd = fopen('include/language/'.$lang.'.lang.php', 'w'); fwrite($fd, '<?php'.$bk.'$app_list_strings = array ('.$bk); //$string .= 'app_list_strings = array ('.$bk; foreach($_POST['app_list_strings'] as $key1 => $arr){ if(is_array($arr)){ $string .= $qo.'\''.$key1.'\' =>'.$bk.$qo.'array ('.$bk; foreach($arr as $key2 => $string1){ $string .= $qo.$qo.'\''.$key2.'\' => \''.$string1.'\','.$bk; } $string .= $qo.'),'.$bk; } else { $string .= $qo.'\''.$key1.'\' => \''.$arr.'\','.$bk; } } fwrite($fd, $string); fwrite($fd, $bk.');'.$bk.'$app_strings = array ('.$bk); $string = ''; foreach($_POST['app_strings'] as $key1 => $arr){ if(is_array($arr)){ $string .= $qo.'\''.$key1.'\' =>'.$bk.$qo.'array ('.$bk; foreach($arr as $key2 => $string1){ $string .= $qo.$qo.'\''.$key2.'\' => \''.$string1.'\','.$bk; } $string .= $qo.'),'.$bk; } else { //echo $key1.'<p>'; $string .= $qo.'\''.$key1.'\' => \''.$arr.'\','.$bk; } } fwrite($fd, $string); fwrite($fd, $bk.');'.$bk.'?>'); } ?> </pre><?php include 'include/language/en_us.lang.php'; $en_app_list_strings = $app_list_strings; $en_app_strings = $app_strings; include 'include/language/'.$lang.'.lang.php_old'; $result1 = array_merge($en_app_list_strings, $app_list_strings); $result2 = array_merge($en_app_strings, $app_strings); foreach($result1 as $key => $arr){ if(is_array($arr)){ //echo $key.'<p>'; if(is_array($app_list_strings[$key])) { $result3 = array_merge($en_app_list_strings[$key],$app_list_strings[$key]); } else { $result3= $en_app_list_strings[$key]; } foreach($result3 as $key2 => $string){ echo '<input type="text" name="app_list_strings['.$key.']['.$key2.']" value="'.$string.'"><br>'; } } else { echo '<input type="text" name="app_list_strings['.$key.']" value="'.$arr.'"><br>'; } } foreach($result2 as $key => $arr){ if(is_array($arr)){ //echo $key.'<p>'; foreach($arr as $key2 => $string){ echo '<input type="text" name="app_strings['.$key.']['.$key2.']" value="'.$string.'"><br>'; } } else { //echo $key.'<p>'; echo '<input type="text" name="app_strings['.$key.']" value="'.$arr.'"><br>'; } } ?> <input type="submit" name="go" value="go"> </form> </body> </html>
Note: See TracBrowser for help on using the browser.