2012-11-15 80 views
1

縱觀the documentation我找不到任何提及它的地方,所以我會問:枝條i18n擴展是否支持可以通過gettext提取的嵌入式註釋?換句話說,是有這樣的一個等價的樹枝語法:向Twig模板添加gettext註釋?

/// 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

因爲似乎沒有成爲這方面的任何設施,在此期間,我已經爲它寫了一個擴展名:Twig_Extension_Gettext。它增加了很多缺少的gettext功能,包括支持可提取評論的本地模板解析器。