_translationId = translationId;
_fromText = fromText;
}
public Object convert(String id) throws ConverterException {
Translation translation = new Translation(_translationId, _fromText);
try {
StringBuffer url = new StringBuffer();
url.append("http://babelfish.altavista.com/babelfish/tr?doit=done");
url.append("&urltext=").append(Http.encodeURL(_fromText));
url.append("&lp=").append(_translationId);
String text = Http.URLtoString(new URL(url.toString()));
int begin = text.indexOf("<div style=padding:10px;>") + 25;
int end = text.indexOf("</div>", begin);
String toText = text.substring(begin, end).trim();
toText = StringUtil.replace(toText, "\n", " ");
translation.setToText(toText);
}
catch (Exception e) {
throw new ConverterException(e);
}