FirebaseTranslator

public class FirebaseTranslator extends Object
implements Closeable

This class is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to the migration guide.

Entry point for Translation.

This class can be used from any thread.

Public Method Summary

void
close()
Closes the translator object and releases any system resources associated with it.
Task<Void>
downloadModelIfNeeded()
Downloads the model files required for translation, if they are not already present.
Task<Void>
downloadModelIfNeeded(FirebaseModelDownloadConditions conditions)
Downloads the model files required for translation, if they are not already present, when the given conditions are met.
Task<String>
translate(String input)
Translates the given input from the source language into the target language.

Inherited Method Summary

Public Methods

public void close ()

Closes the translator object and releases any system resources associated with it.

public Task<Void> downloadModelIfNeeded ()

Downloads the model files required for translation, if they are not already present. The download will be triggered as soon as there is a network connection, with no other conditions.

Returns
  • A Task that will be completed when the required files have been downloaded.

public Task<Void> downloadModelIfNeeded (FirebaseModelDownloadConditions conditions)

Downloads the model files required for translation, if they are not already present, when the given conditions are met.

Returns
  • A Task that will be completed when the required files have been downloaded.

public Task<String> translate (String input)

Translates the given input from the source language into the target language. Source and target languages are provided in the options object that was used to get the instance.

Parameters
input A string in the source language
Returns
  • The translated string in the target language