Skip to main content

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.

public class Translation : Component

Constructors

Instance memberTranslation()

Initializes a new instance of the Translation class.

Instance memberTranslation(container)

Initializes a new instance of the Translation class together with the specified container.

NameTypeDescription
containerIContainerA IContainer that represents the container for the component.

Properties

Instance memberClientID

String: The client-id for the provider.

Instance memberClientSecret

String: The secret client-key or api-key for the provider.

Instance memberProvider

TranslationProviderBase: Returns or sets the translation provider implementation.

Instance memberProviderType

String: Returns or sets the type of the translation provider.

Methods

Instance memberTranslate(text, from, to)

Translates the text to the requested language.

ParameterTypeDescription
textStringThe text to translate.
fromStringThe source language ("en", "de", ...) or null/empty to ask the provider to autodetect the source language.
toStringThe target language ("en", "de", ...)

Returns: TranslationResult.

Instance memberTranslateAsync(text, from, to, resultCallback)

Invokes the translation service provider asynchronously and returns the result of the request in an instance of the TranslationResult class.

ParameterTypeDescription
textStringThe text to translate.
fromStringThe source language ("en", "de", ...) or null/empty to ask the provider to auto detect the source language.
toStringThe target language ("en", "de", ...)
resultCallbackAction<TranslationResult>Callback method that will receive the TranslationResult when ready.