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

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

Int

Request flags.

MutableList<TranslationRequestValue!>

List of TranslationRequestValues to be translated.

MutableList<ViewTranslationRequest!>

List of ViewTranslationRequests to be translated.

String

Returns a string representation of the object.

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 the following:

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 the following:
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 the following:

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 the following:

Value: 4

Public methods

describeContents

Added in API level 31
fun describeContents(): Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

getFlags

Added in API level 31
fun getFlags(): Int

Request flags. FLAG_TRANSLATION_RESULT by default.

Return
Int Value is either 0 or a combination of the following:

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

Returns a string representation of the object.

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 the following:

Properties

CREATOR

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