locale
¶
available_locales = [(LocaleModel.model_fields['language'].default) for LocaleModel in (get_args(get_args(Locale.__value__)[0]))]
module-attribute
¶
locale_adapter = pydantic.TypeAdapter(Locale)
module-attribute
¶
Locale = Annotated[EnglishLocale | reduce(or_, discover_other_locales()), pydantic.Field(discriminator=language)]
¶
discover_other_locales()
¶
Auto-discover and load locale variant classes from other_locales/ directory.
Why
Locales beyond English are defined as YAML files with translations and format overrides. Dynamic discovery enables community-contributed locales without core code changes.
Returns:
-
list[type[EnglishLocale]]–List of dynamically generated locale variant classes.