Changeset 11768
- Timestamp:
- 04/12/2022 06:52:51 PM (2 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/cli/class-language-pack.php
r10222 r11768 619 619 continue; 620 620 } 621 } else {622 WP_CLI::log( "Skipping threshold check for {$wp_locale}, has existing language pack." );623 621 } 624 622 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-plugin-directory/inc/language-pack/class-build-listener.php
r8156 r11768 47 47 48 48 // Build in a separate process. 49 $cmd = WPORGTRANSLATE_WPCLI . ' wporg-translate language-pack generate plugin ' . escapeshellarg( $args['plugin'] ) . ' 2>&1'; 49 $cmd = WPORGTRANSLATE_WPCLI . ' wporg-translate language-pack generate plugin ' . escapeshellarg( $args['plugin'] ) . ' 2>&1'; 50 $output = []; 51 $return_var = 0; 50 52 exec( $cmd, $output, $return_var ); 53 $output = array_filter( $output, fn( $line ) => ! str_ends_with( $line, ', no translations.' ) ); 51 54 if ( $return_var ) { 52 $message .= "\tFailure: " . implode( "\n\t", $output ) . "\n";55 $message .= 'Failure: ' . implode( "\n", $output ) . "\n"; 53 56 } else { 54 $message .= "\t" . implode( "\n\t", $output ) . "\n";57 $message .= implode( "\n", $output ) . "\n"; 55 58 } 56 59 57 $message .= "Language packs for {$args['plugin']} processed.\n"; 60 $message = trim( $message ); 61 if ( ! $message ) { 62 $message = "No language packs for {$args['plugin']} generated."; 63 } 58 64 59 65 $attachment = [ -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-plugin-directory/inc/sync/class-translation-sync.php
r11068 r11768 49 49 50 50 // Sync translations only if the stable project was updated. 51 if ( false === strpos( $project->path, '/stable' ) ) {51 if ( str_ends_with( $project->path, '/dev' ) || str_ends_with( $project->path, '/dev-readme' ) ) { 52 52 return; 53 53 } … … 85 85 } 86 86 87 $sub_project = basename( $args['gp_project'] );88 $sub_project_counterpart = $this->project_mapping[ $sub_project ];89 90 87 $timestamp = time(); 91 88 $message = ''; 92 $updates = 0;93 89 94 90 foreach ( $translation_sets as $translation_set ) { … … 98 94 99 95 // Sync translations in a separate process. 100 $cmd = WPORGTRANSLATE_WPCLI . ' wporg-translate sync-plugin-translations ' . escapeshellarg( $args['gp_project'] ) . ' ' . escapeshellarg( $translation_set->locale ) . ' --set=' . escapeshellarg( $translation_set->slug ) . ' 2>&1';101 $output = '';96 $cmd = WPORGTRANSLATE_WPCLI . ' wporg-translate sync-plugin-translations ' . escapeshellarg( $args['gp_project'] ) . ' ' . escapeshellarg( $translation_set->locale ) . ' --set=' . escapeshellarg( $translation_set->slug ) . ' 2>&1'; 97 $output = []; 102 98 $return_var = 0; 103 99 exec( $cmd, $output, $return_var ); 104 100 if ( $return_var ) { 105 $message .= "\tFailure: " . implode( "\n\t", $output ) . "\n";101 $message .= 'Failure: ' . implode( "\n", $output ) . "\n"; 106 102 } else { 107 $message .= "\t" . implode( "\n\t", $output ) . "\n";108 } 109 $updates += 1;110 } 111 112 if ( ! $ updates) {113 $message .= "\tNo translations are available to sync.\n";114 } 115 116 $ message .= 'Translation sync was successfully processed.';103 $message .= implode( "\n", $output ) . "\n"; 104 } 105 } 106 107 $message = trim( $message ); 108 if ( ! $message ) { 109 $message = 'No translations are available to sync.'; 110 } 111 112 $type = str_ends_with( $project->path, '/dev-readme' ) ? 'readme' : 'code'; 117 113 118 114 $attachment = [ 119 'title' => "Translation Sync for{$args['plugin']}",115 'title' => "Translation sync for {$type} of {$args['plugin']}", 120 116 'title_link' => "https://translate.wordpress.org/projects/wp-plugins/{$args['plugin']}", 121 117 'text' => $message, 122 'fallback' => "Translations for {$ args['plugin']} were synced.",118 'fallback' => "Translations for {$type} of {$args['plugin']} were synced.", 123 119 'color' => '#00a0d2', 124 120 'mrkdwn_in' => [ 'text' ], -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-theme-directory/inc/language-pack/class-build-listener.php
r8156 r11768 47 47 48 48 // Build in a separate process. 49 $cmd = WPORGTRANSLATE_WPCLI . ' wporg-translate language-pack generate theme ' . escapeshellarg( $args['theme'] ) . ' 2>&1'; 49 $cmd = WPORGTRANSLATE_WPCLI . ' wporg-translate language-pack generate theme ' . escapeshellarg( $args['theme'] ) . ' 2>&1'; 50 $output = []; 51 $return_var = 0; 50 52 exec( $cmd, $output, $return_var ); 53 $output = array_filter( $output, fn( $line ) => ! str_ends_with( $line, ', no translations.' ) ); 51 54 if ( $return_var ) { 52 $message .= "\tFailure: " . implode( "\n\t", $output ) . "\n";55 $message .= 'Failure: ' . implode( "\n", $output ) . "\n"; 53 56 } else { 54 $message .= "\t" . implode( "\n\t", $output ) . "\n";57 $message .= implode( "\n", $output ) . "\n"; 55 58 } 56 59 57 $message .= "Language packs for {$args['theme']} processed.\n"; 60 $message = trim( $message ); 61 if ( ! $message ) { 62 $message = "No language packs for {$args['theme']} generated."; 63 } 58 64 59 65 $attachment = [
Note: See TracChangeset
for help on using the changeset viewer.