translation options
Available in REST API Version 2 and later.This controls how recognised speech is translated.
Used in class call translation options
The language codes are those of the text, such as "en"
for English or "es"
for Spanish.
Use a language code from the Translation Languages page.
Normally, the source language
can be determined from the corresponding speech recognition language. However, not all
speech recognition languages can be translated.
Similarly, when used in a
call translation options
object, the target language
can usually be derived from the TTS voice used. Some voices can speak more
than one language and the default language for the voice will be used unless a target language
is specified.
There are also some voices that expect a language that is not supported.
language wrappers and examples
It contains the following properties:
Property | Required/Optional | Default | Description |
---|---|---|---|
source language | optional | - | The language code of the source text. The default is based on the language specified in the corresponding speech recognition options. |
target language | action dependent | - | The language code to translate the recognised speech in to. When used in a call translation options object, the target language can usually be derived from the TTS voice used. This property is required in other cases. |
-
Examples:
-
Create a translation options object with a target language:
{ "target_language" : "es" }
-
Create a translation options object with a source language and a target language:
{ "source_language" : "en", "target_language" : "es" }
-
-
TranslationOptions Class
Namespace: Aculab.Cloud.RestAPIWrapper
Assembly: Aculab.Cloud.RestAPIWrapper.dllA class representing the options used to translate between languages and is used by the call translation options object.
-
public class TranslationOptions { // Constructors public TranslationOptions(string sourceLanguage = null, string targetLanguage = null); // Members public string SourceLanguage; public string TargetLanguage; }
Examples:
-
Create a translation options object with a target language:
var translationOptions = new TranslationOptions() { TargetLanguage = "es" };
-
Create a translation options object with a source language and a target language:
var translationOptions = new TranslationOptions() { SourceLanguage = "en", TargetLanguage = "es" };
-
-
public class TranslationOptions { // Constructors public TranslationOptions(string sourceLanguage = null, string targetLanguage = null); // Members public string SourceLanguage; public string TargetLanguage; }
Examples:
-
Create a translation options object with a target language:
var translationOptions = new TranslationOptions() { TargetLanguage = "es" };
-
Create a translation options object with a source language and a target language:
var translationOptions = new TranslationOptions() { SourceLanguage = "en", TargetLanguage = "es" };
-
-
public class TranslationOptions { // Constructors public TranslationOptions(string sourceLanguage = null, string targetLanguage = null); // Members public string SourceLanguage; public string TargetLanguage; }
Examples:
-
Create a translation options object with a target language:
var translationOptions = new TranslationOptions() { TargetLanguage = "es" };
-
Create a translation options object with a source language and a target language:
var translationOptions = new TranslationOptions() { SourceLanguage = "en", TargetLanguage = "es" };
-
-
-
TranslationOptions Class
Namespace: Aculab.Cloud.RestAPIWrapper
Assembly: Aculab.Cloud.RestAPIWrapper.dllA class representing the options used to translate between languages and is used by the call translation options object.
-
Public Class TranslationOptions ' Constructors Public Sub New (Optional sourceLanguage As String = Nothing, Optional targetLanguage As String = Nothing) ' Members Public Property SourceLanguage As String Public Property TargetLanguage As String End Class
Examples:
-
Create a translation options object with a target language
Dim translationOptions = New TranslationOptions(targetLanguage:="es")
-
Create a translation options object with a source language and a target language
Dim translationOptions = New TranslationOptions() With { .SourceLanguage = "en", .TargetLanguage = "es" }
-
-
Public Class TranslationOptions ' Constructors Public Sub New (Optional sourceLanguage As String = Nothing, Optional targetLanguage As String = Nothing) ' Members Public Property SourceLanguage As String Public Property TargetLanguage As String End Class
Examples:
-
Create a translation options object with a target language
Dim translationOptions = New TranslationOptions(targetLanguage:="es")
-
Create a translation options object with a source language and a target language
Dim translationOptions = New TranslationOptions() With { .SourceLanguage = "en", .TargetLanguage = "es" }
-
-
-
class TranslationOptions extends JSONElement
Represents the Translation Options support class.
Class synopsis:
// Constructors: public TranslationOptions() // Members: public void setSourceLanguage(String sourceLanguage) public void setTargetLanguage(String targetLanguage)
Examples:
-
Create a translation options object with a target language:
TranslationOptions translationOpts = new TranslationOptions(); translationOpts.setTargetLanguage("es");
-
Create a translation options object with a source language and a target language:
TranslationOptions translationOpts = new TranslationOptions(); translationOpts.setSourceLanguage("en"); translationOpts.setTargetLanguage("es");
-
-
class TranslationOptions
Represents the Translation Options support class.
Class synopsis:
# TranslationOptions object: TranslationOptions() # Instance methods: TranslationOptions.set_source_language(source_language) TranslationOptions.set_target_language(target_language)
Examples:
-
Create a translation options object with a target language:
translationOpts = TranslationOptions() translationOpts.set_target_language("es")
-
Create a translation options object with a source language and a target language:
translationOpts = TranslationOptions() translationOpts.set_source_language("en") translationOpts.set_target_language("es")
-
-
The TranslationOptions class
Introduction
Represents the translation options.
Class synopsis
class TranslationOptions { /* methods */ public __construct() public self setSourceLanguage(string $language) public self setTargetLanguage(string $language) }
Examples:
Create a translation options object with a target language:
$translation_options = new Aculab\TelephonyRestAPI\TranslationOptions(); $translation_options->setTargetLanguage('es');
Create a translation options object with a source language and a target language:
$translation_options = new Aculab\TelephonyRestAPI\TranslationOptions(); $translation_options->setSourceLanguage('en') ->setTargetLanguage('es');