I have seen a similar question somewhere here, but I can’t find it and I don’t think it included a suitable solution.
Let’s consider a scenario where we work with the following languages and domains
cs-CZ, en-GB, en-US, de-DE, fr-FR, it-IT
www.example.cz www.example.com www.example.fr www.example.it
For whatever reason
en-GB, en-US, and de-DE need to share one domain, which is
We want to show news in each and every language on the following URLs
www.example.cz/novinky www.example.com/news www.example.com/en-us/news www.example.com/de-de/aktualiten www.example.fr/nouvelles www.example.it/notizia
It would be easy if there was a domain for every language, or all languages were hosted on a single domain, or all domains started with www.domain.xx/xx-xx/news
I could put in my router.ex
Enum.each ["/:locale", ""], fn locale -> scope locale, PlutoWeb do pipe_through [:browser, :ensure_redirect] get "/", PageController, :index end end
but then how will I know whether :locale is an actual language or just news?
If I go with www.domain.xx/xx-xx/news for every language, the issue is that URLs will be ugly for websites, where there will just be one language.