Iterate on the markdown files to translate in order of priority.
(lang_path_root: Path)
| 29 | |
| 30 | |
| 31 | def iter_all_lang_paths(lang_path_root: Path) -> Iterable[Path]: |
| 32 | """ |
| 33 | Iterate on the markdown files to translate in order of priority. |
| 34 | """ |
| 35 | |
| 36 | first_dirs = [ |
| 37 | lang_path_root / "learn", |
| 38 | lang_path_root / "tutorial", |
| 39 | lang_path_root / "advanced", |
| 40 | lang_path_root / "about", |
| 41 | lang_path_root / "how-to", |
| 42 | ] |
| 43 | first_parent = lang_path_root |
| 44 | yield from first_parent.glob("*.md") |
| 45 | for dir_path in first_dirs: |
| 46 | yield from dir_path.rglob("*.md") |
| 47 | first_dirs_str = tuple(str(d) for d in first_dirs) |
| 48 | for path in lang_path_root.rglob("*.md"): |
| 49 | if str(path).startswith(first_dirs_str): |
| 50 | continue |
| 51 | if path.parent == first_parent: |
| 52 | continue |
| 53 | yield path |
| 54 | |
| 55 | |
| 56 | def get_all_paths(lang: str): |