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
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,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
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
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
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
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
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
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
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 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/