Open GoogleCodeExporter opened 8 years ago
[deleted comment]
I am also interested in this bug. I hope it will be solved soon. Using this
library for my test application: https://github.com/IonicaBizau/text-to-speech
Thanks!
Original comment by bizauion...@gmail.com
on 30 May 2013 at 10:33
I created a version which solve the problem. And the translation is complete,
but there is a failure if the character is inserted " or «. It's because
google translate will change eg Spanish to English, the character « by ". By
collecting all the text skips somewhere or add some of the original language.
But what I need is going very well, and it is only with these 2 characters, if
you're interested in the code you have no more to ask.
Thanks for your lib, I found looking for, because I was creating a method to
perform the translation from google translate.
Original comment by jtapiat1...@gmail.com
on 12 Feb 2014 at 12:23
Why make him ask.... Fixed it. For anyone else who want's a full translation.
com.gtranslate.parsing.ParseTextTranslate.java
replace the code for public void parse() with:
@Override
public void parse() {
appendURL();
String result = WebUtils.source(url.toString());
result = result.substring(0, result.indexOf("]]"));
String split[] = result.split("],\\[");
StringBuilder builder = new StringBuilder();
for(String sub : split){
String[] subs = sub.split("\\\",\\\"");
if(builder.length() > 0){
builder.append(" ");
}
builder.append(subs[0].replace("[", "").replace("]", "").replace("\"", "").replace(" .", ".").trim());
}
Text output = textTranslate.getOutput();
output.setText(builder.toString());
}
Original comment by cthb...@gmail.com
on 30 Apr 2014 at 9:58
[deleted comment]
As a workaround, you can use the java.util.StringTokenizer to translate the
whole sentence. See the code attached for more details.
Original comment by prateekm...@gmail.com
on 2 Mar 2015 at 12:05
Attachments:
Original issue reported on code.google.com by
ne...@animenord.com
on 30 Jan 2012 at 2:58