Skip to content

Commit

Permalink
Adding a few comments
Browse files Browse the repository at this point in the history
  • Loading branch information
BrentBlanckaert committed Dec 19, 2024
1 parent c63e391 commit a35c49a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tested/nat_translation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import re
import sys
from typing import cast

Expand All @@ -19,6 +18,8 @@
def parse_value(
value: list | str | int | float | dict, flattened_stack: dict
) -> list | str | int | float | dict:
# Will format the strings in different values.

if isinstance(value, str):
return format_string(value, flattened_stack)
elif isinstance(value, dict):
Expand All @@ -30,9 +31,12 @@ def parse_value(


def flatten_stack(translation_stack: list, language: str) -> dict:
# Will transform a list of translation maps into a dict that
# has all the keys defined over all the different translation map and will have
# the value of the newest definition. In this definition we also chose
# the translation of the provided language.
flattened = {}
for d in translation_stack:

flattened.update({k: v[language] for k, v in d.items() if language in v})
return flattened

Expand Down

0 comments on commit a35c49a

Please sign in to comment.