Translation
Namespace: Wisej.Ext.Translation
Assembly: Wisej.Ext.Translation
The Translation component interfaces with several third party translation providers to provide language translation services to the application.
- C#
- VB.NET
public class Translation : Component
Public Class Translation
Inherits Component
Constructors
Translation()
Initializes a new instance of the Translation class.
Translation(container)
Initializes a new instance of the Translation class together with the specified container.
| Name | Type | Description |
|---|---|---|
| container | IContainer | A IContainer that represents the container for the component. |
Properties
ClientID
String: The client-id for the provider.
ClientSecret
String: The secret client-key or api-key for the provider.
Provider
TranslationProviderBase: Returns or sets the translation provider implementation.
ProviderType
String: Returns or sets the type of the translation provider.
Methods
Translate(text, from, to)
Translates the text to the requested language.
| Parameter | Type | Description |
|---|---|---|
| text | String | The text to translate. |
| from | String | The source language ("en", "de", ...) or null/empty to ask the provider to autodetect the source language. |
| to | String | The target language ("en", "de", ...) |
Returns: TranslationResult.
TranslateAsync(text, from, to, resultCallback)
Invokes the translation service provider asynchronously and returns the result of the request in an instance of the TranslationResult class.
| Parameter | Type | Description |
|---|---|---|
| text | String | The text to translate. |
| from | String | The source language ("en", "de", ...) or null/empty to ask the provider to auto detect the source language. |
| to | String | The target language ("en", "de", ...) |
| resultCallback | Action<TranslationResult> | Callback method that will receive the TranslationResult when ready. |