File tree 2 files changed +30
-2
lines changed
src/main/java/com/google/cloud/translate/samples
2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 28
28
<scope >test</scope >
29
29
</dependency >
30
30
</dependencies >
31
+ <build >
32
+ <plugins >
33
+ <plugin >
34
+ <artifactId >maven-assembly-plugin</artifactId >
35
+ <configuration >
36
+ <archive >
37
+ <manifest >
38
+ <mainClass >com.google.cloud.translate.samples.TranslateText</mainClass >
39
+ </manifest >
40
+ </archive >
41
+ <descriptorRefs >
42
+ <descriptorRef >jar-with-dependencies</descriptorRef >
43
+ </descriptorRefs >
44
+ </configuration >
45
+ </plugin >
46
+ </plugins >
47
+ </build >
31
48
</project >
Original file line number Diff line number Diff line change 16
16
17
17
package com .google .cloud .translate .samples ;
18
18
19
- import com .google .api .services .translate .Translate ;
19
+ import com .google .cloud .translate .Translate ;
20
+ import com .google .cloud .translate .Translation ;
21
+ import com .google .cloud .translate .testing .RemoteTranslateHelper ;
20
22
21
23
public class TranslateText {
24
+ private static final Translate TRANSLATE = RemoteTranslateHelper .create ().options ().service ();
25
+
26
+ public void detectLanguages () {
27
+ }
28
+
29
+ public void translateText (String sourceText ) {
30
+ Translation translation = TRANSLATE .translate (sourceText );
31
+ System .out .println (translation .translatedText ());
32
+ }
22
33
public static void main (String [] args ) {
23
- System . out . println ( "Translate " );
34
+ new TranslateText (). translateText ( "Hola " );
24
35
}
25
36
}
You can’t perform that action at this time.
0 commit comments