<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Ah, what Alex said. The subject fooled me ;)<br>
<br>
Aaron<br>
<br>
Alex Urevick-Ackelsberg wrote:
<blockquote
cite="mid37b3830e0801120952k47a7958k78936bdb483c4eab@mail.gmail.com"
type="cite">Idan-<br>
<div class="gmail_quote"><br>
There already is an auto translate module: <a
href="http://drupal.org/project/i18n_auto" target="_blank">http://drupal.org/project/i18n_auto</a><br>
<br>
This module has the same issue that you mention, which is caused by
Google's compression of the special characters. <br>
<br>
Aaron Winborn and I just submitted 4 tasks to the GHOP queue (well,
they're all in one issue, but will be split into 4 tasks) to bring this
module out of Dev and into a full version (part of the task is to fix
this exact issue): <a href="http://drupal.org/node/208539"
target="_blank">http://drupal.org/node/208539</a><br>
<br>
Care to work with us to fix this module, rather than create a new one?
If this is taken on by one of the students it very well may be fixed in
the near future...
<br>
<br>
-- <br>
Alex Urevick-Ackelsberg<br>
(917) 407-9086<br>
<a href="mailto:alex@zivtech.com" target="_blank">alex@zivtech.com</a><br>
Future Majority - <a href="http://futuremajority.com" target="_blank">http://futuremajority.com
</a><br>
Young Philly Politics - <a href="http://youngphillypolitics.com"
target="_blank">http://youngphillypolitics.com</a><br>
ZivTech - <a href="http://zivtech.com" target="_blank">http://zivtech.com</a><br>
<br>
<br>
<div class="gmail_quote">
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Message:
6<br>
Date: Sat, 12 Jan 2008 19:30:52 +0200<br>
From: "Idan Arbel" <<a href="mailto:idan@arbel-designs.com"
target="_blank">idan@arbel-designs.com</a>><br>
Subject: [development] Google translation module
<br>
To: <
<a href="mailto:development@drupal.org" target="_blank">development@drupal.org</a>><br>
Message-ID: <<a
href="mailto:20080112173054.D6AE530021@sa5.bezeqint.net"
target="_blank">20080112173054.D6AE530021@sa5.bezeqint.net
</a>><br>
Content-Type: text/plain; charset="us-ascii"
<br>
<br>
Hello,<br>
<br>
<br>
<br>
I'm working on a module to auto translate nodes on my websites. I'm
using<br>
google translate to do this.<br>
<br>
<br>
<br>
I've encountered a problem that I was hoping someone would have an idea
how
<br>
to solve..when I translate a text that has "special characters", mainly<br>
those that aren't English, and I try to display them, I get characters
that<br>
are black diamonds. When trying to display those using drupal with
drupal
<br>
set message, something strange happens, it seems like drupal just
ignores<br>
the entire function. I'm trying to print it out of a nodeapi hook, and
the<br>
when I do all the other drupal_set_messages aren't displayed, even
those
<br>
that come before.<br>
<br>
<br>
<br>
Anyway, I think I've isolated the problem to the encoding of the
characters,<br>
but I don't know how to solve it. I see the characters with the black<br>
diamonds when I print_r($translation), in this case I only see them.
And
<br>
when ever I try to drupal_set_message them I don't see anything.<br>
<br>
<br>
<br>
If I translate a text that doesn't have one of those characters, all is<br>
well.<br>
<br>
<br>
<br>
This is what I'm using to translate the texts:
<br>
<br>
<br>
<br>
<br>
<br>
function google_translate($text, $from = 'en', $to = 'es') {<br>
<br>
$data = "h1=en&ie=UTF8&text=$text";<br>
<br>
$result =
drupal_http_request(I18N_AUTO_GOOGLE_TRANSLATE_TRANSLATOR_URL .
<br>
'?langpair='. $from .'|'. $to, array(), 'POST', $data);<br>
<br>
$texttosearch = "id=result_box";<br>
<br>
$start = strpos($result->data, $texttosearch);<br>
<br>
$end = strpos($result->data, "</div>", $start+24);
<br>
<br>
$start = $start + 24;<br>
<br>
$translated = substr($result->data, $start, $end-$start);<br>
<br>
return $translated;<br>
<br>
}<br>
<br>
<br>
<br>
Thanks<br>
<br>
<br>
<br>
Idan<br>
<br>
-------------- next part --------------
<br>
An HTML attachment was scrubbed...<br>
URL: <a
href="http://lists.drupal.org/pipermail/development/attachments/20080112/edb9c450/attachment.htm"
target="_blank">http://lists.drupal.org/pipermail/development/attachments/20080112/edb9c450/attachment.htm
</a><br>
<br>
------------------------------<br>
<font color="#888888"><br>
--<br>
[ Drupal development list | <a href="http://lists.drupal.org/"
target="_blank">http://lists.drupal.org/</a> ]<br>
<br>
End of development Digest, Vol 61, Issue 32
<br>
*******************************************<br>
</font></blockquote>
</div>
<br>
<br clear="all">
<br>
</div>
<br>
<br clear="all">
<br>
-- <br>
Alex Urevick-Ackelsberg<br>
(917) 407-9086<br>
<a href="mailto:alex@zivtech.com">alex@zivtech.com</a><br>
Future Majority - <a href="http://futuremajority.com">http://futuremajority.com</a>
<br>
Young Philly Politics - <a href="http://youngphillypolitics.com">http://youngphillypolitics.com</a><br>
ZivTech - <a href="http://zivtech.com">http://zivtech.com</a>
</blockquote>
<br>
</body>
</html>