setEntry() public method

If entry not found returns false. If $createNew is true, a new entry will be created. $entry is an array that can contain following indexes: - msgid: String Array. Required. - msgstr: String Array. Required. - reference: String Array. - msgctxt: String. Disambiguating context. - tcomment: String Array. Translator comments. - ccomment: String Array. Source comments. - msgid_plural: String Array. - flags: Array. List of entry flags. Example: array('fuzzy','php-format') - previous: Array: Contains previous untranslated strings in a sub array with msgid and msgstr.
public setEntry ( String $msgid, Array $entry, boolean $createNew = true )
$msgid String Id of entry. Be aware that some entries have a multiline msgid. In that case \n must be replaced by the value of 'multiline-glue' option (by default "<##EOL##>").
$entry Array Array with all entry data. Fields not setted will be removed.
$createNew boolean If msgid not found, it will create a new entry. By default true. You want to set this to false if need to change the msgid of an entry.
Exemplo n.º 1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $inFile = new FileHandler($input->getArgument('from'));
     $outFileLocation = $input->getArgument('to');
     $poParser = new PoParser($inFile);
     $messages = $poParser->parse($inFile);
     foreach ($messages as $msgid => $message) {
         $message = $this->translateMessage($message);
         $poParser->setEntry($msgid, $message, false);
     }
     $poParser->writeFile($outFileLocation);
 }