Reference documentation and code samples for the Cloud Translation V2 API class Google::Cloud::Translate::V2::Translation.
Translation
Represents a translation query result. Returned by Api#translate.
Inherits
- Object
Example
require "google/cloud/translate/v2" translate = Google::Cloud::Translate::V2.new translation = translate.translate "Hello world!", to: "la" translation.to_s #=> "Salve mundi!" translation.from #=> "en" translation.origin #=> "Hello world!" translation.to #=> "la" translation.text #=> "Salve mundi!"
Methods
#detected?
def detected?() -> Boolean
Determines if the source language was detected by the Google Cloud Cloud Translation API.
-
(Boolean) —
true
if the source language was detected by the Cloud Translation API,false
if the source language was provided in the request
#from
def from() -> String
The source language from which the text was translated.
- (String)
#language
def language() -> String
The target language into which the text was translated.
- (String)
#model
def model() -> String
The translation model. Can be either base
for the Phrase-Based Machine Translation (PBMT) model, or nmt
for the Neural Machine Translation (NMT) model. If you did not include a model parameter with your request,
then this field is not included in the response.
- (String)
#origin
def origin() -> String
The original query text that was translated.
- (String)
#source
def source() -> String
The source language from which the text was translated.
- (String)
#target
def target() -> String
The target language into which the text was translated.
- (String)
#text
def text() -> String
The translated result.
- (String)
#to
def to() -> String
The target language into which the text was translated.
- (String)
#to_s
def to_s() -> String
The translated result.
- (String)
#to_str
def to_str() -> String
The translated result.
- (String)