Jump to content
Fórum Script Brasil
  • 0

Traduzir com php


Ezequias Soares

Question

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

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...