translate_lang() — fastapi Function Reference
Architecture documentation for the translate_lang() function in translate.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD a668556d_47cb_523f_1e1d_60be6b0d8519["translate_lang()"] 6dda5e35_b655_8af3_cd89_8c1584a092c4["translate.py"] a668556d_47cb_523f_1e1d_60be6b0d8519 -->|defined in| 6dda5e35_b655_8af3_cd89_8c1584a092c4 bc2c2b41_a3df_bfc0_e27e_63cb9f8d8f0a["iter_en_paths_to_translate()"] a668556d_47cb_523f_1e1d_60be6b0d8519 -->|calls| bc2c2b41_a3df_bfc0_e27e_63cb9f8d8f0a 08ab58ed_fb84_c0ad_0e2e_b521607ca3c9["generate_lang_path()"] a668556d_47cb_523f_1e1d_60be6b0d8519 -->|calls| 08ab58ed_fb84_c0ad_0e2e_b521607ca3c9 fde1dac0_2ec7_f895_3237_c5b8350a5417["translate_page()"] a668556d_47cb_523f_1e1d_60be6b0d8519 -->|calls| fde1dac0_2ec7_f895_3237_c5b8350a5417 style a668556d_47cb_523f_1e1d_60be6b0d8519 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/translate.py lines 184–209
def translate_lang(language: Annotated[str, typer.Option(envvar="LANGUAGE")]) -> None:
paths_to_process = list(iter_en_paths_to_translate())
print("Original paths:")
for p in paths_to_process:
print(f" - {p}")
print(f"Total original paths: {len(paths_to_process)}")
missing_paths: list[Path] = []
skipped_paths: list[Path] = []
for p in paths_to_process:
lang_path = generate_lang_path(lang=language, path=p)
if lang_path.exists():
skipped_paths.append(p)
continue
missing_paths.append(p)
print("Paths to skip:")
for p in skipped_paths:
print(f" - {p}")
print(f"Total paths to skip: {len(skipped_paths)}")
print("Paths to process:")
for p in missing_paths:
print(f" - {p}")
print(f"Total paths to process: {len(missing_paths)}")
for p in missing_paths:
print(f"Translating: {p}")
translate_page(language="es", en_path=p)
print(f"Done translating: {p}")
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does translate_lang() do?
translate_lang() is a function in the fastapi codebase, defined in scripts/translate.py.
Where is translate_lang() defined?
translate_lang() is defined in scripts/translate.py at line 184.
What does translate_lang() call?
translate_lang() calls 3 function(s): generate_lang_path, iter_en_paths_to_translate, translate_page.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free