Reference documentation and code samples for the Cloud Translation V3 API class Google::Cloud::Translate::V3::Translation.
A single translation response.
Inherits
Object
Extended By
Google::Protobuf::MessageExts::ClassMethods
Includes
Google::Protobuf::MessageExts
Methods
#detected_language_code
defdetected_language_code()->::String
Returns
(::String) — The ISO-639 language code of source text in the initial request, detected
automatically, if no source language was passed within the initial
request. If the source language was passed, auto-detection of the language
does not occur and this field is empty.
#detected_language_code=
defdetected_language_code=(value)->::String
Parameter
value (::String) — The ISO-639 language code of source text in the initial request, detected
automatically, if no source language was passed within the initial
request. If the source language was passed, auto-detection of the language
does not occur and this field is empty.
Returns
(::String) — The ISO-639 language code of source text in the initial request, detected
automatically, if no source language was passed within the initial
request. If the source language was passed, auto-detection of the language
does not occur and this field is empty.
(::String) — Only present when model is present in the request.
model here is normalized to have project number.
For example:
If the model requested in TranslationTextRequest is
projects/{project-id}/locations/{location-id}/models/general/nmt then
model here would be normalized to
projects/{project-number}/locations/{location-id}/models/general/nmt.
#model=
defmodel=(value)->::String
Parameter
value (::String) — Only present when model is present in the request.
model here is normalized to have project number.
For example:
If the model requested in TranslationTextRequest is
projects/{project-id}/locations/{location-id}/models/general/nmt then
model here would be normalized to
projects/{project-number}/locations/{location-id}/models/general/nmt.
Returns
(::String) — Only present when model is present in the request.
model here is normalized to have project number.
For example:
If the model requested in TranslationTextRequest is
projects/{project-id}/locations/{location-id}/models/general/nmt then
model here would be normalized to
projects/{project-number}/locations/{location-id}/models/general/nmt.
#translated_text
deftranslated_text()->::String
Returns
(::String) — Text translated into the target language.
If an error occurs during translation, this field might be excluded from
the response.
#translated_text=
deftranslated_text=(value)->::String
Parameter
value (::String) — Text translated into the target language.
If an error occurs during translation, this field might be excluded from
the response.
Returns
(::String) — Text translated into the target language.
If an error occurs during translation, this field might be excluded from
the response.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["# Cloud Translation V3 API - Class Google::Cloud::Translate::V3::Translation (v1.5.2)\n\nVersion latestkeyboard_arrow_down\n\n- [1.5.2 (latest)](/ruby/docs/reference/google-cloud-translate-v3/latest/Google-Cloud-Translate-V3-Translation)\n- [1.5.1](/ruby/docs/reference/google-cloud-translate-v3/1.5.1/Google-Cloud-Translate-V3-Translation)\n- [1.4.1](/ruby/docs/reference/google-cloud-translate-v3/1.4.1/Google-Cloud-Translate-V3-Translation)\n- [1.3.0](/ruby/docs/reference/google-cloud-translate-v3/1.3.0/Google-Cloud-Translate-V3-Translation)\n- [1.2.0](/ruby/docs/reference/google-cloud-translate-v3/1.2.0/Google-Cloud-Translate-V3-Translation)\n- [1.1.1](/ruby/docs/reference/google-cloud-translate-v3/1.1.1/Google-Cloud-Translate-V3-Translation)\n- [1.0.0](/ruby/docs/reference/google-cloud-translate-v3/1.0.0/Google-Cloud-Translate-V3-Translation)\n- [0.12.0](/ruby/docs/reference/google-cloud-translate-v3/0.12.0/Google-Cloud-Translate-V3-Translation)\n- [0.11.2](/ruby/docs/reference/google-cloud-translate-v3/0.11.2/Google-Cloud-Translate-V3-Translation)\n- [0.10.0](/ruby/docs/reference/google-cloud-translate-v3/0.10.0/Google-Cloud-Translate-V3-Translation)\n- [0.9.0](/ruby/docs/reference/google-cloud-translate-v3/0.9.0/Google-Cloud-Translate-V3-Translation)\n- [0.8.0](/ruby/docs/reference/google-cloud-translate-v3/0.8.0/Google-Cloud-Translate-V3-Translation)\n- [0.7.3](/ruby/docs/reference/google-cloud-translate-v3/0.7.3/Google-Cloud-Translate-V3-Translation)\n- [0.6.0](/ruby/docs/reference/google-cloud-translate-v3/0.6.0/Google-Cloud-Translate-V3-Translation)\n- [0.5.2](/ruby/docs/reference/google-cloud-translate-v3/0.5.2/Google-Cloud-Translate-V3-Translation)\n- [0.4.2](/ruby/docs/reference/google-cloud-translate-v3/0.4.2/Google-Cloud-Translate-V3-Translation) \nReference documentation and code samples for the Cloud Translation V3 API class Google::Cloud::Translate::V3::Translation.\n\nA single translation response. \n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #detected_language_code\n\n def detected_language_code() -\u003e ::String\n\n**Returns**\n\n- (::String) --- The ISO-639 language code of source text in the initial request, detected automatically, if no source language was passed within the initial request. If the source language was passed, auto-detection of the language does not occur and this field is empty.\n\n### #detected_language_code=\n\n def detected_language_code=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- The ISO-639 language code of source text in the initial request, detected automatically, if no source language was passed within the initial request. If the source language was passed, auto-detection of the language does not occur and this field is empty. \n**Returns**\n\n- (::String) --- The ISO-639 language code of source text in the initial request, detected automatically, if no source language was passed within the initial request. If the source language was passed, auto-detection of the language does not occur and this field is empty.\n\n### #glossary_config\n\n def glossary_config() -\u003e ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig\n\n**Returns**\n\n- ([::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig](./Google-Cloud-Translate-V3-TranslateTextGlossaryConfig)) --- The `glossary_config` used for this translation.\n\n### #glossary_config=\n\n def glossary_config=(value) -\u003e ::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig\n\n**Parameter**\n\n- **value** ([::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig](./Google-Cloud-Translate-V3-TranslateTextGlossaryConfig)) --- The `glossary_config` used for this translation. \n**Returns**\n\n- ([::Google::Cloud::Translate::V3::TranslateTextGlossaryConfig](./Google-Cloud-Translate-V3-TranslateTextGlossaryConfig)) --- The `glossary_config` used for this translation.\n\n### #model\n\n def model() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Only present when `model` is present in the request. `model` here is normalized to have project number.\n\n\n For example:\n If the `model` requested in TranslationTextRequest is\n `projects/{project-id}/locations/{location-id}/models/general/nmt` then\n `model` here would be normalized to\n `projects/{project-number}/locations/{location-id}/models/general/nmt`.\n\n### #model=\n\n def model=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- Only present when `model` is present in the request. `model` here is normalized to have project number.\n\n\n For example:\n If the `model` requested in TranslationTextRequest is\n `projects/{project-id}/locations/{location-id}/models/general/nmt` then\n `model` here would be normalized to\n`projects/{project-number}/locations/{location-id}/models/general/nmt`. \n**Returns**\n\n- (::String) --- Only present when `model` is present in the request. `model` here is normalized to have project number.\n\n\n For example:\n If the `model` requested in TranslationTextRequest is\n `projects/{project-id}/locations/{location-id}/models/general/nmt` then\n `model` here would be normalized to\n `projects/{project-number}/locations/{location-id}/models/general/nmt`.\n\n### #translated_text\n\n def translated_text() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Text translated into the target language. If an error occurs during translation, this field might be excluded from the response.\n\n### #translated_text=\n\n def translated_text=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- Text translated into the target language. If an error occurs during translation, this field might be excluded from the response. \n**Returns**\n\n- (::String) --- Text translated into the target language. If an error occurs during translation, this field might be excluded from the response."]]