shahryarjb

shahryarjb

Create localisation and translate file under umbrella project

Hello, I have a project which is umbrella, and every elixir project under it has 3 languages. those are elixir project and I have 3 Phoenix project too.
then I want you to suggest me how to prepare these project like what language my client wants.

it should be noted every project has custom error message and lines explain what to do.

I saw the Gettext, but it targets a Phoenix project but in my project I have many languages files in every project which are different.

I’m very confused, how can handle it , there are 25000 words that we should translate to 3 different languages



For more details:

my client sends a request to my phoenix project and it sends 3 request to 3 elixir project under umbrella and my phoenix doesnt know what error they may get back to phoenix because they have custom error message for themselves

Thanks

First Post!

Kurisu

Kurisu

I am also insterrested in how experienced Elixir developpers handle translations in umbrella project, but here is my thought.

I think once you get used to Gettext usage in a single Phoenix app, in a umbrella project it will be basically the same thing.

For general messages translation, we use gettext, and for domain specific messages we have dgettext. It is very well explained in the docs.

  • So you can have all your translations in a single non Phoenix app (let’s name it core), and import its Gettext backend (Core.Gettext) in the other apps.
    So what you call custom custom error message for themselves, I understand specific to a single Phoenix app in your umbrella project, is a good candidate for its own domain (for example the otp_name of this phoenix app).
    Then all common messages to the whole project will fall into the default translations.

  • But you can also have a Gettext backend per app. Here I’m not sure how easy it would be… But my idea is to create a domain for the shared translations, I mean those who will be used in multiple apps. Once you’ll have translations done in a given app, you’ll just copy the shared domain transtions files in its priv/gettext folder and paste it in all other apps that need it, private folder.

I Hope this will be helpfull for you. ^^

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New

We're in Beta

About us Mission Statement