File tree Expand file tree Collapse file tree
src/main/java/com/google/cloud/translate/samples Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828 <scope >test</scope >
2929 </dependency >
3030 </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 >
3148</project >
Original file line number Diff line number Diff line change 1616
1717package com .google .cloud .translate .samples ;
1818
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 ;
2022
2123public 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+ }
2233 public static void main (String [] args ) {
23- System . out . println ( "Translate " );
34+ new TranslateText (). translateText ( "Hola " );
2435 }
2536}
You can’t perform that action at this time.
0 commit comments