Show / Hide Table of Contents

Interface ITranslatorSession

Represents an active translation session with a fixed language pair and configuration.

Inherited Members
IDisposable.Dispose()
Namespace: Zaya.Translator.Services
Assembly: Zaya.Translator.dll
Syntax
public interface ITranslatorSession : IDisposable

Methods

| Edit this page View Source

TranslateAsync(IReadOnlyList<string>, CancellationToken)

Translates a batch of texts to the target language configured at session creation.

Declaration
Task<IReadOnlyList<string>> TranslateAsync(IReadOnlyList<string> texts, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IReadOnlyList<string> texts

The texts to translate. Must not be null.

CancellationToken cancellationToken

Token to cancel the translation operation.

Returns
Type Description
Task<IReadOnlyList<string>>

The translated texts in the same order.

Exceptions
Type Condition
ArgumentNullException

Thrown if texts is null.

| Edit this page View Source

TranslateAsync(string, CancellationToken)

Translates the specified text to the target language configured at session creation.

Declaration
Task<string> TranslateAsync(string text, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string text

The text to translate. Must not be null.

CancellationToken cancellationToken

Token to cancel the translation operation.

Returns
Type Description
Task<string>

The translated text.

Exceptions
Type Condition
ArgumentNullException

Thrown if text is null.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX