Skip to content

Commit 1916101

Browse files
hive-botclaude
andcommitted
chore: re-enable document translation in the basic usage example
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 9ad2330 commit 1916101

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

‎examples/basic_usage/__main__.py‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Use of this source code is governed by an MIT
33
# license that can be found in the LICENSE file.
44

5+
import io
56
import deepl
67
import os
78

@@ -36,20 +37,19 @@ def main() -> None:
3637
ginfo: deepl.GlossaryInfo = deepl_client.create_glossary(
3738
"Test Glossary", "DE", "FR", {"Hallo": "Bonjour"}
3839
)
39-
# Translation from non-English sources is temporarily disabled.
40-
# with io.BytesIO() as output_file:
41-
# doc_status: deepl.DocumentStatus = deepl_client.translate_document(
42-
# "My example document",
43-
# output_file,
44-
# source_lang="DE",
45-
# target_lang="FR",
46-
# filename="example.txt",
47-
# glossary=ginfo,
48-
# )
49-
# doc_status.done
50-
# _ = deepl_client.translate_text_with_glossary(
51-
# ["Ich bin ein Beispielsatz.", "Ich bin noch ein Satz."], glossary=ginfo
52-
# )
40+
with io.BytesIO() as output_file:
41+
doc_status: deepl.DocumentStatus = deepl_client.translate_document(
42+
"My example document",
43+
output_file,
44+
source_lang="DE",
45+
target_lang="FR",
46+
filename="example.txt",
47+
glossary=ginfo,
48+
)
49+
doc_status.done
50+
_ = deepl_client.translate_text_with_glossary(
51+
["Ich bin ein Beispielsatz.", "Ich bin noch ein Satz."], glossary=ginfo
52+
)
5353

5454
print("Success")
5555

0 commit comments

Comments
 (0)