Django 1.2.3 - Internationalization - makemessages does not detect all strings

拥有回忆 提交于 2019-12-04 16:09:55

Django's Javascript message parsing is quite fragile. I've written up the details why this is so. I also have a fix for Django 1.3 attached to Django ticket 7704. Django may not accept the patch, maybe you can help explain to them why they should? :)

I've just solved the problem of strings not translated at runtime. It came from the fact that my "locale" directory was under the project root. I had to add "my_project_root_dir" to settings.INSTALLED_APPS to receive a correct javascript catalog.

For the problem of not detected strings, I still have no idea about how to make django makemessages find all the strings but I have a temporary solution. I added the strings to the mo file manually and it works. However, django makemessages remove the strings so it can't be used anymore.

The mechanism is different for javascript files. The translations are not generated into the regular po file but into a javascript catalog.

Look at this explanation in the Django book.

I hope it helps

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