public function before(PHPTAL_Php_CodeWriter $codewriter) { // ensure that a sources stack exists or create it $codewriter->doIf('!isset($_i18n_sources)'); $codewriter->pushCode('$_i18n_sources = array()'); $codewriter->end(); // push current source and use new one $codewriter->pushCode('$_i18n_sources[] = ' . $codewriter->getTranslatorReference() . '->setSource(' . $codewriter->str($this->expression) . ')'); }