Skip to content

Commit

Permalink
Merge pull request #89 from VaagenIM/develop
Browse files Browse the repository at this point in the history
fix: log and ignore broken translations
  • Loading branch information
sondregronas authored Nov 9, 2024
2 parents 98f6d9f + f66ff74 commit d414dcf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions piggy/piggybank.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,13 @@ def generate_piggymap(path: Path, max_levels: int = 5, _current_level: int = 0):
for lang in os.listdir(f"{path}/translations") if os.path.isdir(f"{path}/translations") else []:
if not os.path.exists(f"{path}/translations/{lang}/{item}"):
continue
translation_sections = mdfile_to_sections(Path(f"{path}/translations/{lang}/{item}"))
translation_meta[lang] = translation_sections["meta"]
try:
translation_sections = mdfile_to_sections(Path(f"{path}/translations/{lang}/{item}"))
translation_meta[lang] = translation_sections["meta"]
except Exception:
# TODO: Handle / visualize this error better
print(f"Error: Could not render translation for {lang}/{item}")
continue

assignment_key = normalize_path_to_str(i, replace_spaces=True, normalize_url=True, remove_ext=True)
piggymap[assignment_key] = {
Expand Down

0 comments on commit d414dcf

Please sign in to comment.