Central mapping from error atoms (returned by the Locations module's public API and used across its LiveViews) to translated human-readable strings.
Keeping UI-facing copy in one place means every "not found" or
"delete failed" flash reads the same wording, and translations live
in core's gettext backend rather than being scattered across call
sites. Callers pattern-match on atoms; message/1 wraps each mapping
in gettext/1 at the UI boundary.
Supported reason shapes
- plain atoms —
:location_not_found,:type_assignment_failed, etc. - strings — passed through unchanged (legacy / interpolated messages)
- anything else — rendered as
"Unexpected error: <inspect>"so nothing silently surfaces a raw struct
Example
iex> PhoenixKitLocations.Errors.message(:location_not_found)
"Location not found."
Summary
Functions
Translates an error reason into a user-facing string via gettext.