Yoga
Maybe I am doing something wrong but I can’t find anything about i18n in Phoenix docs.
Also, I have noticed, that for some reason the lang tag is hardcoded in the default root template as “en”.
Also, I can’t find anything about locales, default_locale, fallback_locale as in other frameworks like Laravel.
I do see gettext folder.
Why is there gettext folder and locales are completely missing?
Also, is there a tutorial on how to setup a Phoenix app with a typical urls like / and /de/ and /ua/ ?
I have checked LiveView help and there, also, is nothing about making the website multilingual.
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m aware of 2 such projects, are there others?
git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
Hi all,
I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
Hi everyone.
My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
Hi,
we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
Hi all, I’m new here and would like to hear peoples views on my Elixir/Phoenix based game-engine! :smiley:
Mutonex gamedesign was finish...
New
Do we have maintainer of absinthe-graphql/dataloader here? We have a PR that we’d like to merge to the library. Relatively small additive...
New
Other Trending Topics
Hey there,
I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first.
...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly)
AI dream has many faces, but general...
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
- #ai
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
LostKobrakai
Phoenix uses the
gettextlibrary to do i18n. You can find its documentation here: Gettext — gettext v1.0.2al2o3cr
Like @LostKobrakai said, most of the docs you’ll need are under the Gettext library.
I found this tutorial that looks useful; it demonstrates doing the URL-locale thing:
kokolegorille
In addition, it’s also possible to setup locale in live socket with this kind of code in assets/js/app.js
So that liveview is aware of client locale
zaljir
And for Liveview, more docs can be found here: Using Gettext for internationalization — Phoenix LiveView v0.18.3
Yoga
I keep seeing the jargon “backend module” all the time. What does that mean? What is backend in this module context? Admin area? Protected area?
Yoga
Hmm, thanks, will take a look. Hopefully, it will work with LiveView.
Yoga
How do you make
<html lang="en">dynamic and not hardcoded in root template using LiveView?
In Laravel it is done like this:
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">How do you achieve this in Phoenix?
And again, why isn’t it already there in the first place? Together with the locales and default locale? For example, in Laravel it is set in config/app.php file, namely locale, default_locale, fallback_locale and faker_locale. I mean at least the locale could be put in config/config.exs somewhere by default ;(
As it is now, it seems half baked meaning you got gettext but you are missing locales and local is hardcoded in the root template file.
Yoga
I followed it and the URL part doesn’t work with LiveView. I see the English version all the time. I thought it is working when I tried /nl first time and it showed the NL content, however then I manually tried /en and English showed. Then I tried again /nl but English was shown there:
Shouldn’t this part in root.html.heex:
be something like
or something?
Another problem if I have this in routes:
/ doesn’t work anymore, although it should work as the default language . /nl and /en work but only English is shown.
so:
Yoga
That’s only for logging it seems. For guests it has no impact and LiveView doesn’t show gettext correctly at least for me.
Yoga
I have found this library now Phoenix Localized Routes - Localized/multilingual routes in Phoenix but the things you have to change in the example_web.ex file are missing in Phoenix 1.7 . Also, the project seems to be temporarily or permanently down, at least for me: https://bartotten.github.io/phoenix_localized_routes/