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

1 Like

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. ^^