-
Notifications
You must be signed in to change notification settings - Fork 73
/
README
31 lines (21 loc) · 1022 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Provides a simple, unofficial, Java client API for using Google Translate.
Features:
=========
Small library size - less than 50Kb.
Uses English as an intermediate language to attempt translations between language pairings that are unsupported directly by Google Translate.
The jar is runnable and has a very lightweight GUI to demonstrate translation functionality.
Quickstart:
===========
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.
GoogleAPI.setHttpReferrer(/* Enter the URL of your site here */);
// Set the Google Translate API key
// See: http://code.google.com/apis/language/translate/v2/getting_started.html
GoogleAPI.setKey(/* Enter your API key here */);
String translatedText = Translate.DEFAULT.execute("Bonjour le monde", Language.FRENCH, Language.ENGLISH);
System.out.println(translatedText);
}
}