Django: Only a single element gets translated

前端 未结 2 1026
你的背包
你的背包 2021-01-07 01:35

Porting a Django site from 1.2 to 1.5 on Python 2.6 i ran into problems with internationalization.

The wierd thing is that only one string gets translated in the en

2条回答
  •  攒了一身酷
    2021-01-07 01:43

    I had a similar issue that I resolved in making sure that whenever I update the django.po file, I compile it:

    ./manage.py compilemessages

    The translation get done from the compiled file (django.mo) and not the .po file

    1. Generate the translation file: ./manage.py makemessages -a
    2. Translate: manually or using a tool like autotranslate
    3. compile the file: ./manage.py compilemessages
    4. Test to see the changes: not that the default language might be picked first, make sure that you change the language. For example change localhost:8000/en/ to localhost:8000/fr/ or localhost:8000/foo/ depending on the language you want to see

    I hope this helps

提交回复
热议问题