Google Translate translates quote and single quote characters

1,112 views
Skip to first unread message

Dave

unread,
Sep 7, 2010, 3:33:18 AM9/7/10
to Google AJAX APIs
Hi,

I'm using Google Translate API, but when I try to translate a string
that contains some quotes or single quotes (" or '), it translate
these charactes to its HTML code (" ').

Do you know if Google Translate do the same with other characters? Is
there any option not to translate these characters?

Thanks!

Jeremy Geerdes

unread,
Sep 7, 2010, 6:51:52 AM9/7/10
to google-ajax...@googlegroups.com
The API assumes that your translation will be utilized in a web context; thus, it defaults to rendering strings in HTML. However, if you're not concerned about HTML, you can use the format parameter to specify that your string is plain text. In this case, it will not translate the quote and other marks to HTML character references.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
jrge...@gmail.com

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

> --
> You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
> To post to this group, send email to google-ajax...@googlegroups.com.
> To unsubscribe from this group, send email to google-ajax-searc...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en.
>

Dave

unread,
Sep 21, 2010, 10:10:00 AM9/21/10
to Google AJAX APIs
Hi!

Thanks for that, but if I want to translate this text (as a text, not
as HTML),

"<p>text 'bold' html</p>"

Google Translate returns this:

"<p> text 'bold' html </ p>"

You can notice that there are extra spaces.

The problem is that I can't translate it as an HTML, because I have
this text in a textarea, so if I translate it as HTML, google
translate will replace the character \n and translate " to &quot; and
' to &#39; (I don't know if it does the same to other characters...),
and I need the original characters...

I'm getting a bit crazy with this... lol

Thanks!

On 7 sep, 12:51, Jeremy Geerdes <jrgeer...@gmail.com> wrote:
> The API assumes that your translation will be utilized in a web context; thus, it defaults to rendering strings in HTML. However, if you're not concerned about HTML, you can use the format parameter to specify that your string is plain text. In this case, it will not translate the quote and other marks to HTML character references.
>
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
>
> For more information or a project quote:http://jgeerdes.home.mchsi.com
> jrgeer...@gmail.com
Reply all
Reply to author
Forward
0 new messages