Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django makemessages for apps in site-packages

How can I collect translation strings outside of my project folder using Django's built-in makemessages facility? The management command makemessages is very convenient and I'd like to use it for applications located in site-packages.

like image 413
viam0Zah Avatar asked Nov 04 '10 11:11

viam0Zah


2 Answers

(1) Activate a virtual environment where Django is installed.

(2) Go directory of the app for which you want the messages to be generated:

$ cd path/to/app/in/site/packages/

(3) Make sure it has "locale" directory. If not - make one.

$ mkdir locale

(4) From your app directory run the following command:

$ django-admin.py makemessages -l [LANGUAGE_CODE]

Example for Dutch:

$ django-admin.py makemessages -l nl

Example for Russian:

$ django-admin.py makemessages -l ru
like image 125
Artur Barseghyan Avatar answered Nov 06 '22 02:11

Artur Barseghyan


Other than makemessages I found PyBabel very useful. Here is a bind to Django itself: http://babel.edgewall.org/wiki/BabelDjango

like image 39
yaanno Avatar answered Nov 06 '22 02:11

yaanno