Making WordPress.org

Ticket #6256: patch.6256.diff

File patch.6256.diff, 1.2 KB (added by akirk, 3 years ago)
  • wp-content/plugins/wporg-gp-customizations/inc/class-plugin.php

     
    5555
    5656                add_filter( 'gp_for_translation_clauses', array( $this, 'allow_searching_for_no_author_translations' ), 10, 3 );
    5757
     58                add_filter( 'gp_warning_discarded', array( $this, 'disable_discarding_some_warnings' ), 10, 5 );
     59
    5860                // Cron.
    5961                add_filter( 'cron_schedules', [ $this, 'register_cron_schedules' ] );
    6062                add_action( 'init', [ $this, 'register_cron_events' ] );
     
    325327        }
    326328
    327329        /**
     330         * Allow disabling some warnings.
     331         *
     332         * See https://meta.trac.wordpress.org/ticket/6256
     333         */
     334        function disable_discarding_some_warnings( $project_id, $translation_set, $translation, $warning, $user ) {
     335                if ( 'placeholders' === $warning ) {
     336                        GP::$current_route->die_with_error( __( 'This warning cannot be discarded. Please fix the translation.', 'wporg' ) );
     337                }
     338        }
     339
     340        /**
    328341         * Adds a link to view originals in consistency tool.
    329342         *
    330343         * @param array              $more_links      The links to be output.