aeat.locales._fstring_registry module¶
Explicit registration surface for bounded f-string locale key patterns.
The locale scaffold’s AST scanner emits namespace markers for f-string
tr() call sites (e.g. wizard.setup.*) but cannot enumerate the
concrete keys those sites produce at runtime. This module declares every
bounded f-string pattern whose value space is fully known at import time
so the scaffold can expand them into concrete placeholder entries.
Every f-string tr() call site with a known enumeration source must be
registered here as a FStringKeyRegistration. Open-ended patterns
(e.g. profile.keys.{profile_key} or sheets.detalle.headers.{row_field})
remain namespace-marker only because their value spaces are not bounded at
import time.
Adding a new enum value without updating the matching registration here
will cause scaffold to omit the required locale entries, which the
registration coverage test will surface immediately. The expanded key set
is exposed through get_registered_keys() for
locales.manager.LocaleManager
scaffold and parity checks.
- class FStringKeyRegistration(description, key_factory, values)[source]¶
Bases:
objectA bounded f-string locale key pattern with its enumeration source.
descriptionis used only in error and diagnostic messages.key_factorymaps a single string value fromvaluesto the dotted locale key that the runtime will pass totr().valuesis the complete bounded value set.
- get_registered_keys()[source]¶
Expand all registered f-string patterns into concrete dotted locale keys.
Each registration iterates its bounded value set and applies the
key_factoryto produce one concrete key per value. The result is the full set of locale keys that the runtime can build from the registered f-string patterns.
- get_registrations()[source]¶
Return the current registration tuple for inspection and testing.
- Return type:
- Returns:
A tuple of every
FStringKeyRegistrationbuilt at import time by_build_registrations().