Thursday, March 26, 2015

Internationalization to 3rd party Django apps

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)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ce5a3555-3b70-4ded-99eb-ef37439dc8cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment