Interface ITranslatorSession
Represents an active translation session with a fixed language pair and configuration.
Inherited Members
Namespace: Zaya.Translator.Services
Assembly: Zaya.Translator.dll
Syntax
public interface ITranslatorSession : IDisposable
Methods
| Edit this page View SourceTranslateAsync(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 |
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 |