Results 1 to 14 of 14
Thread: Language translation
- 02-08-2011, 09:27 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 21
- Rep Power
- 0
- 02-08-2011, 09:34 AM #2
Senior Member
- Join Date
- Dec 2008
- Location
- Kolkata
- Posts
- 280
- Rep Power
- 5
Probably google has a translation api
google-api-translate-java - Project Hosting on Google CodeSwastik
- 02-08-2011, 09:37 AM #3
Member
- Join Date
- Feb 2011
- Posts
- 21
- Rep Power
- 0
ya thanks i saw that but i couldnt understand that. can u explain me wat it has given. i have to download any rar files? also that code given is to change language in web pages i think. i need it to be done foe text document. how to do that.thanks again
- 02-08-2011, 09:48 AM #4
Senior Member
- Join Date
- Dec 2008
- Location
- Kolkata
- Posts
- 280
- Rep Power
- 5
It can be done in desktop applications too, but you need web connectivity to invoke the web service apis. Apart from that you need to download the following two jar files
Downloads - google-api-translate-java - Project Hosting on Google Code
http://mirrors.ibiblio.org/pub/mirro...n-20090211.jar
After downloading the jar files, add them to the classpath, and you can try the sample program they have given, it worked for me.
In the setHttpReferrer part use this
Translate.setHttpReferrer("http://code.google.com/p/google-api-translate-java");Swastik
- 02-08-2011, 09:48 AM #5
Member
- Join Date
- Feb 2011
- Posts
- 21
- Rep Power
- 0
if i download the jar file and run, it gives the error, fails to load main class manifest attribute. wat is that. can u help
- 02-08-2011, 10:03 AM #6
Senior Member
- Join Date
- Dec 2008
- Location
- Kolkata
- Posts
- 280
- Rep Power
- 5
I am not sure, whether its an executable jar or not. But did you try the steps I suggested?
Swastik
- 02-08-2011, 10:11 AM #7
Member
- Join Date
- Feb 2011
- Posts
- 21
- Rep Power
- 0
ya i did so. i downloaded it and included in my class path and compiled. i faced the following error: failed to load main class manifest attribute.
- 02-08-2011, 10:17 AM #8
Senior Member
- Join Date
- Dec 2008
- Location
- Kolkata
- Posts
- 280
- Rep Power
- 5
Did you download both the jar files and set to classpath? Which program are you trying to run.
try the following code after setting the classpath
Java Code:import com.google.api.translate.Language; import com.google.api.translate.Translate; public class Main { public static void main(String[] args) throws Exception { // Set the HTTP referrer to your website address. Translate.setHttpReferrer("http://code.google.com/p/google-api-translate-java"); String translatedText = Translate.execute("Bonjour monde le", Language.FRENCH, Language.ENGLISH); System.out.println(translatedText); } }Swastik
- 02-08-2011, 10:31 AM #9
Member
- Join Date
- Feb 2011
- Posts
- 21
- Rep Power
- 0
ya i did. it shows error as package doesnot exist. and error in the line
translatedText = Translate.execute("Bonjour monde le", Language.FRENCH, Language.ENGLISH);
- 02-08-2011, 10:34 AM #10
Senior Member
- Join Date
- Dec 2008
- Location
- Kolkata
- Posts
- 280
- Rep Power
- 5
Either you haven't downloaded both jar files or the classpath is not properly set. The code did work for me.
Swastik
- 02-08-2011, 10:38 AM #11
Member
- Join Date
- Feb 2011
- Posts
- 21
- Rep Power
- 0
i downloaded both the jar files. And i executed that code in netbeans only. should i include both the jar files in netbeans?
- 02-08-2011, 10:41 AM #12
Senior Member
- Join Date
- Dec 2008
- Location
- Kolkata
- Posts
- 280
- Rep Power
- 5
Yes, you have to include the jar files under application classpath in netbeans.
Swastik
- 02-08-2011, 10:49 AM #13
Member
- Join Date
- Feb 2011
- Posts
- 21
- Rep Power
- 0
hey i got it. thanks lot for replying me patiently. really i feel very happy to clarify my doubts in java forum. thanks again.
- 02-19-2011, 06:56 PM #14
Member
- Join Date
- Feb 2011
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Rotation & translation combined
By ScottVal in forum Java 2DReplies: 4Last Post: 02-27-2011, 06:57 PM -
Idea for Meaning Translation
By OmerHalit in forum AWT / SwingReplies: 5Last Post: 07-08-2010, 07:19 PM -
WORD Translation HELP PLZ :(
By sammypants in forum New To JavaReplies: 2Last Post: 11-24-2009, 01:46 PM -
X / Y Translation Problem
By SkinnyK in forum New To JavaReplies: 4Last Post: 01-16-2009, 12:20 AM -
Transform Rotation Translation
By Java Tip in forum java.awtReplies: 0Last Post: 06-21-2008, 08:53 PM


LinkBack URL
About LinkBacks

Bookmarks