Browse Source

🔨 Tweak translation workflow and translation fixer tool (#15166)

pull/15156/head
Motov Yurii 3 months ago
committed by GitHub
parent
commit
9960db5abf
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      scripts/doc_parsing_utils.py
  2. 1
      scripts/translate.py

2
scripts/doc_parsing_utils.py

@ -17,7 +17,7 @@ MARKDOWN_LINK_RE = re.compile(
r"(?P<url>[^)\s]+)" # url (no spaces and `)`) r"(?P<url>[^)\s]+)" # url (no spaces and `)`)
r'(?:\s+["\'](?P<title>.*?)["\'])?' # optional title in "" or '' r'(?:\s+["\'](?P<title>.*?)["\'])?' # optional title in "" or ''
r"\)" r"\)"
r"(?:\s*\{(?P<attrs>[^}]*)\})?" # optional attributes in {} r"(?:\{(?P<attrs>[^}]*)\})?" # optional attributes in {}
) )
HTML_LINK_RE = re.compile(r"<a\s+[^>]*>.*?</a>") HTML_LINK_RE = re.compile(r"<a\s+[^>]*>.*?</a>")

1
scripts/translate.py

@ -142,7 +142,6 @@ def translate_page(
continue # Retry if not reached max attempts continue # Retry if not reached max attempts
else: # Max retry attempts reached else: # Max retry attempts reached
print(f"Translation failed for {out_path} after {MAX_ATTEMPTS} attempts") print(f"Translation failed for {out_path} after {MAX_ATTEMPTS} attempts")
raise typer.Exit(code=1)
print(f"Saving translation to {out_path}") print(f"Saving translation to {out_path}")
out_path.write_text(out_content, encoding="utf-8", newline="\n") out_path.write_text(out_content, encoding="utf-8", newline="\n")

Loading…
Cancel
Save