Symfony - form localization
I've started localizing my Symfony project but when I tried to use the __()
function inside actions.class.php it came up with an error: Call to undefined function __()
. The texts I have inside actions class are the form's labels and errors.
How can I localize these labels and errors if I am not allowed to use __()
function? Is the s开发者_运维百科imple translation into the catalogue enough? The same question applies for the Form classes.
Thank you.
in form $this->widgetSchema->setLabel('foobar');
will be automaticly translated: http://www.symfony-project.org/forms/1_4/en/08-Internationalisation-and-Localisation
the __() function usually works only in the templates with enabled i18n helper.
if you want to translate something in the action you will have to load the helper there. sfLoader::loadHelpers(array('I18n'));
精彩评论