Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translate_document_from_filepath fails to recognise XML files #102

Closed
MasonLyons opened this issue Apr 9, 2024 · 1 comment
Closed

translate_document_from_filepath fails to recognise XML files #102

MasonLyons opened this issue Apr 9, 2024 · 1 comment

Comments

@MasonLyons
Copy link

When trying to translate an xml document using the translate_document_from_filepath method an error is returned.

import deepl

input_filename = "test.xml"
source_language = "en"
output_filename = "test_out.xml"
output_language = "es"

translator = deepl.Translator(auth_key)
translator.translate_document_from_filepath(
    input_path=input_filename,
    output_path=output_filename,
    source_lang=source_language,
    target_lang=output_language,
)

Bad request, message: Failed to get the document_type from the file extension (test.xml).

@JanEbbing
Copy link
Member

JanEbbing commented Apr 9, 2024

Document translation does not support xml files, you would need to send it as a text translation request by using XML tag handling. See docs for document translation and XML tag handling (or check the README of this project regarding tag handling).

Edit: That said, we support HTML - I will check with the team if we can expand coverage here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants