TranslateAndDetect Method (String, String, String)

Google API

Translate the text to to and auto detect which language the text is from.

Namespace:  Google.API.Translate
Assembly:  GoogleTranslateAPI (in GoogleTranslateAPI.dll) Version: 0.3.1.107 (0.3.1.107)

Syntax

C#
public string TranslateAndDetect(
	string text,
	string to,
	out string from
)
Visual Basic (Declaration)
Public Function TranslateAndDetect ( _
	text As String, _
	to As String, _
	<OutAttribute> ByRef from As String _
) As String
Visual C++
public:
String^ TranslateAndDetect(
	String^ text, 
	String^ to, 
	[OutAttribute] String^% from
)

Parameters

text
Type: System..::.String
The content to translate.
to
Type: System..::.String
The target language you want to translate to.
from
Type: System..::.String %
The detected language of the original text.

Return Value

The translate result.

Examples

This is the c# code example.
CopyC#
string text = "Je t'aime.";
string from;
TranslateClient client = new TranslateClient(/* Enter the URL of your site here */);
string translated = client.TranslateAndDetect(text, Language.English, out from);
Language fromLanguage = from;
Console.WriteLine("\"{0}\" is \"{1}\" in {2}", text, translated, fromLanguage);
// "Je t'aime." is "I love you." in French.

Exceptions

Exception Condition
Google.API..::.GoogleAPIException Translate failed.

See Also