mirror of
https://github.com/fastapi/fastapi.git
synced 2026-03-27 19:22:51 -04:00
📝 Add documentation for non-translated pages and scripts to verify them (#12020)
This commit is contained in:
committed by
GitHub
parent
75705617a6
commit
85bd4067c2
@@ -26,6 +26,15 @@ missing_translation_snippet = """
|
||||
{!../../../docs/missing-translation.md!}
|
||||
"""
|
||||
|
||||
non_translated_sections = [
|
||||
"reference/",
|
||||
"release-notes.md",
|
||||
"external-links.md",
|
||||
"newsletter.md",
|
||||
"management-tasks.md",
|
||||
"management.md",
|
||||
]
|
||||
|
||||
docs_path = Path("docs")
|
||||
en_docs_path = Path("docs/en")
|
||||
en_config_path: Path = en_docs_path / mkdocs_name
|
||||
@@ -333,10 +342,34 @@ def verify_config() -> None:
|
||||
typer.echo("Valid mkdocs.yml ✅")
|
||||
|
||||
|
||||
@app.command()
|
||||
def verify_non_translated() -> None:
|
||||
"""
|
||||
Verify there are no files in the non translatable pages.
|
||||
"""
|
||||
print("Verifying non translated pages")
|
||||
lang_paths = get_lang_paths()
|
||||
error_paths = []
|
||||
for lang in lang_paths:
|
||||
if lang.name == "en":
|
||||
continue
|
||||
for non_translatable in non_translated_sections:
|
||||
non_translatable_path = lang / "docs" / non_translatable
|
||||
if non_translatable_path.exists():
|
||||
error_paths.append(non_translatable_path)
|
||||
if error_paths:
|
||||
print("Non-translated pages found, remove them:")
|
||||
for error_path in error_paths:
|
||||
print(error_path)
|
||||
raise typer.Abort()
|
||||
print("No non-translated pages found ✅")
|
||||
|
||||
|
||||
@app.command()
|
||||
def verify_docs():
|
||||
verify_readme()
|
||||
verify_config()
|
||||
verify_non_translated()
|
||||
|
||||
|
||||
@app.command()
|
||||
|
||||
Reference in New Issue
Block a user