Skip to content

Commit 7017ddf

Browse files
authored
Merge branch 'master' into java-quickstart
2 parents 5d07f6f + 7e81ef5 commit 7017ddf

File tree

5 files changed

+20
-25
lines changed

5 files changed

+20
-25
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "java-repo-tools"]
2-
path = java-repo-tools
3-
url = https://github.com/GoogleCloudPlatform/java-repo-tools.git

java-repo-tools

Lines changed: 0 additions & 1 deletion
This file was deleted.

translate/cloud-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
-->
1616
<project>
1717
<modelVersion>4.0.0</modelVersion>
18-
<groupId>come.example.translate</groupId>
18+
<groupId>com.example.translate</groupId>
1919
<artifactId>translate-google-cloud-samples</artifactId>
2020
<packaging>jar</packaging>
2121

translate/src/main/java/com/google/cloud/translate/samples/TranslateText.java

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static void detectLanguage(String sourceText, PrintStream out) {
4747
}
4848

4949
/**
50-
* Translates the source text in any language to english.
50+
* Translates the source text in any language to English.
5151
*
5252
* @param sourceText source text to be translated
5353
* @param out print stream
@@ -56,12 +56,12 @@ public static void translateText(String sourceText, PrintStream out) {
5656
Translate translate = createTranslateService();
5757
Translation translation = translate.translate(sourceText);
5858
out.printf("Source Text:\n\t%s\n", sourceText);
59-
out.printf("Translated Text:\n\t%s\n", translation.translatedText());
59+
out.printf("Translated Text:\n\t%s\n", translation.getTranslatedText());
6060
}
6161

6262
/**
6363
* Translate the source text from source to target language.
64-
* Make sure that your project is whitelisted.
64+
* Make sure that your project is whitelisted.
6565
*
6666
* @param sourceText source text to be translated
6767
* @param sourceLang source language of the text
@@ -83,7 +83,8 @@ public static void translateTextWithOptionsAndModel(
8383

8484
Translation translation = translate.translate(sourceText, srcLang, tgtLang, model);
8585
out.printf("Source Text:\n\tLang: %s, Text: %s\n", sourceLang, sourceText);
86-
out.printf("TranslatedText:\n\tLang: %s, Text: %s\n", targetLang, translation.translatedText());
86+
out.printf("TranslatedText:\n\tLang: %s, Text: %s\n", targetLang,
87+
translation.getTranslatedText());
8788
}
8889

8990

@@ -107,7 +108,8 @@ public static void translateTextWithOptions(
107108

108109
Translation translation = translate.translate(sourceText, srcLang, tgtLang);
109110
out.printf("Source Text:\n\tLang: %s, Text: %s\n", sourceLang, sourceText);
110-
out.printf("TranslatedText:\n\tLang: %s, Text: %s\n", targetLang, translation.translatedText());
111+
out.printf("TranslatedText:\n\tLang: %s, Text: %s\n", targetLang,
112+
translation.translatedText());
111113
}
112114

113115
/**
@@ -122,7 +124,7 @@ public static void displaySupportedLanguages(PrintStream out, Optional<String> t
122124
List<Language> languages = translate.listSupportedLanguages(target);
123125

124126
for (Language language : languages) {
125-
out.printf("Name: %s, Code: %s\n", language.name(), language.code());
127+
out.printf("Name: %s, Code: %s\n", language.getName(), language.getCode());
126128
}
127129
}
128130

@@ -132,23 +134,23 @@ public static void displaySupportedLanguages(PrintStream out, Optional<String> t
132134
* @return Google Translate Service
133135
*/
134136
public static Translate createTranslateService() {
135-
TranslateOptions translateOption = TranslateOptions.builder()
136-
.retryParams(retryParams())
137-
.connectTimeout(60000)
138-
.readTimeout(60000)
137+
TranslateOptions translateOption = TranslateOptions.newBuilder()
138+
.setRetryParams(retryParams())
139+
.setConnectTimeout(60000)
140+
.setReadTimeout(60000)
139141
.build();
140-
return translateOption.service();
142+
return translateOption.getService();
141143
}
142144

143145
/**
144146
* Retry params for the Translate API.
145147
*/
146148
private static RetryParams retryParams() {
147-
return RetryParams.builder()
148-
.retryMaxAttempts(3)
149-
.maxRetryDelayMillis(30000)
150-
.totalRetryPeriodMillis(120000)
151-
.initialRetryDelayMillis(250)
149+
return RetryParams.newBuilder()
150+
.setRetryMaxAttempts(3)
151+
.setMaxRetryDelayMillis(30000)
152+
.setTotalRetryPeriodMillis(120000)
153+
.setInitialRetryDelayMillis(250)
152154
.build();
153155
}
154156

travis.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,7 @@ shellcheck ./**/*.sh
7474

7575
# Run tests using App Engine local devserver.
7676
test_localhost() {
77-
# The testing scripts are stored in a submodule. This allows us to carefully
78-
# update the testing scripts, since submodules are tied to a specific commit.
79-
git submodule init
80-
git submodule update
77+
git clone https://github.com/GoogleCloudPlatform/java-repo-tools.git
8178

8279
devserver_tests=(
8380
appengine/helloworld

0 commit comments

Comments
 (0)