betty.attrs.locale module

Locale attributes.

class betty.attrs.locale.HasLocale

Bases: Localized, LinkedDataDumpableWithSchemaJsonLdObject, HasProps

A resource that is localized, e.g. contains information in a specific locale.

__init__(*args: Any, locale: ResolvableLocale | None = None, **kwargs: Any)
async dump_linked_data(project: Project, /) PortableMapping

Dump this instance to JSON-LD.

async classmethod linked_data_schema(project: Project, /) JsonLdObject

Define the JSON Schema for betty.linked_data.LinkedDataDumpable.dump_linked_data().

locale

Make another attribute optional, e.g. allow None.

betty.attrs.locale.new_locale_attr(*, label: ResolvableLocalizable | None = None, description: ResolvableLocalizable | None = None) SettableAttr[HasProps, Locale, ResolvableLocale]

Create an attribute containing a locale.