Jan 19 2009

External apps i18n in Django

Category: Djangovbmendes @ 12:59

Django has the good feature of internationalization. It’s very simple to use that it generates the .po files automatically from your project. All you have to do is complete the .po file with the translated text. To create these files, all you have to do is create a folder in your project called locale and run the command ./manage.py makemessages -l <your-locale>. That’s very easy, but I realized that it don’t get the string inside your external apps. So, after some search in internet, i found a way to get this file with the app’s strings. And, as all in django must be, it is a pluggable way to solve the problem.

All you have to do is create a folder named locale inside your app’s folder and run the command django-admin.py makemessages -l <your-locale> and it will create the file for you. To compile the messages, use the command django-admin.py compilemessages -l <your-locale>

That’s it, as simple as everything in django.

Tags: , , ,