Translations
If you want to add translations to your app, you can do so by following the steps below.
Instructions
Configure Localization
Add the following to your settings.py
file:
superapp/apps/<your_app_name>/settings.py
import os
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
def extend_superapp_settings(main_settings):
######################################################################
# Localization
# Docs: https://docs.djangoproject.com/en/5.0/topics/i18n/translation/
######################################################################
main_settings['LANGUAGE_CODE'] = "en"
main_settings['TIME_ZONE'] = "Europe/Berlin"
main_settings['USE_I18N'] = True
main_settings['USE_TZ'] = True
main_settings['LANGUAGES'] = (
("en", _("English")),
("de", _("German")),
)
main_settings['LOCALE_PATHS'] = [os.path.join(BASE_DIR, 'locale')]
Generate locale files
mkdir -p site-packages
ln -s /usr/local/lib/python3.11/site-packages/unfold site-packages/unfold
ln -s /usr/local/lib/python3.11/site-packages/django site-packages/django
python manage.py makemessages -l de -l en -i venv -s
rm -r site-packages
Update the translations
Please review and update all translations in the locale
folder.
Compile messages
python manage.py compilemessages