When submitting a query with multiple q parameters to the translate v2
API returns the results in random order.  This makes it very difficult
to correlate the translation with the original text.  I have tried
submitting the request as both a GET and a POST and the results are
the same.  Here are a couple of possible solutions:

1. Return the results in the same order the parameters appear in the
request. (Obvious solution if parameter order can be determined)

2. Return the original text with the translated text in the response.

Below is an example query with the API key redacted:

https://www.googleapis.com/language/translate/v2?key=INSERT_API_KEY&source=en&target=es&q=Dog&q=Cat&q=Fish&q=Ham&q=Bread&q=Milk&q=Cheese

Here are a few of the responses:

{
 "data": {
  "translations": [
   {
    "translatedText": "Leche"
   },
   {
    "translatedText": "Pan"
   },
   {
    "translatedText": "Jamón"
   },
   {
    "translatedText": "Perro"
   },
   {
    "translatedText": "Queso"
   },
   {
    "translatedText": "Gato"
   },
   {
    "translatedText": "Pescado"
   }
  ]
 }
}

Variation #2

{
 "data": {
  "translations": [
   {
    "translatedText": "Pescado"
   },
   {
    "translatedText": "Gato"
   },
   {
    "translatedText": "Pan"
   },
   {
    "translatedText": "Queso"
   },
   {
    "translatedText": "Perro"
   },
   {
    "translatedText": "Leche"
   },
   {
    "translatedText": "Jamón"
   }
  ]
 }
}

Thanks,
Kristian
CollabraSpace, Inc.

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

Reply via email to