Skip to content

Commit 7e19c40

Browse files
committed
Handle lang_dir in stats.py
1 parent 2762541 commit 7e19c40

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

scripts/stats.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@
1717

1818
def main() -> None:
1919
"""Main function to generate translation stats."""
20-
language = os.environ.get("PYDOC_LANGUAGE")
21-
if not language:
22-
raise ValueError("Environment variable PYDOC_LANGUAGE is not set.")
2320

24-
pofiles_path = Path(f"cpython/Doc/locales/{language}/LC_MESSAGES")
21+
lang_dir = os.environ.get("PYDOC_LANG_DIR")
22+
if lang_dir:
23+
pofiles_path = lang_dir
24+
else:
25+
language = os.environ.get("PYDOC_LANGUAGE")
26+
if not language:
27+
raise ValueError("Environment variable PYDOC_LANGUAGE is not set.")
28+
pofiles_path = Path(f"cpython/Doc/locales/{language}/LC_MESSAGES")
29+
2530
if not pofiles_path.exists():
2631
raise FileNotFoundError(f"Path does not exist: {pofiles_path}")
2732

0 commit comments

Comments
 (0)