2đź‘Ť
âś…
Actually, you’re thinking it wrong. Django supports translation, in Python code and in the templates.
The Django Translation documentation gives advice on how to do this.
You create a template with
{% load i18n %}
{% trans "Hello" %}
“Hello” will be translated to bonjour once you set it up.
You will need to activate I18N in your project settings, then call
manage.py makemessages
to create a .po file for your project. Once you create the translations for the .po file, type something like
manage.py compilemessages
The actual way of doing things is a bit more difficult than this but is described properly in the docs.
👤Steve K
Source:stackexchange.com