Translated strings do not appear when I switch languages ​​on a Django site

I have a fairly simple Django site (1.1), where I need a basic interface and other texts to translate between two languages. I created po files using manage.py makemessages, translated them (using poedit) and compiled mo files using manage.py compilemessages, as described in the i18n docs for Django .

But the problem is this; most lines are still displayed in the original language ...

  • I checked that the po files actually contain all the lines
  • I checked that the mo files were just created after the last translation effort.
  • the language really changes when I switch using the method getlang()
  • multiple lines - end up being translated when I switch
  • but most of them don’t ...

Not sure where else to look ... Is there any application that I can use to check if the compiled mo files are really valid and complete? Can these lines be cached? (I do not use middleware for caching)

+3
source share
1 answer

Found! Pulling my hair out, trying to understand what was causing my problems, I commented django.middleware.locale.LocaleMiddlewarefrom mine MIDDLEWARE_CLASSESand reloaded the page in an attempt to try everything. Obviously, I just turned off the translation, but when I turned it back on, all of my beautiful translated lines appeared as they should have been all the time.

, - , - /, , - . , , !:)

+2

Source: https://habr.com/ru/post/1765276/


All Articles