Translate API V2: error "Bad language pair: {0}"

1,801 views
Skip to first unread message

golubev

unread,
May 12, 2011, 9:44:19 AM5/12/11
to Google AJAX APIs
Hi.
For some requests I get the response:

{
"error": {
"errors": [
{
"domain": "global",
"reason": "badRequest",
"message": "Bad language pair: {0}"
}
],
"code": 400,
"message": "Bad language pair: {0}"
}
}


Request for example:

https://www.googleapis.com/language/translate/v2?key=<MY_KEY>&target=en&q=%D0%A5%D0%BE%D1%87%D1%83%20%D0%BD%D0%B0%D0%B9%D1%82%D0%B8

(I try to translate russian words "Хочу найти")

Why this error happen?

Jeremy Geerdes

unread,
May 12, 2011, 10:06:42 AM5/12/11
to google-ajax...@googlegroups.com
I am wondering if, for some reason, it's failing to detect the language as Russian. See what happens when you add &source=ru to your url.

Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

For more information or a project quote:
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.
>

golubev

unread,
May 12, 2011, 2:25:57 PM5/12/11
to Google AJAX APIs
Yes, when add "&source=ru" to url request completes successfully. But
language detecting don't work correctly? It is an error in API?


On 12 май, 18:06, Jeremy Geerdes <jrgeer...@gmail.com> wrote:
> I am wondering if, for some reason, it's failing to detect the language as Russian. See what happens when you add &source=ru to your url.
>
> Jeremy R. Geerdes
> Generally Cool Guy
> Des Moines, IA
>
> For more information or a project quote:
> jrgeer...@gmail.com
>
> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!
>
> On May 12, 2011, at 8:44 AM, golubev wrote:
>
>
>
> > Hi.
> > For some requests I get the response:
>
> > {
> > "error": {
> >  "errors": [
> >   {
> >    "domain": "global",
> >    "reason": "badRequest",
> >    "message": "Bad language pair: {0}"
> >   }
> >  ],
> >  "code": 400,
> >  "message": "Bad language pair: {0}"
> > }
> > }
>
> > Request for example:
>
> >https://www.googleapis.com/language/translate/v2?key=<MY_KEY>&target=en&q=%D0%A5%D0%BE%D1%87%D1%83%20%D0%BD%D0%B0%D0%B9%D1%82%D0­%B8

Jeremy Geerdes

unread,
May 12, 2011, 5:33:46 PM5/12/11
to google-ajax...@googlegroups.com
I suspect there's just not enough text there for detect to work right. It really struggles with short strings and/or random words bunched together. I would suggest specifying the language if possible and/or sending actual phrases that are no less than three words in length. In my experimentation over the years, it was at about three words that you can start to trust the detection and translation.

Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

For more information or a project quote:

jrge...@gmail.com

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

Reply all
Reply to author
Forward
0 new messages