wolfiton
Hi everyone,
I only found this on this topic How to approach multi language content management system?
and wondering if in 2020 there is a better way to structure the database schema except for embedding the translations in the article table?
How would you solve this problem?
Any suggestion or ideas is welcomed.
I am also interested in using absinthe and phoenix templates apps how to handle this?
Thanks in adavance
Trending in Discussions
Hey there,
It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hi there! :wave:
@frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with.
But I don’t use it anymore.
Serverless was the promis...
New
Lately I’ve been thinking about how to organize components as a LiveView application grows. One of the pain points I’ve found (for myself...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
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
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
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
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
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
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
OvermindDL1
Without having read that link I’d do it by having a column that encodes the language key as well, makes it for easy and efficient lookup, making it trivial to even fall back to another with minimal network use compared to embedding and so forth.
wolfiton
Thanks @OvermindDL1 for the suggestion and explanations.
wolfiton
Also i would like to be sure that understood your point of view so I am writing the following schema
Languages migration
Article migration
Category migration
Something like this?
But the
language_idto be optional only if thecategory or articlewritten in another language?OvermindDL1
I wouldn’t even have the
languagestable at all, I’d just use the ISO-standard language codes for the language mappings.For
poststhelanguage_idwould just be a string type for that ISO mapping. Use the elixir cldr library (I think that was it?) for handling the language codes and making sure they are correct and all. Nicely by following this style you can easily lookup codes likeen-usfor a US specific entry, and if it doesn’t exist you can fall back to anengeneric lookup, and if that fails you can fall back to anen-%prefix lookup, and if that fails fallback to whatever you want, all in a single query is easy to do.And for the
categoriestable thelanguage_idwould again just be a string for the ISO language code.I haven’t done anything super advanced with internationalization though so I could easily be missing something, but this is both what I’ve done in the past and what I’ve seen in a large variety of significantly used databases.
wolfiton
So something like this
and i would use a
wherefor every language i support i guess.Thanks @OvermindDL1 i think i finally got it.
OvermindDL1
That’s what I’d do. Plus add an index for the language code (along with probably the name after it, so an index on
[:language_code, :name]perhaps would be the easiest and fastest index to make for the most usual queries I’d wager, but it all depends on what kind of queries you do).wolfiton
The lib mentioned by @OvermindDL1 Cldr Languages — ex_cldr_languages v0.3.3
GitHub - elixir-cldr/cldr: Elixir implementation of CLDR/ICU · GitHub
OvermindDL1
Ah yep, that looks like it, in addition to
ex_cldritself too!EDIT: Or perhaps just
ex_cldritself?wolfiton
What are the difference because i couldn’t tell from the docs of https://hexdocs.pm/ex_cldr_languages/
OvermindDL1
Looks like
ex_cldr_languagesjust usesex_cldrunder the hood for an easier language name conversion, but it seems you can do it all with normalex_cldrI think?