Class: Google::Apis::TranslateV3::Translation
- Inherits:
-
Object
- Object
- Google::Apis::TranslateV3::Translation
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- lib/google/apis/translate_v3/classes.rb,
lib/google/apis/translate_v3/representations.rb,
lib/google/apis/translate_v3/representations.rb
Overview
A single translation response.
Instance Attribute Summary collapse
-
#detected_language_code ⇒ 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.
-
#glossary_config ⇒ Google::Apis::TranslateV3::TranslateTextGlossaryConfig
Configures which glossary is used for a specific target language and defines options for applying that glossary.
-
#model ⇒ String
Only present when
model
is present in the request. -
#translated_text ⇒ String
Text translated into the target language.
Instance Method Summary collapse
-
#initialize(**args) ⇒ Translation
constructor
A new instance of Translation.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ Translation
Returns a new instance of Translation.
1896 1897 1898 |
# File 'lib/google/apis/translate_v3/classes.rb', line 1896 def initialize(**args) update!(**args) end |
Instance Attribute Details
#detected_language_code ⇒ 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.
Corresponds to the JSON property detectedLanguageCode
1873 1874 1875 |
# File 'lib/google/apis/translate_v3/classes.rb', line 1873 def detected_language_code @detected_language_code end |
#glossary_config ⇒ Google::Apis::TranslateV3::TranslateTextGlossaryConfig
Configures which glossary is used for a specific target language and defines
options for applying that glossary.
Corresponds to the JSON property glossaryConfig
1879 1880 1881 |
# File 'lib/google/apis/translate_v3/classes.rb', line 1879 def glossary_config @glossary_config end |
#model ⇒ 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
.
Corresponds to the JSON property model
1888 1889 1890 |
# File 'lib/google/apis/translate_v3/classes.rb', line 1888 def model @model end |
#translated_text ⇒ String
Text translated into the target language. If an error occurs during
translation, this field might be excluded from the response.
Corresponds to the JSON property translatedText
1894 1895 1896 |
# File 'lib/google/apis/translate_v3/classes.rb', line 1894 def translated_text @translated_text end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
1901 1902 1903 1904 1905 1906 |
# File 'lib/google/apis/translate_v3/classes.rb', line 1901 def update!(**args) @detected_language_code = args[:detected_language_code] if args.key?(:detected_language_code) @glossary_config = args[:glossary_config] if args.key?(:glossary_config) @model = args[:model] if args.key?(:model) @translated_text = args[:translated_text] if args.key?(:translated_text) end |