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__ |
Undocumented |
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 | |
TranslationMap | Flat mapping of translation key to translated text. An empty mapping is returned when no source exists. |
| Raises | |
TranslationSyntaxException | If a translation file is not UTF-8 encoded, contains invalid JSON, or its root element is not an object. |