Book Image

Django 1.0 Template Development

Book Image

Django 1.0 Template Development

Overview of this book

Table of Contents (17 chapters)
Django 1.0 Template Development
Credits
About the Author
About the Reviewers
Preface
Index

Creating message files


A message file is a plain-text file that contains all the named translation strings and how they should appear in a given language. Each language you choose to support will get its own message file.

To create a message file, we use the django-admin.py script. Make sure you have created the locale directory in your project root before doing this. (We covered this in an earlier step.) Navigate to your project root and use the script to make a message file:

$ cd /projects/mycompany/
$ django-admin.py makemessages –l en

We're telling the makemessages command to create a language file for en (English). Recall that in our settings.py file we defined this as the default language by setting it as the LANGUAGE_CODE.

Look in your mycompany/locale directory, and you will see a series of nested directories have been created. In the mycompany/locale/en/LC_MESSAGES directory, you'll find a file called django.po. This is the message file that was created.

Here's an excerpt from mycompany...