Assets/Watson/Scripts/Services/LanguageTranslation/LanguageTranslation.cs
/// <summary>
/// Translate the provided text using the specified model.
/// </summary>
/// <param name="text">The text to translate.</param>
/// <param name="model_id">The ID of the model to use.</param>
/// <param name="callback">The callback to receive the translated text.</param>
/// <returns>Returns true on success.</returns>
Translate the provided text using the specified model.
Translate the provided text using the specified model .
public bool GetTranslation(string text, string model_id, TranslateCallback callback)
        {
            if (string.IsNullOrEmpty(text))
                throw new ArgumentNullException("text");
            if (string.IsNullOrEmpty(model_id))
                throw new ArgumentNullException("model_id");
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters["model_id"] = model_id;
            parameters["text"] = new string[] { text };
            return GetTranslation(Json.Serialize(parameters), callback);
        }
public bool GetTranslation ( string text , string model_id , TranslateCallback callback ) { if ( string . IsNullOrEmpty ( text ) ) throw new ArgumentNullException ( " " ) ; if ( string . IsNullOrEmpty ( model_id ) ) throw new ArgumentNullException ( " " ) ; Dictionary < string , object > parameters = new Dictionary < string , object > ( ) ; parameters [ " " ] = model_id ; parameters [ " " ] = new string [ ] { text } ; return GetTranslation ( Json . Serialize ( parameters ) , callback ) ; }
Translate the provided text using the specified model.
Translate the provided text using the specified model .
Returns true on success.
Returns true on success .
text
string
The text to translate.
The text to translate .
model_id
string
The ID of the model to use.
The ID of the model to use .
callback
TranslateCallback
The callback to receive the translated text.
The callback to receive the translated text .