get_domain(); if( $pot_path = $package->get_pot($domain) ){ $exp = LocoAdmin::parse_po( $pot_path ); if( ! $exp || ( 1 === count($exp) && '' === $exp[0]['source'] ) ){ // fall through to try source code } else { $pot = basename($pot_path); break; } } } // Extract from sources if( $exp = LocoAdmin::xgettext( $package, dirname($path) ) ){ $pot = ''; break; } throw new Exception( __('No strings could be extracted from source code','loco-legacy') ); } // sync selected headers $headers = array(); if( '' === $exp[0]['source'] ){ $keep = array('Project-Id-Version','Language-Team','POT-Creation-Date','POT-Revision-Date'); $head = loco_parse_po_headers( $exp[0]['target'] ); $headers = array_intersect_key( $head->export(), array_flip($keep) ); /*/ add prefixed header keys that can't be included above foreach( $head as $key => $value ){ if( 0 === strpos($key, 'X-Poedit-' ) ){ $headers[$key] = $value; } }*/ $exp[0] = array(); } // sync ok. return compact( 'pot', 'exp', 'headers' );