BartOtten

BartOtten

Library for localized/multilingual routes in Phoenix

This lib is now published and has a new topic.

Once this topic was about PhxAltRoutes. A lib pioneering localized routes for Phoenix.

It’s experimental work sparked and influenced second generation routing libs such as Cldr-Routes and Phoenix Localized Routes.

Phoenix Localized Routes is superseded by the third (and currently latest) generation: Routex - Extension driven superpowers for Phoenix Routes

Most Liked

BartOtten

BartOtten

Update

  • The public API is becoming stable
  • Localized Routes on Phoenix 0.16 was easier than on Phoenix 0.17. Ah well, got lot’s of goodies in return.
  • Lots of refactoring still to do

THE BRAVE MAY START TO USE IT IN AN HOBBY PROJECT

Changelog

# the original route is wrapped in `PhxLocalizedRoutes.Helpers.loc_route` which receives a scope config (opts).

<%= for {slug, opts} <- ExampleWeb.LocalizedRoutes.local_scopes!(flat: true) do %>
   <span>
       <%= live_redirect " [#{slug}] ", to: PhxLocalizedRoutes.Helpers.loc_route(Routes.product_index_path(@socket, :index), opts) %>
   </span>
<% end %>
malloryerik

malloryerik

Get well soon!

BartOtten

BartOtten

CLDR had it’s release of CLDR Route which was inspired by this lib-in-progress. There is overlap in purpose, yet enough difference in features to continue this lib. Will make a comparison table some day to help users making the choice what fits best for their purpose.

Due to the better documentation and function naming skills of @kip, I have merged back some improvements. So thanks Kip for part of this update!

  • alias original helper module as OriginalRoutes
  • improved docs
  • improved function naming
  • :assigns => :assign (to keep :assign_new as option for the future)
  • development: more debug logging
  • development: better stacktrace
  • much more

Todo:

  • assign inheritance
  • getting rid of the Assigns struct
  • e2e tests in addition to current low level tests

Later:

  • loc_link which also translates the links(??)
  • option to not render a parent route
csadewa

csadewa

Hi @BartOtten , here’s some feedback since you are looking for one:

  1. Is this library is a drop-in replacement to Phoenix Routes? Routing — Phoenix v1.6.6 in which case aspect such as security (like token decoding, cross browser validation, etc.)
  2. What is the intended usage of the library? Why would people consider using AltRoutes rather than the standard Phoenix Routes? it’s not clear to me, right now it seems AltRoutes looks like a smaller codegen of standard Phoenix Route.
sfusato

sfusato

1 - I see PhxMultiLangRoutes as more descriptive of what the library does. PhxLocalizedRoutes could also be an idea.

2 - Would :short differ from :slug in many cases? If not, having one key less could be desirable. Even in europe/eu case, if the slug is europe, I would find it much more intuitively that the helper uses it as well (europe_product_index_path).

4 - A far alley, maybe even out of the scope of the library, could be the support of different domains/subdomains:

  "en" => "example.com",
  "nl" => "nl.example.com",
  "be" => "be.example.com",

Where Next?

Popular in RFCs Top

pepicrft
Hey folks :wave: I implemented a library that uses macros extensively, and I’d appreciate feedback from people that are more versed at w...
New
c4710n
This package is a simple wrapper of beam-telemetry packages. It provides a modular approach for using beam-telemetry packages. The basi...
New
UlrikHD
I’ve been wanting to write a library for the lemmy API so that I can port some of my scripts over to elixir. For those unfamiliar with le...
New
tmbb
I’ve started working on a toy project to compile extended POSIX-compatible regular expressions into NimbleParsec combinators. These combn...
New
adamwight
I’ve written a crude module for retrieving files from a remote server using rsync, since I didn’t see any existing tools already. This c...
New
puemos
Hey everyone :waving_hand: Code: GitHub - puemos/overbooked: Overbooked is a self-hosted flexible workplace platform for indie co-wor...
New
zachallaun
Hey gang, I’ve been using Req as my primary client for a project I’ve been working on that interacts with a number of APIs, and I quickl...
New
zachallaun
Note: There are a few folks I’d really love to hear from, time permitting. Pinging in case the title isn’t catchy enough :slight_smile: @...
New
zachallaun
Hi friends, I wanted an authorization utility for an existing project I’m working on where I have a fair amount of permissions logic dup...
New
Hedgehog-ai
Hello I would like feedback on an experimental neuroevolution (including substrate encoding) library called Bardo based on the amazing wo...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs &amp; Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3268 119930 1237
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New

We're in Beta

About us Mission Statement