Takueg
Hi everyone. Does anyone know how I can define 2 routes in two different languages for the same action? For example /en/sign-up and /de/ammeldung should both lead to the same action. The app uses SetLocale plug so the routes are defined like this /:locale/signup. when I define a route specifying the locale like /de/ammeldung I get a ERR_TOO_MANY_REDIRECTS error in the browser.
Is it possible to implement some logic somewhere that says when locale is de use /de/ammeldung and when it is en use /en/sign-up. Or does anyone know any solution to this problem.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
BartOtten
I did create such thing for LiveView but never finalized it. Send me a private message as a reminder and I will pick up where I left and publish
Ankhers
Something I have seen done in the past is the following in your router.
I will admit I am unsure if this is the suggested practice or if there is something better that could be done.
BartOtten
When my newborn is nice and quiet, I will pick this one up. Mostly missing documentation I guess.
BartOtten
Spend some time tonight to update the code for use with the latest LiveView. Would you like access to the fully functioning alpha version or can you wait a week longer?
BartOtten
@Takueg I have worked at the lib today and also wrote the initial README. Does this sound like something that could solve the first issue of alternative routes for you? If so, I will publish asap.
ps. It won’t do the actual redirect, but I know from a Proof of Concept that it can be done by leveraging some helpers provided by the lib.
Phx.AltRoutes
Generate alternative routes and route helpers in Phoenix applications.
Bonus features:
Gettextmodule in the configuration, Gettext extracts the route segments into route.po files when invokingmix gettext.extract; allowing the translation of routes along with otherGettextmessages.Example
The examples below will use the following configuration.
Translated routes
Phoenix will generate
routes.pofiles for languages ‘nl’ and ‘en’, including all segments of nested routes. The macro expands the routes during compile time with alternative variants.Generated routes
Example of the routes to edit products.
Links in templates
During the rendering of templates, the library will replace links of routes with alternatives. This:
will render a link to an alternative route based on the current alternative scope.
/uk/productslinks to/uk/users/log_in/europe/nl/productenlinks to/europe/nl/gebruikers/aanmeldenUse of custom assigns per route
As per configuration you can use the custom assigns
@localeand@languagein Phoenix templates.BartOtten
https://forum.elixirforum.com/t/phx-altroutes-pre-release-feedback-discussion