Ensure there are no files in the non translatable pages.
()
| 562 | |
| 563 | @app.command() |
| 564 | def ensure_non_translated() -> None: |
| 565 | """ |
| 566 | Ensure there are no files in the non translatable pages. |
| 567 | """ |
| 568 | print("Ensuring no non translated pages") |
| 569 | lang_paths = get_lang_paths() |
| 570 | error_paths = [] |
| 571 | for lang in lang_paths: |
| 572 | if lang.name == "en": |
| 573 | continue |
| 574 | for non_translatable in non_translated_sections: |
| 575 | non_translatable_path = lang / "docs" / non_translatable |
| 576 | if non_translatable_path.exists(): |
| 577 | error_paths.append(non_translatable_path) |
| 578 | if error_paths: |
| 579 | print("Non-translated pages found, removing them:") |
| 580 | for error_path in error_paths: |
| 581 | print(error_path) |
| 582 | if error_path.is_file(): |
| 583 | error_path.unlink() |
| 584 | else: |
| 585 | shutil.rmtree(error_path) |
| 586 | raise typer.Exit(1) |
| 587 | print("No non-translated pages found ✅") |
| 588 | |
| 589 | |
| 590 | @app.command() |
nothing calls this directly
no test coverage detected