Generate Translation Files
A snippet showing how to generate translation files with makemessages.
# From the project root (where manage.py lives)
# Create locale dir and extract strings for French (fr) and Spanish (es)
django-admin makemessages -l fr
django-admin makemessages -l es
# Or extract all locales based on existing PO files
django-admin makemessages -a
# Include JavaScript strings (scan .js files)
django-admin makemessages -d djangojs -l fr
Explanation:
-
Ensure
LOCALE_PATHSis set or use app-levellocale/directories. -
.po files are created under locale/
/LC_MESSAGES/ with extracted msgids.
- Category Internationalization (i18n)
- Total Views 964
- Last Modified 10 July, 2026
- Tags #i18n #makemessages #po files #translation
Previous snippet
Block Translation in Templates
Next snippet