blisscs
Hi,
I have project requirements that I need to provide an interface to user for translating text on the page manually.
I am wondering is it possible to use gettext library and then configure it to use translation from DB instead of .po files so that I can provided an simple web interface to allow user to translate text.
Best
Dev.
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
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
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
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
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
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
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #elixirconf-us
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 9- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
hauleth
No, AFAIK it is not possible. What you can achieve though is that you can provide your own helper that will localise the field from the DB, for example you if you store text in PostgreSQL and you use
hstoreplugin to localise fields then you can do:And then in your views use
localise_db article.title.OvermindDL1
If you want something a bit more specific to full DB language translations instead of just gettext style things (which you can do with a simple DB lookup and maybe a cache) then
transmight be what you want as well.Cochonours
This hstore thing and trans project are interesting, but am I wrong in my understanding that the application will retrieve all the translations from the DB before filtering one for the desired locale? That seems really inefficient to me, and the more you add locales the worse it becomes..?
I’m interested because I’m wondering about this kind of things now too. Wouldn’t the most efficient option be to duplicate columns for every locale? No joins, no fat around the filtered and retrieved data. But then the queries become a pain to write… And the schemas too.
blisscs
Thank you @hauleth and @OvermindDL1 for your information and recommendation.
trans project looks really interesting.
I think poeditor service could be a solution for this also, but it’s a paid service.
I will be checking on poeditor service and trans.
Will end up picking one of them for this solution.
sfusato
Transmakes use of atranslationsfield (a map basically =>jsonbin Postgres) you’ll store in the database in your model schema that will contain the translations of the fields you need translated. So, it’s not an extra db query as you would fetch it normally with the rest of the model.And then simply call to
Transwith the fetched model that already contains all translations, field to translate and the locale.Cochonours
I understood everything is fetched in one query, and avoiding joins which is nice, but for every translatable field it will fetch a map containing all the possible translations in order to filter for the desired one afterwards. Right? If yes, it’s convenient indeed but what a waste of bandwidth. If no, it means that postgres can filter within the fields he knows contain maps/json : that would be neat and I would like to be sure in order to hop into that wagon.
LostKobrakai
Postgres can certainly select only parts of json fields. I’m not sure if Trans uses it though.
Cochonours
Oh nice, I’m going to look it up now as it makes this perfect for storing translations this way. I’ll test and inspect the SQL generated by Trans when I have time to check that!
Edit :

PostgreSQL: Documentation: 9.3: JSON Functions and Operators
https://www.compose.com/articles/faster-operations-with-the-jsonb-data-type-in-postgresql/
OvermindDL1
It does, it adds a
translatedmacro that can be used in query’s (anywhere to reference the specific field, so inwhere’s,select’s, etc…).