Translation

  • The Translation class is the entry point for getting a Translator object for language translation.

  • You can create a Translator instance using the getClient() method with TranslatorOptions specifying the source and target languages.

  • To avoid resource leaks, call close() on the Translator object when it is no longer needed.

public class Translation extends Object

Entry point to get a Translator for translating from the source language to the target language specified in options.

An Translator is created via getClient(TranslatorOptions).

Example:

 Translator translator = Translation.getClient(options); 

Public Method Summary

static Translator
getClient(TranslatorOptions options)
Returns a new instance of Translator that can translate from the source language to the target language (both specified in options).

Inherited Method Summary

Public Methods

public static Translator getClient (TranslatorOptions options)

Returns a new instance of Translator that can translate from the source language to the target language (both specified in options).

To release the resources associated with a Translator, you need to ensure that close() is called on the resulting Translator object once it will no longer be used.