Once the string literals of an application have been tagged for later translation, the translation themselves need to be written (or obtained). Here's how that works.
The first step is to create a message file for a new language. A message file is a plain-text file, representing a single language, that contains all available translation strings and how they should be represented in the given language. Message files have a .po
file extension.
Django comes with a tool, django-admin makemessages
, that automates the creation and upkeep of these files.
The makemessages
command (and compilemessages
discussed later) use commands from the GNU gettext
toolset: xgettext
, msgfmt
, msgmerge
and msguniq
.
The minimum version of the gettext
utilities supported is 0.15.
To create or update a message file, run this command:
django-admin makemessages -l de
... where de
is the locale name for the message file you want to create. For example, pt_BR
for...