Internationalization to 3rd party Django apps

81 views
Skip to first unread message

Luis Masuelli

unread,
Mar 26, 2015, 3:36:44 PM3/26/15
to django...@googlegroups.com
I use django-rest-framework==3.0 in an application as an example case (*) of what I am talking about. Most of the messages in DRF are not internationalized, and had to use the following mechanism to create the internationalization for DRF messages:
  • Properly set LANGUAGES and locale directories, so `makemessages` knows where to store the generated messages.
  • Add a symbolic link into my django root directory, pointing to the directory being the rest_framework package (in site-packages).
  • Running `makemessages` adding the `--symlinks` options, so the rest_framework would be inspected as well as the regular (project-wise) applications are.
  • Removing the symbolic link I created, from my django root directory.

Finally, assuming the global locale dirs are set accordingly, I get the messages being generated for the desired locales (i.e. I only have to edit the .po files with the appropiate translations).

I don't like this method. Looks ugly. Isn't there another method to grab ugettexted messages from 3rd party applications and add them to django.po?

(* Please: don't attend my problem in terms of DRF since I could have another issue with another application and would need to ask the same question again)
Reply all
Reply to author
Forward
0 new messages