开发者

How do I make django translate certain files?

开发者 https://www.devze.com 2023-03-18 21:58 出处:网络
I\'m running django-admin.py makemessages -l es from within my app directory to create trnaslation strings. The result includes only those texts that are located in my app directory. My templates dire

I'm running django-admin.py makemessages -l es from within my app directory to create trnaslation strings. The result includes only those texts that are located in my app directory. My templates directory to that app is loc开发者_StackOverflowated outside the app's directory. How do I ask django to translate my template files too?

I didn't want to run the above command from within the project's dir, because my project contains certain folders that I do not want to translate.


Never mind, I found the answer. You have to create symlinks to the folders you want to get translated (i.e. templaets) and copy those symlinks to you apps directory and run the above command with --symlinks included.


If i understand correctly you'll need to use django's trans and blocktrans template tags to translate certain strings of text.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号