Implementation notes
Specialties of Django translation
Django's translation machinery uses the standard gettext
module that comes with Python. If you know gettext
, you might note these specialties in the way Django does translation:
- The string domain is
django
ordjangojs
. This string domain is used to differentiate between different programs that store their data in a common message-file library (usually/usr/share/locale/
). Thedjango
domain is used for python and template translation strings and is loaded into the global translation catalogs. Thedjangojs
domain is only used for JavaScript translation catalogs to make sure that those are as small as possible. - Django doesn't use
xgettext
alone. It uses Python wrappers aroundxgettext
andmsgfmt ...
Get Mastering Django: Core now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.