Localized verified routes using the ~q sigil.
This module provides compile-time verified localized routes. Instead of configuring with use Phoenix.VerifiedRoutes, configure instead:
use Localize.VerifiedRoutes,
router: MyApp.Router,
endpoint: MyApp.Endpoint,
gettext: MyApp.GettextWhen configured, the sigil ~q is made available to express localized verified routes. Sigil ~p remains available for non-localized verified routes.
The ~q sigil generates a case statement that dispatches to the appropriate localized ~p route based on the current locale:
# ~q"/users" generates:
case Localize.get_locale().cldr_locale_id do
:de -> ~p"/benutzer"
:en -> ~p"/users"
:fr -> ~p"/utilisateurs"
endLocale Interpolation
:localeis replaced with the CLDR locale name.:languageis replaced with the CLDR language code.:territoryis replaced with the CLDR territory code.
Summary
Functions
Implements the ~q sigil for localized verified routes.
Generates the router url with localized route verification.
Generates the router url with localized route verification from the connection, socket, or URI.
Generates the router url with localized route verification from the connection, socket, or URI and router.
Functions
Implements the ~q sigil for localized verified routes.
Generates a case expression that dispatches to the translated ~p route for the current locale. The route path is verified at compile time against the router.
Generates the router url with localized route verification.
Generates the router url with localized route verification from the connection, socket, or URI.
Generates the router url with localized route verification from the connection, socket, or URI and router.