how to translate an app template [closed]

a 夏天 提交于 2019-12-01 23:46:29

问题


I want to use multiple language in my app and for that i have followed this doc

After the creation of django.po inside locale folder, I opened that, as this files contain '#' which told you that which line you can translate. But this file only contain admin part it does not have my app templates i.e., HTML files of my app.

So how I can translate those HTML files, OR what should I have to do so that django.po file can also contain my app templates.

I have followed only this doc.


回答1:


You need to use the {% trans %} or {% blocktrans %} template tags in your html files before you run

python manage.py makemessages -l <locale>

If you have done that, and your HTML templates are inside your source tree, then makemessages should pick them up. If you haven't used those template tags, then you won't see any output from them in your .po file.



来源:https://stackoverflow.com/questions/12890935/how-to-translate-an-app-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!