Added in API level 31

TranslationRequest

class TranslationRequest : Parcelable
kotlin.Any
   ↳ android.view.translation.TranslationRequest

Translation request sent to the translation service by the android.view.translation.Translator which contains the text to be translated.

Summary

Nested classes

A builder for TranslationRequest

Constants
static Int

Indicates this request wants to receive the dictionary result.

static Int

Indicates this request is willing to accept partial responses.

static Int

Indicates this request wants to receive the standard translation result.

static Int

Indicates this request wants to receive the transliteration result.

Inherited constants
Public methods
Int

Int

Request flags.

MutableList<TranslationRequestValue!>

List of TranslationRequestValues to be translated.

MutableList<ViewTranslationRequest!>

List of ViewTranslationRequests to be translated.

String

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<TranslationRequest!>

Constants

FLAG_DICTIONARY_RESULT

Added in API level 31
static val FLAG_DICTIONARY_RESULT: Int

Indicates this request wants to receive the dictionary result.

See TranslationResponseValue#EXTRA_DEFINITIONS for more detail on the structure of the returned data.
Value is either 0 or a combination of android.view.translation.TranslationRequest#FLAG_TRANSLATION_RESULT, android.view.translation.TranslationRequest#FLAG_DICTIONARY_RESULT, android.view.translation.TranslationRequest#FLAG_TRANSLITERATION_RESULT, and android.view.translation.TranslationRequest#FLAG_PARTIAL_RESPONSES

Value: 2

FLAG_PARTIAL_RESPONSES

Added in API level 31
static val FLAG_PARTIAL_RESPONSES: Int

Indicates this request is willing to accept partial responses.

The partial responses can be accessed by TranslationResponse#getTranslationResponseValues() or TranslationResponse#getViewTranslationResponses(). These responses will each contain only a subset of the corresponding translated values.

The are no guarantees to the number of translated values or the order in which these values are returned in the TranslationResponse.

This flag denotes the client can expect multiple partial responses, but there may not necessarily be multiple responses.


Value is either 0 or a combination of android.view.translation.TranslationRequest#FLAG_TRANSLATION_RESULT, android.view.translation.TranslationRequest#FLAG_DICTIONARY_RESULT, android.view.translation.TranslationRequest#FLAG_TRANSLITERATION_RESULT, and android.view.translation.TranslationRequest#FLAG_PARTIAL_RESPONSES
Value: 8

FLAG_TRANSLATION_RESULT

Added in API level 31
static val FLAG_TRANSLATION_RESULT: Int

Indicates this request wants to receive the standard translation result.
Value is either 0 or a combination of android.view.translation.TranslationRequest#FLAG_TRANSLATION_RESULT, android.view.translation.TranslationRequest#FLAG_DICTIONARY_RESULT, android.view.translation.TranslationRequest#FLAG_TRANSLITERATION_RESULT, and android.view.translation.TranslationRequest#FLAG_PARTIAL_RESPONSES

Value: 1

FLAG_TRANSLITERATION_RESULT

Added in API level 31
static val FLAG_TRANSLITERATION_RESULT: Int

Indicates this request wants to receive the transliteration result.

This returns a CharSequence representation of the transliteration of the translated text. See TranslationResponseValue#getTransliteration().
Value is either 0 or a combination of android.view.translation.TranslationRequest#FLAG_TRANSLATION_RESULT, android.view.translation.TranslationRequest#FLAG_DICTIONARY_RESULT, android.view.translation.TranslationRequest#FLAG_TRANSLITERATION_RESULT, and android.view.translation.TranslationRequest#FLAG_PARTIAL_RESPONSES

Value: 4

Public methods

describeContents

Added in API level 31
fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getTranslationRequestValues

Added in API level 31
fun getTranslationRequestValues(): MutableList<TranslationRequestValue!>

List of TranslationRequestValues to be translated. The index of entries in this list will be their respective key in the android.util.SparseArray returned by calling TranslationResponse#getTranslationResponseValues().

Return
MutableList<TranslationRequestValue!> This value cannot be null.

getViewTranslationRequests

Added in API level 31
fun getViewTranslationRequests(): MutableList<ViewTranslationRequest!>

List of ViewTranslationRequests to be translated. The index of entries in this list will be their respective key in the android.util.SparseArray returned by calling TranslationResponse#getViewTranslationResponses().

Return
MutableList<ViewTranslationRequest!> This value cannot be null.

toString

Added in API level 31
fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 31
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 31
static val CREATOR: Parcelable.Creator<TranslationRequest!>