Architecture — Aquilia Documentation
Comprehensive guide and documentation for Architecture in the Aquilia framework. View API reference, examples, and implementation patterns.
i18n / Architecture i18n Runtime Architecture Aquilia i18n bootstraps during server startup and then runs as a request-aware translation pipeline. The architecture combines config, catalog loading, locale resolution, formatting, and fault-aware lookup. Boot Sequence # 1) Load merged runtime config raw_i18n = config_loader.get_i18n_config() # 2) Convert to typed config cfg = I18nConfig.from_dict(raw_i18n) # 3) Build i18n service + catalog backend service = create_i18n_service(cfg) # 4) Register app-scoped DI values register_i18n_providers(container, service, cfg) # 5) Build locale resolver chain resolver = build_resolver(cfg) # 6) Add request middleware middleware_stack.add(I18nMiddleware(service, resolver), priority=24) Subsystem Map Component Location Role ))} Translation Lookup Pipeline # t(key, locale) lookup order 1. catalog.get(key, exact_locale) 2. locale fallback chain (for example fr-CA -> fr) 3. catalog.get(key, fallback_locale) 4. missing-key strategy (_handle_missing) # tn(key, count, locale) adds plural selection category = select_plural(lang, count) value = catalog.get_plural(key, locale, category) Locale Resolution Pipeline locale = config.default_locale resolved = chain_resolver.resolve(request) if resolved and service.is_available(resolved): locale = resolved request.state["locale"] = locale request.state["locale_obj"] = parse_locale(locale) request.state["i18n"] = service Boundaries and Contracts • i18n handles localization and translations, not authentication or security authorizations. • The lazy_t translation helper defers actual lookup until string evaluation, preventing early initialization issues during package import. )
Go to Homepage