Using deepl translator for multi-language apps - a concept

Hi there!

This topic inspired me to play with the deepl translator.

I was wondering, how to lever the translation capabilities of deepl to create a multi-language app.
Having to generate some static JSON files for each language requires quite some work if you are talking about lot’s of languages. In addition, you can’t create content dynamically, for example LLM outputs or components added in a callback.

Since you can’t assure the quality of the translations beforehand, I see this more from a accessibility point of view: it gives lot’s of potential users enough understanding to use the app.

Concerning the translation quality, there are ways to fine tune the deepl translations to your needs via the API- if I understand correctly.

I would love to hear your thoughts on this!

Anyways, here is the code:

1 Like

But, you need to solve problem what if someone change language 1500 times with yours fewe sentences… Or if you will have bigger traffic.

I solved this potential issue with generating JSON dictionary.

You can check it in my repo under https://github.com/MarcelSuleiman/Salary-RealEstate-Dashboard/blob/main/src/translate/translate.py

  • translate_salary & create_local_translator without any manual JSON typing

In my case, initial traslate is fully managed by DeepL and responses are stored in JSON, if (in future) came new work position name, 609 of them will be translated localy and just one (new one) be translated by DeepL - just once and will be included into existing dictionary.

Speed time will increase radicaly…

Hey @MarcelSuleiman, thanks for your comment.

You are right with the traffic. That’s why I included memoization. Pretty much the same as you do in your JSON files. As I said, your apprach was interesting so I started playing around.

What I had in mind is create something like a “property” for dash components wether they are translatable or not. Or like a className='translatable. This way you could create content dynamically.

1 Like