WordPress.org

Making WordPress.org

Changeset 7893


Ignore:
Timestamp:
11/24/2018 02:06:04 PM (7 months ago)
Author:
ocean90
Message:

Plugin Directory: Use wp i18n make-pot for string extraction.

Props herregroen.
See #3748.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/i18n/class-code-import.php

    r6287 r7893  
    2323     */
    2424    public function import_from_tag( $tag ) {
     25        if ( ! defined( 'WPORGTRANSLATE_WPCLI' ) ) {
     26            throw new Exception( 'Missing configuration for WPORGTRANSLATE_WPCLI.' );
     27        }
     28
    2529        $svn_url = $this->get_plugin_svn_url( $tag );
    2630
     
    4347        }
    4448
    45         if ( ! class_exists( '\PotExtMeta' ) ) {
    46             require_once plugin_dir_path( \WordPressdotorg\Plugin_Directory\PLUGIN_FILE ) . 'libs/i18n-tools/makepot.php';
    47         }
     49        $pot_file = "{$tmp_directory}/{$this->plugin}-code.pot";
    4850
    49         $pot_file = "{$tmp_directory}/{$this->plugin}-code.pot";
    50         $makepot  = new \MakePOT();
     51        $cmd = sprintf(
     52            '%s i18n make-pot %s %s --slug=%s --ignore-domain --skip-audit',
     53            WPORGTRANSLATE_WPCLI,
     54            escapeshellarg( $export_directory ),
     55            escapeshellarg( $pot_file ),
     56            escapeshellarg( $this->plugin )
     57        );
    5158
    52         if ( ! $makepot->wp_plugin( $export_directory, $pot_file, $this->plugin ) || ! file_exists( $pot_file ) ) {
     59        exec( $cmd, $output, $return_code );
     60
     61        if ( 0 !== $return_code || ! file_exists( $pot_file ) ) {
    5362            throw new Exception( "POT file couldn't be created." );
    5463        }
Note: See TracChangeset for help on using the changeset viewer.