Ezequias Soares Posted September 20, 2011 Report Share Posted September 20, 2011 Queria que fizessem este script funcionar, (E me ensinem quais arquivos de texto eu tenho de criar para ser os dicionarios, pasta onde tenho de crialos, e como coloco as palavras e traduão dentro dos arquivos de texto.)<HTML><HEAD><title>Tradutor Online</title> </HEAD><BODY><?php if(empty($dicionario)) { ; } else { $texto = $texto; $final = $texto; $final = " " . $final . " "; $dicionario = $dicionario; $path = translator/dic; /* Search of words */ $source = fopen("$path/$dicionario/ex_source.txt", "r"); $destination = fopen("$path/$dicionario/ex_dest.txt", "r"); $original = "vazio"; $modificado = "vazio"; while (!feof($source)) { $original = fgets($source, 200); $modificado = fgets($destination, 200); $original = trim($original); $modificado = trim($modificado); /* To substitute expressions */ if (strlen($original) == 0) break; $final = str_replace("\n", "<br> ", $final); $final = str_replace( " " . $original ." " , " " . $modificado . " ", $final); $final = str_replace( " " . $original ."." , " " . $modificado . ".", $final); $final = str_replace( " " . $original .":" , " " . $modificado . ":", $final); $final = str_replace( " " . $original ."," , " " . $modificado . ",", $final); $final = str_replace( " " . $original ."!" , " " . $modificado . "!", $final); $final = str_replace( " " . $original ."¡" , " " . $modificado . "¡", $final); $final = str_replace( " " . $original ."?" , " " . $modificado . "?", $final); $final = str_replace( " " . $original ."¿" , " " . $modificado . "¿", $final); $final = str_replace( " " . $original .";" , " " . $modificado . ";", $final); $final = str_replace( " " . $original ."/ " , " " . $modificado . "/", $final); } fclose ($source); fclose ($destination); $final = trim($final); } ?> <br><br><b>Tradutor:</b> <table border="2" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="95%" id="AutoNumber1"> <tr> <td width="100%"><font size="2"><? echo $final; ?></font> </td> </tr> </table><br> <FORM ACTION="" method="post" onSubmit="return verifyTEXT()" name="transform"> <b>Dictionary:</b> <select size="1" name="dicionario"> <option value="engpor">English -> Portuguese</option> <option value="poreng">Portuguese -> English</option> </select><br><b>></b> <i>Write in bass the text to translate.</i><br> <TEXTAREA COLS="44" ROWS="7" NAME="texto"><? echo $texto; ?></TEXTAREA><BR><BR> <DIV ALIGN="center"><INPUT TYPE="submit" NAME="submit" VALUE="Translater"></DIV> </FORM></BODY></HTML> Quote Link to comment Share on other sites More sharing options...
Question
Ezequias Soares
Queria que fizessem este script funcionar, (E me ensinem quais arquivos de texto eu tenho de criar para ser os dicionarios, pasta onde tenho de crialos, e como coloco as palavras e traduão dentro dos arquivos de texto.)
<HTML>
<HEAD>
<title>Tradutor Online</title>
</HEAD>
<BODY>
<?php
if(empty($dicionario)) {
;
}
else {
$texto = $texto;
$final = $texto;
$final = " " . $final . " ";
$dicionario = $dicionario;
$path = translator/dic;
/* Search of words */
$source = fopen("$path/$dicionario/ex_source.txt", "r");
$destination = fopen("$path/$dicionario/ex_dest.txt", "r");
$original = "vazio";
$modificado = "vazio";
while (!feof($source)) {
$original = fgets($source, 200);
$modificado = fgets($destination, 200);
$original = trim($original);
$modificado = trim($modificado);
/* To substitute expressions */
if (strlen($original) == 0) break;
$final = str_replace("\n", "<br> ", $final);
$final = str_replace( " " . $original ." " , " " . $modificado . " ", $final);
$final = str_replace( " " . $original ."." , " " . $modificado . ".", $final);
$final = str_replace( " " . $original .":" , " " . $modificado . ":", $final);
$final = str_replace( " " . $original ."," , " " . $modificado . ",", $final);
$final = str_replace( " " . $original ."!" , " " . $modificado . "!", $final);
$final = str_replace( " " . $original ."¡" , " " . $modificado . "¡", $final);
$final = str_replace( " " . $original ."?" , " " . $modificado . "?", $final);
$final = str_replace( " " . $original ."¿" , " " . $modificado . "¿", $final);
$final = str_replace( " " . $original .";" , " " . $modificado . ";", $final);
$final = str_replace( " " . $original ."/ " , " " . $modificado . "/", $final);
}
fclose ($source);
fclose ($destination);
$final = trim($final);
}
?>
<br><br><b>Tradutor:</b>
<table border="2" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="95%" id="AutoNumber1">
<tr>
<td width="100%"><font size="2"><? echo $final; ?></font> </td>
</tr>
</table><br>
<FORM ACTION="" method="post" onSubmit="return verifyTEXT()" name="transform">
<b>Dictionary:</b> <select size="1" name="dicionario">
<option value="engpor">English -> Portuguese</option>
<option value="poreng">Portuguese -> English</option>
</select><br><b>></b> <i>Write in bass the text to translate.</i><br>
<TEXTAREA COLS="44" ROWS="7" NAME="texto"><? echo $texto; ?></TEXTAREA><BR><BR>
<DIV ALIGN="center"><INPUT TYPE="submit" NAME="submit" VALUE="Translater"></DIV>
</FORM>
</BODY>
</HTML>
Link to comment
Share on other sites
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.