Search code examples
phpzend-frameworkzend-translatepoedit

Poedit not recognizing translation value - why?


I am building a multi-language site and present my text in the form _('mytext') or _("mytext") so that Poedit can recognize it and add it to my pending translations. Why is the text below not recognized unless I remove the : {$form->getValue('email')} part? How can I modify this so Poedit picks it up?

$this->view->errors = array(
              array(_("{$form->getValue('email')} is already registered with this site. If you have
              forgotten your password, click on the link and we will send you a new one"))
            );

Solution

  • The solution seems easy:

    $this->view->errors = array(
              array($form->getValue('email') . _(" is already registered with this site. If you have
              forgotten your password, click on the link and we will send you a new one"))
            );
    

    As to the why, I'm not sure, but it does not seem like a good idea that anybody could inject php variables using a program like poedit.