Improve typing and docs for registries.
Review Request #12990 — Created April 26, 2023 and submitted
The typing additions for registries restricted errors to plain strings,
meaning that type checkers would fail if setting the result of
gettext_lazy(...)or other promise strings.
This change fixes that up to support both variants, and to add typing
and docs for the constants.
Unit tests pass.
Verified that this solved some typing issues in registries we provide.