1

I've got a site with translation strings in both the HTML templates and the views.py, forms.py and models.py files. Django has created the django.po file for my second language, and I have entered most of the translations. However, only translations in my .html and view.py files are showing up on the site. the others are being ignored it seems (models.py, forms.py - both defaulting to English)

What's going on?

I've obviously compiled my django.mo file and that's working - otherwise a lot of template strings wouldn't be translated - so why is it ignoring my models.py translations. Both in the admin site and the front end.

One thought is that there may be an error in the django.mo file that causes it to break. Is there any way to test a django.mo file for errors? Would it work at all if there was an error?

My project also has Django-cms installed, which could be causing some conflict?

Thanks for any light shed.

Guy

Guy Bowden
  • 4,997
  • 5
  • 38
  • 58

1 Answers1

2

1.Make sure you are always using ugettext_lazy (not ugettext) in model and form definitions

2.Remove possible fuzzy tags in the .mo files.

Bernhard Vallant
  • 49,468
  • 20
  • 120
  • 148
  • briefly - what's the difference between _lazy and not _lazy then? This made it work... – Guy Bowden Nov 12 '10 at 15:17
  • The `_lazy` version translates EVERYTIME the string is accessed, the normal version only once the code is run, which happens for forms and modules only on django's startup ONCE! – Bernhard Vallant Nov 12 '10 at 15:23