File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -333,3 +333,16 @@ def assignment_code(student_files:Tuple[pathlib.Path]) -> str:
333333@functools .lru_cache
334334def assignment_instruction (readme_file :pathlib .Path ) -> str :
335335 return readme_file .read_text ()
336+
337+
338+ @functools .lru_cache (maxsize = None )
339+ def load_locale (explain_in :str ) -> Dict [str , str ]:
340+ locale_folder = pathlib .Path (__file__ ).parent / 'locale'
341+ assert locale_folder .exists (), f"Locale folder not found: { locale_folder } "
342+ assert locale_folder .is_dir (), f"Locale folder is not a directory: { locale_folder } "
343+
344+ locale_file = locale_folder / f'{ explain_in } .json'
345+ assert locale_file .exists (), f"Locale file not found: { locale_file } "
346+ assert locale_file .is_file (), f"Locale file is not a file: { locale_file } "
347+
348+ return json .loads (locale_file .read_text ())
You can’t perform that action at this time.
0 commit comments