root/c3crm/sugarcrm/trunk/translate_m_en.php

Revision 643 (by jianting, 02/13/06 23:30:06)

upgrade for english version by dingjianting

<?php
$GLOBALS['sugarEntry'] = true;
?>
<?php
// Configuration area start
// Please config the following settings before translation besides Traditional Chinese :)
// Notice :
// 1. Give rights to web server for writing all language files if you are not use M$ OS
// ex. /language/  and  /modules/*/language/
// 2. Please put this script to the root path of your SugarCRM installation

$bk = chr(10);     // The sign of line break
$qo = '  ';        // The sign for quote
$lang = 'zh_cn';   // Your language code in ISO-XXX
$encode = 'UTF-8'; // The encode you want to use

// Configuration area end
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="<?php echo $lang; ?>">

  <head>
	<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $encode; ?>" />
	</head>
	<body>
<form method="get">
<select name="kfolder">	
<?php
$dir = "modules"; 
if ($dh = opendir($dir)) {
    while (($folder = readdir($dh)) !== false) { 
      if(is_dir($dir.'/'.$folder)&&$folder!='..'&&$folder!='.') {
        echo '<option';
        if(isset($_GET['kfolder']) && $folder == $_GET['kfolder'])
          echo ' selected';
        echo '>'.$folder.'</option>';
      }
    } 
    closedir($dh); 
} 
?>
</select><input type="submit">
</form>

<?php
$lang = "en_us";
$lang_src ="zh_cn";
if(isset($_GET['kfolder']) && $_GET['kfolder']){
  echo '<form method="post">';
  if(isset($_POST['go']) && $_POST['go']){
    $string = '';
	@unlink('modules/'.$_GET['kfolder'].'/language/'.$lang.'.lang.php_old');
    @copy('modules/'.$_GET['kfolder'].'/language/'.$lang.'.lang.php', 'modules/'.$_GET['kfolder'].'/language/'.$lang.'.lang.php_old');
    $fd = fopen('modules/'.$_GET['kfolder'].'/language/'.$lang.'.lang.php', 'w');
    fwrite($fd, '<?php'.$bk.'$mod_strings = array ('.$bk);
    //$string .= 'app_list_strings = array ('.$bk;
    foreach($_POST['mod_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);
    $string = '';
    if(isset($_POST['mod_list_strings']) && sizeof($_POST['mod_list_strings']) > 0){
    	fwrite($fd, $bk.');'.$bk.'$mod_list_strings = array ('.$bk);
      foreach($_POST['mod_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.'?>');
	fclose($fd);
  }
  

  include 'modules/'.$_GET['kfolder'].'/language/'.$lang_src.'.lang.php';
  global $mod_strings;
  global $mod_list_strings;
  $en_mod_strings = $mod_strings;
  $en_mod_list_strings = $mod_list_strings;
  if(file_exists('modules/'.$_GET['kfolder'].'/language/'.$lang.'.lang.php')) {
    include 'modules/'.$_GET['kfolder'].'/language/'.$lang.'.lang.php';
	global $mod_strings;
    global $mod_list_strings;
  }
  $result1 = array_merge($en_mod_strings, $mod_strings);
  $result2 = array_merge($en_mod_list_strings, $mod_list_strings);
  foreach($result1 as $key => $arr){
    if(is_array($arr)){
      foreach($arr as $key2 => $string){
        echo '<input type="text" name="mod_strings['.$key.']['.$key2.']" value="'.$string.'" size="80"><br>';
      }
    } else {
      echo '<input type="text" name="mod_strings['.$key.']" value="'.$arr.'" size="80"><br>';
    }
  }
  if($result2){
    foreach($result2 as $key => $arr){
      if(is_array($arr)){
        foreach($arr as $key2 => $string){
          echo '<input type="text" name="mod_list_strings['.$key.']['.$key2.']" value="'.$string.'" size="80"><br>';
        }
      } else {
        echo '<input type="text" name="mod_list_strings['.$key.']" value="'.$arr.'" size="80"><br>';
      }
    }
  }
  echo '<input type="submit" name="go" value="go">';
  echo '</form>';
}
?>
</body>
</html>
Note: See TracBrowser for help on using the browser.