Closed GoogleCodeExporter closed 9 years ago
And also, the 0.7 version dosnt work either. It also exits with an exception.
Original comment by matsekb...@gmail.com
on 21 Aug 2009 at 11:49
The exception on 0.7 is:
Caused by: java.lang.ClassCastException: org.json.JSONObject$Null
at com.google.api.translate.Translate.retrieveTranslation(Translate.java:109)
Original comment by matsekb...@gmail.com
on 21 Aug 2009 at 12:03
What text are you translating?
Original comment by rich.mid...@gmail.com
on 21 Aug 2009 at 12:12
[deleted comment]
I tranlate simple english texts to danish, for example:
CANCEL
Certificate
Chapter
Condition code
Commodity
Original comment by matsekb...@gmail.com
on 21 Aug 2009 at 12:39
Code:
public static String translate(String fromLanguage, String toLanguage, String text) {
String translatedText = "";
try {
Language from = findLanguage(fromLanguage);
Language to = findLanguage(toLanguage);
translatedText = Translate.translate(text, from, to);
System.out.println("Google: " + text + " -> " + translatedText);
} catch (Exception e) {
e.printStackTrace();
translatedText = text;
}
translatedText = replaceParenteses(translatedText);
return translatedText;
}
Original comment by matsekb...@gmail.com
on 21 Aug 2009 at 12:40
Interesting, I just saw this a couple of times. It's intermittent and extremely
infrequent; retrying the translation call always seems to clear the problem.
org.json.JSONException: JSONObject["responseData"] is not a JSONObject.
at org.json.JSONObject.getJSONObject(JSONObject.java:521)
at com.google.api.translate.Translate.execute(Translate.java:62)
at com.google.api.translate.Translate.translate(Translate.java:72)
This is a trivial i18n sample program; it translates several small English
words and
phrases to various target languages:
File
Print Preview
Print PDF
Exit
Language
ID
Company
Contact
Address
Add
Delete
Original comment by jimdougl...@gmail.com
on 11 Sep 2009 at 10:49
I've managed to force this case by submitting invalid data and in the next
version it
should return a more helpful error message from the translate service.
Hopefully it's fixed from a coding point of view, but if this is reproduced and
you
think the error indicates it's a problem in the translation library, or that
it's a
case which should make an attempt to retry the translation, then please file a
new
issue. Thanks.
Original comment by rich.mid...@gmail.com
on 19 Sep 2009 at 8:15
Original issue reported on code.google.com by
matsekb...@gmail.com
on 21 Aug 2009 at 11:49