开发者

How to extract labels from Symfony forms I18n Extract Task

I am quite aware that the extract task accepts application as a parameter, and th开发者_运维知识库us one can't expect it too look into the forms folder. However, I referred the link (below) and tried a couple of ways: 1. defining my proxy __() method 2. including the I18n helper in App Configuration However, both aren't working.

Can anyone tell me how to extract these from the form classes? Thanks

http://groups.google.com/group/symfony-devs/browse_thread/thread/1d034f5f7367fe0c


You need to use the i18n helper and add the translated strings manually to your XML/XLIFF files. The translations themselves work, it's just the i18n:extract task that doesn't look inside form classes so it has to be done manually. I hope they add this feature in Symfony 2.0.

See the first few paragraphs here: http://www.symfony-project.org/forms/1_4/en/08-Internationalisation-and-Localisation


There's a way to extract it altough it's not recommended by the developers:

In lib/i18n/extract/sfI18nApplicationExtract.class.php add:

$this->extractFromPhpFiles(sfConfig::get('sf_lib_dir').'/form');     

to function extract()

In your form class's configure method add: sfLoader::loadHelpers('I18N');

This way you can use the __() function in your form class.

I'm currently testing it. Will share my findings.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜