Django: Only a single element gets translated

前端 未结 2 1025
你的背包
你的背包 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

    0 讨论(0)
  • 2021-01-07 01:45

    Gah! I got bit by the same issue as this guy : https://code.djangoproject.com/ticket/18492

    Namely that a trailing comma was missing in the LOCALE_PATHS tuple. Too bad Django doesn't raise an error for that.

    0 讨论(0)
提交回复
热议问题