Internationalisation Django (on OSX)

前端 未结 3 730
不知归路
不知归路 2020-12-23 17:02

I\'m trying to get gettext to work in Django on my OSX Leopard

django_manage.py makemessages -l nl
Importing Django settings module settings
processing langu         


        
3条回答
  •  伪装坚强ぢ
    2020-12-23 17:31

    Forcing brew link may result in negative consequences. It's better to modify virtual environment's PATH instead of force-linking. So,

    1. Install GNU gettext:

      brew install gettext
      
    2. Add it to your virtual environment:

      # Get this from the brew's "Summary"
      GETTEXT_PATH="/usr/local/Cellar/gettext/0.19.8.1/bin" 
      
      # Change "postactivate" to "activate" if you're using python3's venv
      FILE="YOUR_VENV/bin/postactivate"   
      
      echo "" >> $FILE
      echo "export PATH=\$PATH:$GETTEXT_PATH" >> $FILE
      

提交回复
热议问题