ca1989
Hi all,
I am using Gettext to handle translations of Phoenix projects, it’s working great.
But I am not 100% happy about I organize my translated strings.
I have dgettext calls scattered around, and I know it’s perfectly fine, as the job of Gettext extract is exactly to fetch and group them.
But I don’t know, I still find a bit verbose: dgettext("domain", "Some %{arg} message", %{arg: "cool"}).
Also, there are cases where I use module attributes to messages used multiple times in the module (if they don’t have args).
There are cases where I use functions, because of the args.
So, I would like to know how do you organize them, if you have smart helpers or macros…?
I can’t stop thinking about a gigantic module that contains every single translation where I can address the translation with an atom. Is that silly?
Cheers!
Trending in Discussions
Other Trending Topics
Latest Phoenix Threads
Chat & Discussions>Discussions
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










Showing Posts 1 to 1- Show Best Posts
- Show All Posts (oldest first)
- Show All Posts (newest first)
LostKobrakai
There are translation systems, which use synthetic keys instead of the “to be translated” strings. I personally never found them appealing, but you’re not alone with that idea. You can even mimic that with gettext (just use the synthetic key as the string), but that usually means translates get to see that key instead of the to be translated text.