thanks, but I want the translated content to be saved as nodes, and not to be translated on the fly.<br><br>Idan<br><br><div class="gmail_quote">On Jan 12, 2008 7:43 PM, Amr Mostafa <<a href="mailto:amr.mostafa@gmail.com">
amr.mostafa@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello Idan,<br><br>I would like to point out that there is an existing module which does exactly what you described, it's called gtrans.
<br><br><a href="http://drupal.org/project/gtrans" target="_blank">http://drupal.org/project/gtrans
</a><br><font color="#888888"><br>- Amr</font><div><div></div><div class="Wj3C7c"><br><br><div class="gmail_quote">On Jan 12, 2008 7:30 PM, Idan Arbel <<a href="mailto:idan@arbel-designs.com" target="_blank">idan@arbel-designs.com
</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div dir="rtl">
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Hello,</span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">I'm
working on a module to auto translate nodes on my websites. I'm using google
translate to do this.</span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">I've
encountered a problem that I was hoping someone would have an idea how to solve….when
I translate a text that has "special characters", mainly those that aren't
English, and I try to display them, I get characters that are black diamonds. When
trying to display those using drupal with drupal set message, something strange
happens, it seems like drupal just ignores the entire function. I'm trying to
print it out of a nodeapi hook, and the when I do all the other
drupal_set_messages aren't displayed, even those that come before. </span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Anyway,
I think I've isolated the problem to the encoding of the characters, but I
don't know how to solve it. I see the characters with the black diamonds when I
print_r($translation), in this case I only see them. And when ever I try to drupal_set_message
them I don't see anything. </span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">If
I translate a text that doesn't have one of those characters, all is well.</span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">This
is what I'm using to translate the texts:</span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">function
google_translate($text, $from = 'en', $to = 'es') {</span></font><font face="Arial" size="2"><span dir="rtl" style="font-size: 10pt; font-family: Arial;" lang="HE"></span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><span dir="ltr"></span><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"><span dir="ltr"></span> $data = "h1=en&ie=UTF8&text=$text";
</span></font><font face="Arial" size="2"><span dir="rtl" style="font-size: 10pt; font-family: Arial;" lang="HE"></span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><span dir="ltr"></span><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"><span dir="ltr"></span> $result = drupal_http_request(I18N_AUTO_GOOGLE_TRANSLATE_TRANSLATOR_URL
. '?langpair='. $from .'|'. $to, array(), 'POST', $data);</span></font><font face="Arial" size="2"><span dir="rtl" style="font-size: 10pt; font-family: Arial;" lang="HE"></span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><span dir="ltr"></span><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"><span dir="ltr"></span> $texttosearch = "id=result_box";
</span></font><font face="Arial" size="2"><span dir="rtl" style="font-size: 10pt; font-family: Arial;" lang="HE"></span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><span dir="ltr"></span><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"><span dir="ltr"></span> $start = strpos($result->data,
$texttosearch);</span></font><font face="Arial" size="2"><span dir="rtl" style="font-size: 10pt; font-family: Arial;" lang="HE"></span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><span dir="ltr"></span><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"><span dir="ltr"></span> $end = strpos($result->data,
"</div>", $start+24);</span></font><font face="Arial" size="2"><span dir="rtl" style="font-size: 10pt; font-family: Arial;" lang="HE"></span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><span dir="ltr"></span><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"><span dir="ltr"></span> $start = $start + 24;</span></font><font face="Arial" size="2">
<span dir="rtl" style="font-size: 10pt; font-family: Arial;" lang="HE"></span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><span dir="ltr"></span><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"><span dir="ltr"></span> $translated = substr($result->data,
$start, $end-$start);</span></font><font face="Arial" size="2"><span dir="rtl" style="font-size: 10pt; font-family: Arial;" lang="HE"></span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><span dir="ltr"></span><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"><span dir="ltr"></span> return $translated;</span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">}</span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Thanks</span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p dir="ltr" style="text-align: left; direction: ltr;"><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Idan</span></font></p>
</div>
</div>
</blockquote></div><br>
</div></div></blockquote></div><br>