Translate a Document

Contents
[ ]

Document translation is a frequently needed option in the age of high digitalization. Aspose.Words supports document translation using Google generative language models, which allows developers to translate texts content into more than 300 languages.

Use the Translate method to translate your documents into any language represented in the Language enumeration. Note that if the source document contains several languages, the Google AI-based model will be able to translate all supported languages. If the model cannot recognize the language in some text fragments, then you will be returned a document with these untranslated fragments and with the rest of the text translated.

The following code example shows how to use the Gemini 1.5 Flash model in Aspose.Words to translate a document into Arabic:


FAQ

  1. Q: Which languages can be translated with Aspose.Words AI?
    A: The translation feature uses Google generative language models, which support more than 300 languages. Any language listed in the Language enumeration can be specified as the target language.

  2. Q: Do I need an internet connection to translate a document?
    A: Yes. The translation request is sent to Google’s AI service, so a network connection is required for the Translate method to work.

  3. Q: Can I translate only a part of a document, such as a single section or paragraph?
    A: The Translate method works on the whole document. To translate only a portion, extract the desired nodes into a separate Document object, call Translate, and then replace the original nodes with the translated content.

  4. Q: What happens if the source document contains multiple languages?
    A: The AI model attempts to detect each language segment and translate it to the target language. Segments that cannot be recognized will remain untranslated, while the rest of the document will be translated.