Synchronize chapter and navigation translations with Chinese prose indentation
This commit is contained in:
@@ -144,6 +144,7 @@ Output Format:
|
||||
"""
|
||||
id_map = {} # short_id -> entry_id
|
||||
lines = []
|
||||
title_notes = []
|
||||
|
||||
for i, item in enumerate(items, 1):
|
||||
short_id = f"#{i}"
|
||||
@@ -151,9 +152,18 @@ Output Format:
|
||||
|
||||
# Clean text (remove extra whitespace)
|
||||
text = re.sub(r'\s+', ' ', item.original_text).strip()
|
||||
if item.context and item.context.startswith('navigation-'):
|
||||
title_notes.append(f"{short_id}: {item.context}")
|
||||
lines.append(f"{short_id}: {text}")
|
||||
|
||||
return id_map, "\n".join(lines)
|
||||
if title_notes:
|
||||
instructions = ("Title context (instructions only; do not copy into translations):\n"
|
||||
"Translate Chapter N as 第N章, Part N as 第N部, and translate the title itself. "
|
||||
"Keep number/subtitle styling tokens in their original regions.\n"
|
||||
+ "\n".join(title_notes) + "\n\nSource units:\n")
|
||||
else:
|
||||
instructions = ""
|
||||
return id_map, instructions + "\n".join(lines)
|
||||
|
||||
def _parse_short_id_response(self, response: str, id_map: Dict[str, str]) -> Dict[str, str]:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user