public translate ( string $string, array $options = [] ) : array | null | ||
$string | string | The string to translate. |
$options | array | [optional] { Configuration Options. @type string $source The source language to translate from. Must be a valid ISO 639-1 language code. If not provided the value will be automatically detected by the server. @type string $target The target language to translate to. Must be a valid ISO 639-1 language code. **Defaults to** the value assigned to the client (`"en"` by default). @type string $format Indicates whether the string to be translated is either plain-text or HTML. Acceptable values are `html` or `text`. **Defaults to** `"html"`. @type string $model The model to use for the translation request. May be `nmt` or `base`. **Defaults to** an empty string. } |
return | array | null | A translation result including a `source` key containing the detected or provided langauge of the provided input, an `input` key containing the original string, and a `text` key containing the translated result. |