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 ITranslationLoader(ABC): (source)

Known subclasses: orionis.localization.TranslationLoader

View In Hierarchy

Define the contract for translation file loaders.

A loader reads translation sources from disk and produces a flat translation map per locale. It knows nothing about caching, locale resolution, or template engines: its single responsibility is loading translations.

Method availableLocales Discover every locale with at least one translation source.
Method load Load every translation available for locale.
Class Variable __slots__ Declare that this class introduces no additional instance slots.
@abstractmethod
def availableLocales(self) -> tuple[str, ...]: (source)

Discover every locale with at least one translation source.

Returns
tuple[str, ...]Sorted locale codes discovered from root JSON files and grouped directories inside the language path.
@abstractmethod
def load(self, locale: str) -> TranslationMap: (source)

Load every translation available for locale.

Merges the grouped files located under {path}/{locale}/*.json (flattened with dot notation, e.g. validation.required) with the root JSON file {path}/{locale}.json whose keys are the literal source texts. Root JSON entries take precedence over grouped entries on key collision.

Parameters
locale:strLocale code whose translation sources must be read.
Returns
orionis.localization.types.TranslationMapFlat mapping of translation key to translated text. An empty mapping is returned when no source exists.
Raises
orionis.localization.InvalidLocaleExceptionIf the locale code is malformed or contains path components.
orionis.localization.TranslationExceptionIf a source resolves outside the configured language directory.
orionis.localization.TranslationSyntaxExceptionIf a translation file is not UTF-8 encoded, contains invalid JSON, or its root element is not an object.
__slots__: tuple = (source)

Declare that this class introduces no additional instance slots.