class TranslationRequest : Parcelable

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

From class Parcelable

Int CONTENTS_FILE_DESCRIPTOR

Descriptor bit used with describeContents(): indicates that the Parcelable object's flattened representation includes a file descriptor.

Int PARCELABLE_WRITE_RETURN_VALUE

Flag for use with writeToParcel: the object being written is a return value, that is the result of a function such as "Parcelable someFunction()", "void someFunction(out Parcelable)", or "void someFunction(inout Parcelable)". Some implementations may want to release resources at this point.

Public methods
Int

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

Int

getFlags()

Request flags.

MutableList<TranslationRequestValue!>

List of TranslationRequestValues to be translated.

MutableList<ViewTranslationRequest!>

List of ViewTranslationRequests to be translated.

String

toString()

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

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

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

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

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

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(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

fun getFlags(): Int

Request flags. FLAG_TRANSLATION_RESULT by default.

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

toString

fun toString(): String

Returns a string representation of the object.

Return
String a string representation of the object.

Properties

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-02-26 UTC.