django - how to make translation work?

前端 未结 9 1099
不知归路
不知归路 2020-12-13 04:00

I\'m trying to render a template in a different language using i18n. I did everything I could read about, from setting the language code, creating and compiling translation

9条回答
  •  暖寄归人
    2020-12-13 04:55

    I may be wrong - as the only time I used translation stuff was on a test project many moons ago - but I think you don't want this:

    $ django-admin.py makemessages -l he-il -e html

    But rather this:

    $ django-admin.py makemessages -l he_il -e html

    Notice the underscore in he_il.

    I was having issues with pt-BR too, until I made the messages file with pt_br instead. Then things started working...

    Yeah, it is not obvious and I couldn't find documentation about it anywhere.

    Hope that helps.

提交回复
热议问题