public function setTarget($key, $value)
    {
        $unit = $this->searchForId($key, true);

        $target = $this->getXPathFirstItem('xliff:target', $unit);

        // If already present check.
        if ($target === null) {
            $target = $unit->appendChild($this->doc->createElementNS(self::NS, 'target'));
        } elseif ($target->firstChild) {
            // If already present, we have to remove the textnode if one exists as otherwise the value will get
            // appended.
            $target->removeChild($target->firstChild);
        }

        $target->appendChild($this->doc->createTextNode($value));
    }
public function setTarget($key, $value)
    {
        $unit = $this->searchForId($key, true);

        $target = $this->getXPathFirstItem('xliff:target', $unit);

        // If already present check.
        if ($target === null) {
            $target = $unit->appendChild($this->doc->createElementNS(self::NS, 'target'));
        } elseif ($target->firstChild) {
            // If already present, we have to remove the textnode if one exists as otherwise the value will get
            // appended.
            $target->removeChild($target->firstChild);
        }

        $target->appendChild($this->doc->createTextNode($value));
    }
public function setTarget ( $ key , $ value ) { $ unit = $ this -> searchForId ( $ key , true ) ; $ target = $ this -> getXPathFirstItem ( 'xliff:target' , $ unit ) ; // If already present check. if ( $ target === null ) { $ target = $ unit -> appendChild ( $ this -> doc -> createElementNS ( self :: NS , 'target' ) ) ; } elseif ( $ target -> firstChild ) { // If already present, we have to remove the textnode if one exists as otherwise the value will get // appended. $ target -> removeChild ( $ target -> firstChild ) ; } $ target -> appendChild ( $ this -> doc -> createTextNode ( $ value ) ) ; }
Sets the target value for the given key to the given value.

@param string $key   The key for the translation string.

@param string $value The value to use.

@return void
Sets the target value for the given key to the given value .