gettext translation not working on production system

后端 未结 2 1221
北海茫月
北海茫月 2021-01-13 00:56

I\'ve encountered a strange problem when translating strings (in the admin) using django\'s gettext: Locally running the dev server all translations are display

相关标签:
2条回答
  • 2021-01-13 01:24

    I had a similar problem and apart from what Tomasz Zielinski pointed out I had to make the following changes:

    in settings.py

    LOCALE_PATHS = (
        "/path/to/your/project/locale",
    )
    

    Remember the trailing slash and make sure that the directory structure looks something like:

    project
       your_app
       your_other_app
       locale
          en_US
              LC_MESSAGES
          sv_SE
              LC_MESSAGES
    
    0 讨论(0)
  • 2021-01-13 01:36

    A few possibilities:

    • production server doesn't see the compiled messages
    • the untranslated messages are marked as fuzzy
    • _() resolves to ugettext instead of ugettext_lazy
    0 讨论(0)
提交回复
热议问题