I don't work for Google, so this is by no means an official response, but I can 
tell you that sending an escaped JSON string as an argument to the API would be 
problematic, especially as the number of properties increased. And if some of 
those properties were themselves arguments, the issue becomes exponentially 
greater. If you're using Javascript, consider a wrapper that supports method 
closures for callbacks and such. This way, you can pass an argument (e.g., your 
object reference) to your callback function even without sending it to the API. 
You can find a bunch of information about method closures with a simple search:

http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=javascript+method+closure


Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

For more information or a project quote:
[email protected]

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

On Apr 5, 2011, at 9:35 AM, dsr wrote:

> My app supports conversations between people with different languages.
> I need to associate each translation request with a context. This is
> needed to associate the translated text with the original, as well as
> the sender's name and other pertinent information. The v1 API includes
> a context parameter, but experiment shows that its syntax is
> constrained to a name or number, and you aren't allowed to use escaped
> strings, e.g. hello%20world. I would like to be able to pass an
> escaped JSON object. I was able to work around this by dynamically
> creating names and mapping them to context objects, but JSON would be
> a cleaner solution.  Right now v2 of the translate API doesn't support
> a context parameter, which is a real problem, and why I am using v1.
> Could JSON valued contexts be considered for v2?
> 
> A second issue is error reporting. Both v1 and v2 offer English
> phrases describing the error, but it would be nice to have a language
> independent code, or can we rely on the English phrase not changing?
> A case in point is where a French person is conversing with a Japanese
> person.  Right now French to Japanese is an "invalid translation
> language pair" according to v1. To explain the problem to both people,
> I need to recognize that error phrase, and generate a suitable
> explanation to both of them, or I could translate through an
> intermediate language like English. Either way, a reliable error code
> would be appreciated regardless of how the application recovers from
> such errors.
> 
> -- 
> 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.
> 

-- 
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