almost 6 years ago

Yesterday, I try to use i18n in django 1.4 and I face into a bottleneck immediately.

The basic steps are:

  1. Use ugettext to translate the word you want.
  2. Make a locale folder in your django project folder.
  3. Make .po files through django-admin.py makemessages -l en
  4. Compile the messages through django-admin.py compilemessages

It seems that I did everything mentioned in the official guild. And it works
on django 1.3. But, it is not work in 1.4. Why?

Because, in 1.4, django won't discover the translation in project folder. All
you have to do is adding the locale path in settings.py.

LOCALE_PATHS = (  
    os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'locale'),  
)
← MVC 與 MVVM Login by remote user in django →
 
comments powered by Disqus