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: object

A bounded f-string locale key pattern with its enumeration source.

description is used only in error and diagnostic messages. key_factory maps a single string value from values to the dotted locale key that the runtime will pass to tr(). values is the complete bounded value set.

Parameters:
description: str
key_factory: Callable[[str], str]
values: tuple[str, ...]
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_factory to 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.

Return type:

set[str]

get_registrations()[source]

Return the current registration tuple for inspection and testing.

Return type:

tuple[FStringKeyRegistration, ...]

Returns:

A tuple of every FStringKeyRegistration built at import time by _build_registrations().