Problems with multilanguage application in translating models
I'm writing an application, which will be used in several languages: 'en', 'de', 'fr', 'es' and 'pl'. I provided translation strings for every string that needs to be translated, I prepared the translation files and compiled them.
Then, I set the LANGUAGES variable and added the LocaleMiddleware in settings.py.
The problem is, when I enter the page, say /admin/, the 开发者_如何学JAVAstrings provided as strings are translated properly (I use 'pl' in Accept-Language), but the strings in models and forms (like labels and verbose_names) are displayed in the LANGUAGE_CODE language (when I change the language code, the models are translated).
Anyone got an idea, what's wrong?
have you tried
from django.utils.translation import ugettext as _
verbose_names = _("Eggs")
I've been using ugettext instead of ugettext_lazy. Remember to use the latter for django's strings!
精彩评论