Skip to content

Commit

Permalink
Print warning if --language code can be found in the langcodes db
Browse files Browse the repository at this point in the history
  • Loading branch information
xxyzz committed Nov 7, 2023
1 parent 52dccc1 commit ba47ff4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/wiktextract/wiktwords.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import logging
import os
import pstats
import re
import sys
from pathlib import Path
from typing import TextIO
Expand All @@ -24,6 +23,7 @@
else:
from importlib.resources import files

from mediawiki_langcodes import code_to_name
from wikitextprocessor import Wtp
from wikitextprocessor.dumpparser import analyze_and_overwrite_pages

Expand Down Expand Up @@ -334,6 +334,10 @@ def main():
# Default to English and Translingual if language not specified.
if not args.language:
args.language = ["en", "mul"]
else:
for lang_code in args.language:
if code_to_name(lang_code) == "":
logging.warning(f"Unknown language code: {lang_code}")

if args.all_languages:
args.language = None
Expand Down

0 comments on commit ba47ff4

Please sign in to comment.