$translation->
setAttribute('id',
strtr(substr(base64_encode(hash('sha256',
$source, true
)), 0, 7
), '/+', '._'
));
$translation->
setAttribute('resname',
$source);
$s =
$translation->
appendChild($dom->
createElement('source'
));
$s->
appendChild($dom->
createTextNode($source));
// Does the target contain characters requiring a CDATA section?
$text = 1 ===
preg_match('/[&<>]/',
$target) ?
$dom->
createCDATASection($target) :
$dom->
createTextNode($target);
$targetElement =
$dom->
createElement('target'
);
$metadata =
$messages->
getMetadata($source,
$domain);
if ($this->
hasMetadataArrayInfo('target-attributes',
$metadata)) { foreach ($metadata['target-attributes'
] as $name =>
$value) { $targetElement->
setAttribute($name,
$value);
} } $t =
$translation->
appendChild($targetElement);
$t->
appendChild($text);
if ($this->
hasMetadataArrayInfo('notes',
$metadata)) { foreach ($metadata['notes'
] as $note) { if (!
isset($note['content'
])) { continue;
}