Skip to content

Commit

Permalink
feat(translation): add backward compatibility for side-by-side dual P…
Browse files Browse the repository at this point in the history
…DF option
  • Loading branch information
awwaawwa committed Feb 25, 2025
1 parent ef4a7a3 commit 59edfb2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions babeldoc/translation_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(
enhance_compatibility: bool = False, # 增强兼容性模式
report_interval: float = 0.1, # Progress report interval in seconds
min_text_length: int = 5, # Minimum text length to translate
use_side_by_side_dual: bool = True, # 是否使用拼版式双语 PDF(并排显示原文和译文) 向下兼容选项,已停用。
use_alternating_pages_dual: bool = False, # 是否使用交替页式双语 PDF(交替显示原文和译文)
):
self.input_file = input_file
Expand Down Expand Up @@ -64,6 +65,11 @@ def __init__(
self.report_interval = report_interval
self.min_text_length = min_text_length
self.use_alternating_pages_dual = use_alternating_pages_dual

# for backward compatibility
if use_side_by_side_dual is False and use_alternating_pages_dual is False:
self.use_alternating_pages_dual = True

if progress_monitor:
if progress_monitor.cancel_event is None:
progress_monitor.cancel_event = threading.Event()
Expand Down

0 comments on commit 59edfb2

Please sign in to comment.