THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
class TranslationRepository(ITranslationRepository): (source)
Constructor: TranslationRepository(loader)
In-memory cache of translation maps keyed by locale.
Each locale is loaded from disk exactly once; every subsequent lookup resolves from the internal dictionary with O(1) access. The cache is fully transparent to consumers.
Notes
The repository uses no lock. Two tasks missing the cache for the
same locale may both call the loader; the last assignment wins and
both callers receive a valid map. get returns the cached
mapping itself, not a copy, so mutating it mutates the cache for
every consumer.
| Method | __init__ |
Initialize the repository with its translation loader. |
| Method | flush |
Discard every cached translation map. |
| Method | forget |
Discard the cached translations for locale. |
| Method | get |
Return the translation map for locale, loading it on demand. |
| Method | has |
Determine whether locale is already cached in memory. |
| Method | loaded |
Return the locales currently held in the cache. |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | _cache |
Undocumented |
| Instance Variable | _loader |
Undocumented |
Initialize the repository with its translation loader.
| Parameters | |
loader:ITranslationLoader | Loader used to read translation sources on cache misses. |
| Returns | |
None | Undocumented |
Return the translation map for locale, loading it on demand.
| Parameters | |
locale:str | Locale code whose translations are requested. |
| Returns | |
TranslationMap | Cached translation map for the locale. The mapping is the cached instance, not a copy. |
| Raises | |
TranslationSyntaxException | If a translation file contains invalid JSON. |