Skip to content

Commit

Permalink
Temporarily disable incomplete translations or unsupported code
Browse files Browse the repository at this point in the history
Refs: #22
  • Loading branch information
orontee committed Dec 30, 2023
1 parent b74286a commit c030cd9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
2 changes: 0 additions & 2 deletions po/LINGUAS
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
cs
fr
pl
ru
nb_NO
19 changes: 18 additions & 1 deletion scripts/generate_l10n_cc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,28 @@ def extract_language_from(file_path: Path) -> str:
return found.group(1)


def identify_supported_languages(po_files: Path) -> List[str]:
linguas_file = po_files / "LINGUAS"
with open(linguas_file) as fh:
return [lang.strip() for lang in fh.readlines()]


def load_translations(po_files: Path) -> Dict[str, Dict[str, str]]:
translations: Dict[str, Dict[str, str]] = {}

supported_languages = identify_supported_languages(po_files)

for po_file in po_files.glob("*.po"):
language = extract_language_from(po_file)
try:
language = extract_language_from(po_file)
except RuntimeError as error:
print(str(error))
continue

if language not in supported_languages:
print(f"Skipping translations for language {language!r}")
continue

print(f"Loading translations for language {language!r}")

language_translations: Dict[str, str] = {}
Expand Down

0 comments on commit c030cd9

Please sign in to comment.