protected function addTransUnit($key, $element, $targetLang) {
    $this->startElement('xlf:group');
    $this->writeAttribute('id', $key);
    $this->writeAttribute('resname', $key);
    $this->writeAttribute('restype', 'x-eggs-n-cereal-field');

    //escape named html entities prior to conversion
    $list = get_html_translation_table(HTML_ENTITIES);
    $namedTable = array();
    foreach($list as $k=>$v){
      $namedTable[$v]= "&amp;".str_replace('&', '',$v);
    }
    $element['#text'] = strtr($element['#text'], $namedTable);

    try {
      $converter = new Converter($element['#text'], $this->sourceLang, $targetLang);
      if ($this->logger) {
        $converter->setLogger($this->logger);
      }
      $this->writeRaw($converter->toXLIFF());
    }
    catch (\Exception $e) {
      $this->startElement('trans-unit');
      $this->writeAttribute('id', uniqid('text-'));
      $this->writeAttribute('restype', 'x-eggs-n-cereal-failure');
      $this->startElement('source');
      $this->writeAttribute('xml:lang', $this->sourceLang);
      $this->text($element['#text']);
      $this->endElement();

      $this->startElement('target');
      $this->writeAttribute('xml:lang', $targetLang);
      $this->text($element['#text']);
      $this->endElement();
      $this->endElement();
    }
    if (isset($element['#label'])) {
      $this->writeElement('note', $element['#label']);
    }
    $this->endElement();
  }