For example:
They come from a database that contains English strings:
@functools.cache
def get_language_dict() -> dict[str, str]:
"""
Get a list of allowed languages as a dictionary of {code: name}.
"""
with session_scope() as session:
return {language.code: language.name for language in session.execute(select(Language)).scalars().all()}
For example:
They come from a database that contains English strings: