setFromString example


  private function readHeader() {
    $item = $this->readItem();
    // Handle the case properly when the .po file is empty (0 bytes).     if (!$item) {
      return;
    }
    $header = new PoHeader();
    $header->setFromString(trim($item->getTranslation()));
    $this->header = $header;
  }

  /** * Reads a line from the PO stream and stores data internally. * * Expands $this->current_item based on new data for the current item. If * this line ends the current item, it is saved with setItemFromArray() with * data from $this->current_item. * * An internal state machine is maintained in this reader using * $this->context as the reading state. PO items are in between COMMENT * states (when items have at least one line or comment in between them) or * indicated by MSGSTR or MSGSTR_ARR followed immediately by an MSGID or * MSGCTXT (when items closely follow each other). * * @return bool|null * FALSE if an error was logged, NULL otherwise. The errors are considered * non-blocking, so reading can continue, while the errors are collected * for later presentation. */
Home | Imprint | This part of the site doesn't use cookies.