Skip to content

Commit

Permalink
add support for german setting csvs
Browse files Browse the repository at this point in the history
  • Loading branch information
markus authored and markus committed Apr 3, 2023
1 parent ae3e9c9 commit 8536d83
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions german_vocabulary.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# NOTE: This method requires this module to be one folder below the top-level
# knausj folder.
SETTINGS_DIR = Path(__file__).parents[0] / "settings"
SETTINGS_DIR: Path = Path(__file__).parents[1] / "knausj_talon" / "settings"

if not SETTINGS_DIR.is_dir():
os.mkdir(SETTINGS_DIR)
Expand Down Expand Up @@ -78,7 +78,7 @@ def get_list_from_csv(
mod.list("vocabulary_german", desc="additional german vocabulary words")

additional_words = get_list_from_csv(
"additional_words.csv",
"additional_words_de.csv",
headers=("Word(s)", "Spoken Form (If Different)"),
default=_default_vocabulary,
)
Expand All @@ -87,4 +87,13 @@ def get_list_from_csv(
@ctx.capture("user.vocabulary_german", rule='({user.vocabulary_german})')
def vocabulary_german(m) -> str:
"""user vocabulary"""
return str(m)
return str(m)

# Always capitalize words that are defined in this file
always_capitalized_words = get_list_from_csv(
"capitalized_words_de_custom.csv",
headers=("Word(s)"),
default={},
)
ctx.lists["user.always_capitalized_words_german"] = always_capitalized_words

0 comments on commit 8536d83

Please sign in to comment.