Now that our project is in place, let's tell Django that we are planning to use i18n in it. We'll start by adding some configuration settings.
In the mycompany/settings.py
file, find the LANGUAGE_CODE
setting and add an additional commented line for the German language setting de
:
LANGUAGE_CODE = 'en'
#LANGUAGE_CODE = 'de'
These settings will tell Django that our project's default language is English, but the commented line will make it easy for us to switch the site to German for testing later.
While you're still in the file, make sure we're loading the internationalization machinery. (It's set to True
by default, but make sure.)
USE_I18N = True
We'll need to create a directory where the i18n files are kept. Create a directory called locale
in the mycompany
folder at the root of your project:
$ mkdir /projects/mycompany/locale