Skip to content

Nits #415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 16, 2016
Merged

Nits #415

Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion translate/cloud-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>come.example.translate</groupId>
<groupId>com.example.translate</groupId>
<artifactId>translate-google-cloud-samples</artifactId>
<packaging>jar</packaging>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static void detectLanguage(String sourceText, PrintStream out) {
}

/**
* Translates the source text in any language to english.
* Translates the source text in any language to English.
*
* @param sourceText source text to be translated
* @param out print stream
Expand All @@ -56,7 +56,7 @@ public static void translateText(String sourceText, PrintStream out) {
Translate translate = createTranslateService();
Translation translation = translate.translate(sourceText);
out.printf("Source Text:\n\t%s\n", sourceText);
out.printf("Translated Text:\n\t%s\n", translation.translatedText());
out.printf("Translated Text:\n\t%s\n", translation.getTranslatedText());
}

/**
Expand All @@ -83,7 +83,7 @@ public static void translateTextWithOptionsAndModel(

Translation translation = translate.translate(sourceText, srcLang, tgtLang, model);
out.printf("Source Text:\n\tLang: %s, Text: %s\n", sourceLang, sourceText);
out.printf("TranslatedText:\n\tLang: %s, Text: %s\n", targetLang, translation.translatedText());
out.printf("TranslatedText:\n\tLang: %s, Text: %s\n", targetLang, translation.getTranslatedText());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line longer than 100 chars. Run

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}


Expand Down Expand Up @@ -122,7 +122,7 @@ public static void displaySupportedLanguages(PrintStream out, Optional<String> t
List<Language> languages = translate.listSupportedLanguages(target);

for (Language language : languages) {
out.printf("Name: %s, Code: %s\n", language.name(), language.code());
out.printf("Name: %s, Code: %s\n", language.getName(), language.getCode());
}
}

Expand All @@ -132,23 +132,23 @@ public static void displaySupportedLanguages(PrintStream out, Optional<String> t
* @return Google Translate Service
*/
public static Translate createTranslateService() {
TranslateOptions translateOption = TranslateOptions.builder()
.retryParams(retryParams())
.connectTimeout(60000)
.readTimeout(60000)
TranslateOptions translateOption = TranslateOptions.newBuilder()
.setRetryParams(retryParams())
.setConnectTimeout(60000)
.setReadTimeout(60000)
.build();
return translateOption.service();
return translateOption.getService();
}

/**
* Retry params for the Translate API.
*/
private static RetryParams retryParams() {
return RetryParams.builder()
.retryMaxAttempts(3)
.maxRetryDelayMillis(30000)
.totalRetryPeriodMillis(120000)
.initialRetryDelayMillis(250)
return RetryParams.newBuilder()
.setRetryMaxAttempts(3)
.setMaxRetryDelayMillis(30000)
.setTotalRetryPeriodMillis(120000)
.setInitialRetryDelayMillis(250)
.build();
}

Expand Down