Closed kipcole9 closed 1 year ago
Cc: @rubas
As of this commit, sigil_q
is now sensitive to the optional fragment and query string at the end of a path. Neither the fragment nor query string are translated.
This is by design since these parameters would normally be considered either part of the page markup (the fragment) or the api definition (query params).
There is room to change the decision not to translate these elements. One approach would be to add two flags to the ~q
sigil. f
for "translate fragment" and q
for "translate query keys".
Feedback is very welcome.
As of this commit, localized verified routes are implemented. In order to publish, further testing and documentation is required. However it is ready for initial testing by any interested users.
Use
{:ex_cldr_routes, github: "elixir-cldr/cldr_routes", branch: "verified_routes"}
to yourmix.exs
Cldr.Route
as part of your Cldr providers configuration.use MyAppWeb.Router.VerifiedRoutes, router: MyApp.Router, endpoint: MyApp.Endpoint
to the require modules, replacing theuse Phoenix.Router.VerifiedRoutes
line.~q
(sigil_q
) instead of Phoenix'ssigil_p
and you are done.Implementation
Sigil_q
will generate a case expression to select the correct localized path at runtime. For example:Please add comments, suggestions and general feedback to this issue.