Güngör Budak's Blog

Bioinformatics, web programming, coding in general

Django Rosetta Translations for Django Applications

Make a directory called locale/ under the application directory:

cd app_name
mkdir locale

Add the folder in LOCAL_PATHS dictionary in settings.py:

    os.path.join(PROJECT_ROOT, 'app_name', 'locale/'),

Run the following command to create PO translation file for the application:

python ../manage.py makemessages -l tr -e html,py,txt
python ../manage.py compilemessages

Option -l is for language, it should match your definition in settings.py:

    ('en' _('English')),
    ('tr' _('Turkish')),
    ('it' _('Italian')),

Repeat the last step for all languages and the go to Rosetta URL to translate.