Translator.Translate
Translate(string, string, AiModel, Language)
Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating.
public static void Translate(string inputFile, string outputFile, AiModel model, Language language)
Parameter | Type | Description |
---|---|---|
inputFile | String | The input file name. |
outputFile | String | The output file name. |
model | AiModel | Specifies the AI model responsible for generating the summary of a document. |
language | Language | The target language for AI-powered text translation. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
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
- class AiModel
- enum Language
- class Translator
- namespace Wordize.AI
- assembly Wordize
Translate(string, string, SaveFormat, AiModel, Language)
Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating.
public static void Translate(string inputFile, string outputFile, SaveFormat saveFormat,
AiModel model, Language language)
Parameter | Type | Description |
---|---|---|
inputFile | String | The input file name. |
outputFile | String | The output file name. |
saveFormat | SaveFormat | The save format. |
model | AiModel | Specifies the AI model responsible for generating the summary of a document. |
language | Language | The target language for AI-powered text translation. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
See Also
- enum SaveFormat
- class AiModel
- enum Language
- class Translator
- namespace Wordize.AI
- assembly Wordize
Translate(Stream, Stream, SaveFormat, AiModel, Language)
Translates the provided document into the specified target language. This operation leverages the connected AI model for content translating.
public static void Translate(Stream inputStream, Stream outputStream, SaveFormat saveFormat,
AiModel model, Language language)
Parameter | Type | Description |
---|---|---|
inputStream | Stream | The input stream. |
outputStream | Stream | The output stream. |
saveFormat | SaveFormat | The save format. |
model | AiModel | Specifies the AI model responsible for generating the summary of a document. |
language | Language | The target language for AI-powered text translation. |
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
See Also
- enum SaveFormat
- class AiModel
- enum Language
- class Translator
- namespace Wordize.AI
- assembly Wordize