xgettext does not extract string in HTML attribute

纵饮孤独 提交于 2019-12-02 01:45:20

That’s because you are not actually extracting from “HTML atttributes”, but from a template language that xgettext has no support for. To work around that you are, I’m guessing, using the gross Python hack from that page. In effect, you are lying to xgettext/Poedit about what the file contains, with results that are, frankly, to be expected. Is the file a valid Python file? No, it isn’t, it’s Twig. You can’t really expect it to be parsed correctly when you mislead the tool about the language.

Instead, I recommend doing what that page also recommends, and as a better way:

A nicer solution is to use Twig-Gettext-Extractor, a special Twig parser to Poedit. The linked page contains instructions on how to set it up.

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