use of com.google.cloud.translate.v3.Glossary in project google-cloud-java by googleapis.
the class TranslateSnippetsBeta method getGlossary.
// [END translate_list_glossary_beta]
/**
* Retrieves a glossary.
*
* @param projectId - Id of the project.
* @param location - location name.
* @param name - Glossary name.
*/
// [START translate_get_glossary_beta]
static Glossary getGlossary(String projectId, String location, String name) {
try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
GlossaryName glossaryName = GlossaryName.newBuilder().setProject(projectId).setLocation(location).setGlossary(name).build();
// Call the API
Glossary response = translationServiceClient.getGlossary(glossaryName.toString());
System.out.format("Got: %s\n", response.getName());
return response;
} catch (Exception e) {
throw new RuntimeException("Couldn't create client.", e);
}
}
Aggregations