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
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
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
I’m posting this in response to Jose’s recent tweet (Cr. link) :
People are sleeping on Elixir for a coding harness:
Hot-code swappi...
New
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
Anyone running long-lived stateful processes on BEAM? We’re building an AI agent runtime and would love to compare notes.
We’re a small ...
New
This might be a bit disturbing for some but it’s happening - computers running on living human neurons. They’ve made them smart enough t...
New
Other Trending Topics
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
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
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
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
- #blog-post
- #ai
- #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)
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?