On Sun, Mar 14, 2010 at 8:43 PM, Tom Boutell <[email protected]> wrote:
> Your "throw some __() calls that don't do anything in there" technique
> is a useful one which I'll keep in mind for anything I can't resolve
> by instantiating and querying and etc. Thanks.
Personally and even if I wouldn't recommend this technique as a best
practice, I just load the __() helper globally from a configuration
class. Example within a plugin configuration class:
class myPluginConfiguration extends sfPluginConfiguration
{
public function initialize()
{
$this->dispatcher->connect('context.load_factories', array($this,
'listenToLoadFactoriesEvent'));
}
public function listenToLoadFactoriesEvent(sfEvent $event)
{
$event->getSubject()->getConfiguration()->loadHelpers(array('I18N'));
}
}
So you can use the __() helper directly in your forms (and controllers
btw), and so the i18n:extract task tokenizer will be able to parse
form (but you'll have to tweak the extract task class though). It's a
bit weird to have this "global" function available, but I gained so
much time and brainhealth by doing so that I can't really be ashamed
of using it ;)
I should add that even if it's especially handy for i18n error
messages, it should not be used for help texts or labels; those should
be always handled in templates.
My 2 cents.
++
--
Nicolas Perriault
http://prendreuncafe.com - http://symfonians.net
Mobile: +33 660 92 08 67
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en