Ticket #7296: 7296.diff
File 7296.diff, 2.7 KB (added by , 13 months ago) |
---|
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/cli/class-language-pack.php
510 510 return $match[1]; 511 511 } 512 512 513 /** 513 /** 514 * Builds a PHP file for translations. 515 * 516 * @param GP_Project $gp_project The GlotPress project. 517 * @param GP_Locale $gp_locale The GlotPress locale. 518 * @param GP_Translation_Set $set The translation set. 519 * @param Translation_Entry[] $entries The translation entries. 520 * @param string $dest Destination file name. 521 * @return bool True on success, false on error. 522 */ 523 private function build_php_file( $gp_project, $gp_locale, $set, $entries, $dest ) { 524 $format = gp_array_get( GP::$formats, 'php' ); 525 $content = $format->print_exported_file( $gp_project, $gp_locale, $set, $entries ); 526 527 return false !== file_put_contents( $dest, $content ); 528 } 529 530 /** 514 531 * Executes a command via exec(). 515 532 * 516 533 * @param string $command The escaped command to execute. … … 652 669 $json_file_base = "{$export_directory}/{$filename}"; 653 670 $po_file = "{$export_directory}/{$filename}.po"; 654 671 $mo_file = "{$export_directory}/{$filename}.mo"; 672 $php_file = "{$export_directory}/{$filename}.mo.php"; 655 673 $zip_file = "{$export_directory}/{$filename}.zip"; 656 674 $build_zip_file = "{$build_directory}/{$wp_locale}.zip"; 657 675 $build_sig_file = "{$build_zip_file}.sig"; … … 666 684 unset( $mapping['po'] ); 667 685 668 686 // Create JED json files for each JS file. 669 $ json_files = $this->build_json_files( $data->gp_project, $gp_locale, $set, $mapping, $json_file_base );687 $additional_files = $this->build_json_files( $data->gp_project, $gp_locale, $set, $mapping, $json_file_base ); 670 688 689 // Create PHP file. 690 $php_file_written = $this->build_php_file( $data->gp_project, $gp_locale, $set, $po_entries, $php_file ); 691 692 if ( $php_file_written ) { 693 $additional_files[] = $php_file; 694 } 695 671 696 // Create PO file. 672 697 $last_modified = $this->build_po_file( $data->gp_project, $gp_locale, $set, $po_entries, $po_file ); 673 698 … … 703 728 escapeshellarg( $zip_file ), 704 729 escapeshellarg( $po_file ), 705 730 escapeshellarg( $mo_file ), 706 implode( ' ', array_map( 'escapeshellarg', $ json_files ) )731 implode( ' ', array_map( 'escapeshellarg', $additional_files ) ) 707 732 ) ); 708 733 709 734 if ( is_wp_error( $result ) ) {