开发者

Getting list of all strings from a Django app

开发者 https://www.devze.com 2023-01-11 20:48 出处:网络
Eclipse has a function called Externalise all Strings, which will move all strings to an properties file.

Eclipse has a function called Externalise all Strings, which will move all strings to an properties file.

Is there such a solution available for Django/Python?

Basically I have a large project with number of views/models/templates, and going through all of them, and putting

string -> _("string") etc is a big pain, so is there a way to autom开发者_JAVA百科ate this?


It is automated in Django and has been for a long time. But the docs are a bit hard to find ;)

You can use the makemessages management command, or if you run an older version of django run django/bin/make-messages.py.

Link to the docs: http://docs.djangoproject.com/en/dev/ref/django-admin/#makemessages

Example:

django-admin.py makemessages --locale=en
0

精彩评论

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