from functools import cache from pathlib import Path from pydantic.type_adapter import TypeAdapter from fansifter_common.translation.types import Terms TranslationsValidator = TypeAdapter(dict[str, Terms]) @cache def get_translations(translations_path: str) -> dict[str, Terms]: return TranslationsValidator.validate_json(Path(translations_path).read_bytes())