将gettext注释添加到Twig模板?

时间:2012-11-15 12:26:34

标签: twig

查看the documentation我找不到任何提及,所以我会问:Twig i18n扩展是否支持嵌入式注释,可以通过gettext提取?换句话说,是否有相同的Twig语法:

/// TRANSLATORS: Please leave %s as it is, because it is needed by the program.
/// Thank you for contributing to this project.
printf(_("My name is %s."), $myName);

可以提取为:

#. TRANSLATORS: Please leave %s as it is, because it is needed by the program.
#. Thank you for contributing to this project.
msgid "My name is %s."
msgstr ""

1 个答案:

答案 0 :(得分:1)

由于似乎没有任何设施,与此同时我已为其编写了一个扩展名:Twig_Extension_Gettext。它添加了许多缺少的gettext功能,包括支持可提取注释的本机模板解析器。