Translator Class

Wordize.AI.Translator class. Provides methods for AIpowered document translation.

Translator class

Provides methods for AI-powered document translation.

public class Translator : Processor

Methods

NameDescription
static Create(TranslatorContext)Creates new instance of the translator processor.
Execute()Execute the processor action.
From(Stream, LoadOptions)Specifies input document for processing.
From(string, LoadOptions)Specifies input document for processing.
To(List<Stream>, SaveFormat)Specifies output Document streams list.
To(List<Stream>, SaveOptions)Specifies output Document streams list.
To(Stream, SaveFormat)Specifies output stream for the processor.
To(Stream, SaveOptions)Specifies output stream for the processor.
To(string, SaveFormat)Specifies output file for the processor.
To(string, SaveOptions)Specifies output file for the processor.
static Translate(string, string, AiModelLanguage)Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating.
static Translate(Stream, Stream, SaveFormatAiModelLanguage)Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating.
static Translate(string, string, SaveFormatAiModelLanguage)Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating.
static TranslateToImages(Stream, ImageSaveOptionsAiModelLanguage)Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating.
static TranslateToImages(string, ImageSaveOptionsAiModelLanguage)Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating.

Examples

Shows how to create standard OpenAiModel and perform document translation.

string apiKey = Environment.GetEnvironmentVariable("GPT4OMINI_API_KEY", EnvironmentVariableTarget.User);
AiModel model = OpenAiModel.Create(AiModelType.Gpt4OMini, apiKey);

Translator.Translate(MyDir + "SimpleAI.docx", ArtifactsDir + "Translate.docx", model, Language.Ukrainian);

See Also