Witam,

Używam google translate, aby przetłumaczyc cały kod strony tak wygląda strona przed tłumaczeniem:
http://wklejto.pl/62503

tak po:
http://wklejto.pl/62504

Kod jest bardzo uszkodzony, jak powinienem wprowadzać kod i odebrać go aby tego uniknąć, kod skryptu który zmienia język:

  1. function zuo($str)
  2. {
  3. $str = str_replace(""",'"', $str);
  4. $str = str_replace("&","&", $str);
  5. $str = str_replace("<","<", $str);
  6. $str = str_replace(">",">", $str);
  7. $str = str_replace("->","-->", $str);
  8. $str = str_replace("</ ","</", $str);
  9. $str = str_replace("<br>","\n", $str);
  10.  
  11.  
  12. return $str;
  13.  
  14. }
  15.  
  16. function zamiana_html2($str)
  17. {
  18. $str = str_replace('"',""", $str);
  19. $str = str_replace("&","&", $str);
  20. $str = str_replace("<","<", $str);
  21. $str = str_replace(">",">", $str);
  22.  
  23. return $str;
  24.  
  25. }
  26.  
  27. function MybbGTranslate($contents)
  28. {
  29.  
  30.  
  31.  
  32. $link = "http://translate.google.com/";
  33. $polaczenie = @curl_init();
  34. @curl_setopt($polaczenie, CURLOPT_URL, $link);
  35. @curl_setopt($polaczenie, CURLOPT_POSTFIELDS, 'text='.urlencode(zamiana_html2($contents)).'&sl=pl&tl=en'); //dane do wyslania
  36. @curl_setopt($polaczenie, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)");
  37. @curl_setopt($polaczenie, CURLOPT_FOLLOWLOCATION, 1);
  38. @curl_setopt($polaczenie, CURLOPT_RETURNTRANSFER, 1);
  39. $result = @curl_exec ($polaczenie);
  40. preg_match_all('#<input type=hidden name=gtrans value="(.*)">#',$result,$matches);
  41. header('Content-Type: text/html',true);
  42.  
  43.  
  44. $contents = html_entity_decode(zuo($matches[1][0]));
  45. $contents = str_replace(""","\"", $contents);
  46.  
  47. return $contents;
  48. }



Pozdrawiam