Why is Django only showing some of my translations
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 - bot开发者_运维知识库h 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
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.
精彩评论