Update IAutoTranslator interface

The IAutoTranslator interface has been expanded with new documentation. Further clarification has been added to the 'Translate' method including its parameters and return value. Additionally, documentation for the 'MaxCharacters' property and a new 'Error' property have been added.
This commit is contained in:
Ivandro Jao 2024-01-29 22:02:55 +00:00
parent c2a9faed0a
commit 0d495ab244

View File

@ -17,8 +17,14 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate
/// </summary>
string Url { get; }
/// <summary>
/// Represents an error message or description.
/// </summary>
string Error { get; set; }
/// <summary>
/// Gets the maximum number of characters that can be translated at once.
/// </summary>
int MaxCharacters { get; }
/// <summary>
@ -37,8 +43,14 @@ namespace Nikse.SubtitleEdit.Core.AutoTranslate
List<TranslationPair> GetSupportedTargetLanguages();
/// <summary>
/// Do translation.
/// Translates the given text from the source language to the target language.
/// </summary>
/// <param name="text">The text to be translated.</param>
/// <param name="sourceLanguageCode">The language code of the source language.</param>
/// <param name="targetLanguageCode">The language code of the target language.</param>
/// <param name="cancellationToken">The cancellation token to cancel the translation process.</param>
/// <returns>A task that represents the asynchronous translation operation.
/// The task result contains the translated text.</returns>
Task<string> Translate(string text, string sourceLanguageCode, string targetLanguageCode, CancellationToken cancellationToken);
}
}