|
| Google Translate API Documentation |
| TranslateClient..::.Translate Method (String, String, String, String) |
| TranslateClient Class Example See Also Send Feedback |
Translate the text from from to to.
Namespace:
Google.API.Translate
Assembly:
GoogleTranslateAPI (in GoogleTranslateAPI.dll) Version: 0.3.1.107 (0.3.1.107)
Syntax
| C# |
|---|
public string Translate( string text, string from, string to, string format ) |
| Visual Basic (Declaration) |
|---|
Public Function Translate ( _ text As String, _ from As String, _ to As String, _ format As String _ ) As String |
| Visual C++ |
|---|
public: String^ Translate( String^ text, String^ from, String^ to, String^ format ) |
Parameters
- text
- Type: System..::.String
The content to translate.
- from
- Type: System..::.String
The language of the original text. You can set it as Language.Unknown to the auto detect it.
- to
- Type: System..::.String
The target language you want to translate to.
- format
- Type: System..::.String
The format of the text.
Return Value
The translate result.
Examples
This is the c# code example.
CopyC#
string text = GetYourHtmlString(); TranslateClient client = new TranslateClient(/* Enter the URL of your site here */); string translated = client.Translate(text, Language.English, Language.French, TranslateFormat.Html);
Exceptions
| Exception | Condition |
|---|---|
| Google.API..::.GoogleAPIException | Translate failed. |
