setOptions( array( 'format' => 'mod-example-[LOCALE].xml' ) ); // get the original context $context = $backend->getContext( 'nl_NL', 'existing' ); // the modifications $context[] = new ezcTranslationData( 'added', 'toegevoeg', 'comment', ezcTranslationData::TRANSLATED ); $context[] = new ezcTranslationData( 'update with new translation', 'ingevuld', NULL, ezcTranslationData::TRANSLATED ); $context[] = new ezcTranslationData( 'update translation', 'bijgewerkt', NULL, ezcTranslationData::TRANSLATED ); $context[] = new ezcTranslationData( 'to obsolete', 'markeren als ongebruikt', NULL, ezcTranslationData::OBSOLETE ); // init the writer, and write the modified context $backend->initWriter( 'nl_NL' ); $backend->storeContext( 'existing', $context ); // create a new context and write it $context = array(); $context[] = new ezcTranslationData( 'new string', 'nieuwe string', NULL, ezcTranslationData::TRANSLATED ); $backend->storeContext( 'new', $context ); // deinit the writer $backend->deinitWriter(); // read the context again, while keeping obsolete strings $backend->setOptions( array( 'keepObsolete' => true ) ); $context = $backend->getContext( 'nl_NL', 'existing' ); // re-format the written file and show it `cat /tmp/mod-example-nl_NL.xml | xmllint --format - > /tmp/formatted.xml`; echo file_get_contents( '/tmp/formatted.xml' ); ?>