Django Rosetta Translations for Django Applications
By Güngör Budak
- One minute read - 91 wordsMake a directory called locale/
under the application directory:
cd app_name
mkdir locale
Add the folder in LOCAL_PATHS
dictionary in settings.py
:
1LOCALE_PATHS = (
2 os.path.join(PROJECT_ROOT, 'app_name', 'locale/'),
3)
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
:
1LANGUAGES = (
2 ('en' _('English')),
3 ('tr' _('Turkish')),
4 ('it' _('Italian')),
5)
Repeat the last step for all languages and the go to Rosetta URL to translate.