I am creating a website from scratch where I am planning to make it dynamically multilingual. Tools I use are:
My idea is to have a website that can have multiple languages as necessary. languages can be RTL and LTR. I can add any language in a form of json file that has an item against its translation to the desired language, for instance english-french json file would be:
{"door":"porte"}
{"direction": "LTR"}
by adding such a file my website should be able to have the right information regarding the french language for instance and everything should appear in french correctly as specified in the json file. I plan to have two types of html pages in my DB for each of my website pages; one for "RTL" and one for "LTR", I render them based on the request of the user. (language chosen in the front end). In translation process, after picking the right orientation of the language, I use django template variables in my html to place the right language using the correct json file of the language, all my json files are stored in the database, and retrieved by the desired lanaguge chosen by the user.
I have couple of questions:
any suggestions or comments is highly appreciated.
Thank you
You are definitely re-inventing the wheel. Django already comes with i18n support. This works for nearly all elements.
As described here: https://docs.djangoproject.com/en/3.1/topics/i18n/
I personally would recommend using gettext_lazy() as it makes things easier, but that's just my taste.
There is of course also a template tag called {% trans "Whatever" %}
You will end up with text files that you can simply edit and also use SaaS if you want a fancy user interface.