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 &lt;<a href="mailto:amr.mostafa@gmail.com">
amr.mostafa@gmail.com</a>&gt; 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&#39;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 &lt;<a href="mailto:idan@arbel-designs.com" target="_blank">idan@arbel-designs.com
</a>&gt; 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;">&nbsp;</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&#39;m
working on a module to auto translate nodes on my websites. I&#39;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;">&nbsp;</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&#39;ve
encountered a problem that I was hoping someone would have an idea how to solve….when
I translate a text that has &quot;special characters&quot;, mainly those that aren&#39;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&#39;m trying to
print it out of a nodeapi hook, and the when I do all the other
drupal_set_messages aren&#39;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;">&nbsp;</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&#39;ve isolated the problem to the encoding of the characters, but I
don&#39;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&#39;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;">&nbsp;</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&#39;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;">&nbsp;</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&#39;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;">&nbsp;</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;">&nbsp;</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 = &#39;en&#39;, $to = &#39;es&#39;) {</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>&nbsp; $data = &quot;h1=en&amp;ie=UTF8&amp;text=$text&quot;;
</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>&nbsp; $result = drupal_http_request(I18N_AUTO_GOOGLE_TRANSLATE_TRANSLATOR_URL
. &#39;?langpair=&#39;. $from .&#39;|&#39;. $to, array(), &#39;POST&#39;, $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>&nbsp; $texttosearch = &quot;id=result_box&quot;;
</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>&nbsp; $start = strpos($result-&gt;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>&nbsp; $end = strpos($result-&gt;data,
&quot;&lt;/div&gt;&quot;, $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>&nbsp; $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>&nbsp; $translated = substr($result-&gt;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>&nbsp; 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;">&nbsp;</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;">&nbsp;</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>