GameServerWeb.Plugs.LocalePath (game_server_web v1.0.938)

Copy Markdown

Extracts an optional locale prefix from the URL path (e.g. /es/settings) and sets the Gettext locale accordingly.

When a locale prefix is found the plug stores the chosen locale in the session under :preferred_locale and redirects to the unprefixed path. This ensures the router always sees clean paths and LiveView WebSocket reconnects never hit an unmatched /es/... URL.

Known locales are derived from Gettext.known_locales/1 at compile time.

Summary

Functions

call(conn, opts)

init(opts)