cadrumo.domain.user_profile.labels module¶
Operator-facing labels for the user-profile schema, in the active language.
The schema TOML declares a title per section and a description per
field. Neither is a label. description is long-form authority prose –
often several sentences (auth.provider runs to four) – and it is
deliberately mixed-language, because the fields whose meaning is fixed by
Spanish tax law are written in Spanish (tax_residence.ccaa,
renta_taxpayer.sex, provenance.source). Rendering it as a table
label gave the operator a paragraph in a column, in whichever language the
schema author happened to use.
So the two strings are separated by job, and each has exactly one home:
The schema TOML owns the long-form prose. It stays the authority the wizard’s copy resolver reads and the masking heuristic scans.
The locale catalogues own the short operator-facing label, keyed per section and per field.
The label is resolved through tr() with the schema
prose as the default, which makes the fallback truthful rather than
decorative: a field whose key no catalogue carries renders its declared
description – true, if verbose – instead of a raw dotted path or a
missing-key marker. The renderer already treats a value equal to its own
key as a miss, so a scaffold placeholder falls back the same way an absent
key does; a key can therefore be declared before it is translated without
ever showing the operator a placeholder.
Keys are derived from the schema rather than declared beside it, so the
schema stays the single structural authority: adding a field to the TOML
creates its key by construction. profile_schema_locale_keys() is what
the locale scaffolder reads, which is what makes a newly-declared field
without labels a loud parity failure rather than a silent English row.
See also
ProfileSchemaDefinitionThe schema whose sections and fields these keys are derived from.
- profile_section_title_key(section_key)[source]¶
Return the locale key carrying one section’s operator-facing title.
- profile_field_label_key(section_key, field_key)[source]¶
Return the locale key carrying one field’s operator-facing label.
- profile_section_title(section, *, locale=None)[source]¶
Return one section’s title in
locale, falling back to the schema.- Parameters:
section (
ProfileSectionDefinition) – The declared section.locale (
str|None) – Language code; the active output language whenNone.
- Return type:
- Returns:
The catalogue title, or the schema’s declared
titlewhen the catalogue does not carry one.
- profile_field_label(section_key, field, *, locale=None)[source]¶
Return one field’s label in
locale, falling back to the schema.- Parameters:
section_key (
str) – Canonical key of the section declaringfield.field (
ProfileFieldDefinition) – The declared field.locale (
str|None) – Language code; the active output language whenNone.
- Return type:
- Returns:
The catalogue label, or the field’s declared
descriptionwhen the catalogue does not carry one.
- profile_schema_locale_keys(schema)[source]¶
Return every locale key the schema’s sections and fields declare.
This is the enrolment surface the locale scaffolder and the parity gate read, so a field added to the schema TOML without a catalogue entry fails parity instead of silently rendering its description.
- Parameters:
schema (
ProfileSchemaDefinition) – The loaded schema to enumerate.- Return type:
- Returns:
Every section-title and field-label key declared by
schema.