Internationalization in a Django Project

Today I was trying to implement internationalization in a Django project. As I am very new to Django, it took me quite a good amount of time to understand how it works. Besides, I was doing the project in Windows. So, I came across some Windows-specific problems. I followed these steps to implement it successfully:

Step 1
Check if USE_I18N is set to true in Also add the following to the MIDDLEWARE_CLASSES:


Step 2
Create a template (say base.html) and add the following lines:

{% load i18n %}
{% trans "Hello" %}

Step 3
Now, we need to execute makemessages command to make necessary message files. But this gives error in Windows because it requires the gettext utilities. Installing cygwin also solves this problem (See but I downloaded them from

Download the following 3 files:

Now, extract these files in the same folder (say C:\Program Files\gettext-utils) and add “C:\Program Files\gettext-utils\bin” to the system path.

Step 4
Create message files

mkdir locale makemessages -l en makemessages -l fr

Step 5
Update messages and compile compilemessages

Before compiling make sure that the encoding of the message file (django.po) has been set to UTF-8. I was using Eclipse and it had set the encoding to Cp1252. To change it, select the file, go to Properties and change ‘Text file encoding’ to UTF-8.

And see the magic of Django!!

Please follow these links too:


One thought on “Internationalization in a Django Project

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s