src/Serializer.php
public function exportTranslatable(TranslatableInterface $translatable, $targetLang) {
    $this->openMemory();
    $this->setIndent(TRUE);
    $this->setIndentString(' ');

    $this->startElement('xlf:group');
    $this->writeAttribute('id', $translatable->getIdentifier());
    $this->writeAttribute('restype', 'x-eggs-n-cereal-translatable');

    // Retrieve and flatten translatable data.
    $translatableData = $translatable->getData();
    $flattenedData = Data::flattenData($translatableData);

    // @todo: Write in nested groups instead of flattening it.
    $data = array_filter($flattenedData, array('EggsCereal\Utils\Data', 'filterData'));
    foreach ($data as $key => $element) {
      $this->addTransUnit($key, $element, $targetLang);
    }
    $this->endElement();
    return $this->outputMemory();
  }
public function exportTranslatable(TranslatableInterface $translatable, $targetLang) {
    $this->openMemory();
    $this->setIndent(TRUE);
    $this->setIndentString(' ');

    $this->startElement('xlf:group');
    $this->writeAttribute('id', $translatable->getIdentifier());
    $this->writeAttribute('restype', 'x-eggs-n-cereal-translatable');

    // Retrieve and flatten translatable data.
    $translatableData = $translatable->getData();
    $flattenedData = Data::flattenData($translatableData);

    // @todo: Write in nested groups instead of flattening it.
    $data = array_filter($flattenedData, array('EggsCereal\Utils\Data', 'filterData'));
    foreach ($data as $key => $element) {
      $this->addTransUnit($key, $element, $targetLang);
    }
    $this->endElement();
    return $this->outputMemory();
  }
public function exportTranslatable ( TranslatableInterface $ translatable , $ targetLang ) { $ this -> openMemory ( ) ; $ this -> setIndent ( TRUE ) ; $ this -> setIndentString ( ' ' ) ; $ this -> startElement ( 'xlf:group' ) ; $ this -> writeAttribute ( 'id' , $ translatable -> getIdentifier ( ) ) ; $ this -> writeAttribute ( 'restype' , 'x-eggs-n-cereal-translatable' ) ; // Retrieve and flatten translatable data. $ translatableData = $ translatable -> getData ( ) ; $ flattenedData = Data :: flattenData ( $ translatableData ) ; // @todo: Write in nested groups instead of flattening it. $ data = array_filter ( $ flattenedData , array ( 'EggsCereal\Utils\Data' , 'filterData' ) ) ; foreach ( $ data as $ key => $ element ) { $ this -> addTransUnit ( $ key , $ element , $ targetLang ) ; } $ this -> endElement ( ) ; return $ this -> outputMemory ( ) ; }
Adds a translatable item to the XML export.

@param TranslatableInterface $translatable
The translatable to serialize.

@param string $targetLang
The desired translatable.

@return string
The generated XML.
Adds a translatable item to the XML export .