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 ITranslationLoader(ABC): (source)
Known subclasses: orionis.localization.TranslationLoader
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 | available |
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. |
orionis.localization.TranslationLoaderLoad 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:str | Locale code whose translation sources must be read. |
| Returns | |
orionis.localization.types.TranslationMap | Flat mapping of translation key to translated text. An empty mapping is returned when no source exists. |
| Raises | |
orionis.localization.InvalidLocaleException | If the locale code is malformed or contains path components. |
orionis.localization.TranslationException | If a source resolves outside the configured language directory. |
orionis.localization.TranslationSyntaxException | If a translation file is not UTF-8 encoded, contains invalid JSON, or its root element is not an object. |
orionis.localization.TranslationLoaderDeclare that this class introduces no additional instance slots.