Load languages from the split layout, or the legacy YAML as fallback.
(
base_dir: Path,
legacy_file: Path,
)
| 39 | |
| 40 | |
| 41 | def load_languages( |
| 42 | base_dir: Path, |
| 43 | legacy_file: Path, |
| 44 | ) -> dict[str, Language]: |
| 45 | """Load languages from the split layout, or the legacy YAML as fallback.""" |
| 46 | split_dir = _split_languages_dir(base_dir) |
| 47 | if split_dir.is_dir(): |
| 48 | return _load_languages_split(split_dir) |
| 49 | if legacy_file.exists(): |
| 50 | return _load_languages_legacy(legacy_file) |
| 51 | raise FileNotFoundError( |
| 52 | f"No language data found. Looked in {split_dir} and {legacy_file}." |
| 53 | ) |
| 54 | |
| 55 | |
| 56 | def load_reference_texts( |
no test coverage detected