ORIONIS API REFERENCE

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 documentation

class ITranslationRepository(ABC): (source)

Known subclasses: orionis.localization.TranslationRepository

View In Hierarchy

Define the contract for the in-memory translation cache.

The repository guarantees that each locale is read from disk at most once, keeping every subsequent lookup fully in memory with O(1) access.

Notes

Implementations are not required to be thread-safe nor to copy the cached mapping before returning it.

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 loadedLocales Return the locales currently held in the cache.
Class Variable __slots__ Undocumented
@abstractmethod
def flush(self): (source)

Discard every cached translation map.

Returns
NoneUndocumented
@abstractmethod
def forget(self, locale: str) -> bool: (source)

Discard the cached translations for locale.

Parameters
locale:strLocale code whose cache entry must be removed.
Returns
boolTrue when an entry was removed, False otherwise.
@abstractmethod
def get(self, locale: str) -> TranslationMap: (source)

Return the translation map for locale, loading it on demand.

Parameters
locale:strLocale code whose translations are requested.
Returns
TranslationMapCached translation map for the locale. The mapping is the cached instance, not a copy.
@abstractmethod
def has(self, locale: str) -> bool: (source)

Determine whether locale is already cached in memory.

Parameters
locale:strLocale code to check.
Returns
boolTrue when the locale is present in the cache.
@abstractmethod
def loadedLocales(self) -> tuple[str, ...]: (source)

Return the locales currently held in the cache.

Returns
tuple[str, ...]Locale codes present in the in-memory cache.