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

Object
clone()
boolean
equals(Object arg0)
void
finalize()
final Class<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()
abstract void
close()
abstract void
close()

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

Firebase gives you the tools and infrastructure you need to build better mobile and web apps, improve app quality, and grow your business.

Updated Aug 14, 2020