Search code examples
c#.netgoogle-translate

Google translate V2, certain text seems to break it


I'm trying to use the new version of the Google Translate API (V2) via the .NET API. It seems that the following text breaks it:

rt
@@




?????wwweryxc cet3f64

I thought maybe it was just the .NET wrapper but it seems to break the URL call as well, if you pass it any normal text it returns fine, if you pass this text the .NET API will just completely hang and not return anything or throw an error. If you do it via the web call you don't get a file returned in the browser, whereas you do with other text.

You can test the API online here: https://code.google.com/apis/explorer/#_s=translate&_v=v2&_m=translations.list

Does anyone know why? I'd expect it to just return the same comment not translated.


Solution

  • Apparantly the auto language detection just doesn't like random text, would have expected an error to be thrown to .NET though. So need to make sure to pass in the source language if you know it