Make WordPress Core

Changeset 31319


Ignore:
Timestamp:
01/31/2015 10:01:33 PM (10 years ago)
Author:
ocean90
Message:

i18n tools: Sync makepot.php with i18n.svn.

fixes #31193.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/i18n/makepot.php

    r31315 r31319  
    2424        'mu',
    2525        'bp',
     26        'glotpress',
    2627        'rosetta',
    2728        'wporg-bb-forums',
     
    242243    }
    243244
    244     function wp_frontend($dir, $output) {
    245         if ( ! file_exists( "$dir/wp-admin/user/about.php" ) ) return false;
     245    function wp_frontend( $dir, $output ) {
     246        if ( ! file_exists( "$dir/wp-admin/user/about.php" ) ) {
     247            return false;
     248        }
     249
     250        $excludes = array( 'wp-admin/.*', 'wp-content/themes/.*', 'wp-includes/class-pop3\.php' );
     251
     252        // Exclude Akismet all together for 3.9+.
     253        if ( file_exists( "$dir/wp-admin/css/about.css" ) ) {
     254            $excludes[] = 'wp-content/plugins/akismet/.*';
     255        }
    246256
    247257        return $this->wp_generic( $dir, array(
    248258            'project' => 'wp-frontend', 'output' => $output,
    249259            'includes' => array(),
    250             'excludes' => array( 'wp-admin/.*', 'wp-content/themes/.*', 'wp-includes/class-pop3\.php' ),
     260            'excludes' => $excludes,
    251261            'default_output' => 'wordpress.pot',
    252262        ) );
     
    254264
    255265    function wp_admin($dir, $output) {
    256         if ( ! file_exists( "$dir/wp-admin/user/about.php" ) ) return false;
     266        if ( ! file_exists( "$dir/wp-admin/user/about.php" ) ) {
     267            return false;
     268        }
    257269
    258270        $frontend_pot = $this->tempnam( 'frontend.pot' );
    259         if ( false === $frontend_pot ) return false;
     271        if ( false === $frontend_pot ) {
     272            return false;
     273        }
    260274
    261275        $frontend_result = $this->wp_frontend( $dir, $frontend_pot );
    262         if ( ! $frontend_result )
    263             return false;
     276        if ( ! $frontend_result ) {
     277            return false;
     278        }
    264279
    265280        $result = $this->wp_generic( $dir, array(
    266281            'project' => 'wp-admin', 'output' => $output,
    267282            'includes' => array( 'wp-admin/.*' ),
    268             'excludes' => array( 'wp-admin/network/.*', 'wp-admin/network.php' ),
     283            'excludes' => array( 'wp-admin/includes/continents-cities\.php', 'wp-admin/network/.*', 'wp-admin/network.php' ),
    269284            'default_output' => 'wordpress-admin.pot',
    270285        ) );
    271 
    272         if ( ! $result )
    273             return false;
     286        if ( ! $result ) {
     287            return false;
     288        }
    274289
    275290        $potextmeta = new PotExtMeta;
    276         $result = $potextmeta->append( "$dir/wp-content/plugins/akismet/akismet.php", $output );
    277         if ( ! $result )
    278             return false;
     291
     292        if ( ! file_exists( "$dir/wp-admin/css/about.css" ) ) { // < 3.9
     293            $result = $potextmeta->append( "$dir/wp-content/plugins/akismet/akismet.php", $output );
     294            if ( ! $result ) {
     295                return false;
     296            }
     297        }
     298
    279299        $result = $potextmeta->append( "$dir/wp-content/plugins/hello.php", $output );
    280         if ( ! $result )
    281             return false;
     300        if ( ! $result ) {
     301            return false;
     302        }
    282303
    283304        /* Adding non-gettexted strings can repeat some phrases */
     
    286307
    287308        $common_pot = $this->tempnam( 'common.pot' );
    288         if ( ! $common_pot )
    289             return false;
     309        if ( ! $common_pot ) {
     310            return false;
     311        }
    290312        $admin_pot = realpath( is_null( $output ) ? 'wordpress-admin.pot' : $output );
    291313        system( "msgcat --more-than=1 --use-first $frontend_pot $admin_pot > $common_pot" );
     
    571593        $output = is_null( $output )? 'rosetta.pot' : $output;
    572594        return $this->xgettext( 'rosetta', $dir, $output, array(), array(), array(
     595            'mu-plugins/(roles|showcase|downloads)/.*\.php',
    573596            'mu-plugins/rosetta.*\.php',
    574597            'mu-plugins/rosetta/[^/]+\.php',
Note: See TracChangeset for help on using the changeset viewer.