View Source ZoonkWeb.ErrorHTML (Zoonk v0.2.0-alpha)
Phoenix View for the error page.
Link to this section Summary
Functions
Returns the browser's locale.
Returns the school name based on the host.
Translate a string from the error page using the browser's locale.
Link to this section Functions
@spec get_locale(Plug.Conn.t()) :: String.t()
Returns the browser's locale.
@spec school_name(Plug.Conn.t()) :: String.t()
Returns the school name based on the host.
@spec translate_message(Plug.Conn.t(), String.t(), map()) :: String.t()
Translate a string from the error page using the browser's locale.
To render the error page, we can't access the session. We get the locale from the browser's accept-language header using Gettext module.
To avoid affecting the entire application, we use Gettext.with_locale/2 to temporarily set the locale and dynamically translate messages with Gettext.dgettext/3.