WordPress.org

Make WordPress Core

Ticket #50999: translations-no-concat.patch

File translations-no-concat.patch, 1.5 KB (added by herregroen, 13 months ago)
  • src/wp-includes/class.wp-scripts.php

    diff --git a/src/wp-includes/class.wp-scripts.php b/src/wp-includes/class.wp-scripts.php
    index f63517f7e1..aa4935da6b 100644
    a b class WP_Scripts extends WP_Dependencies { 
    311311                        $inline_script_tag = '';
    312312                }
    313313
     314                $translations = $this->print_translations( $handle, false );
     315                if ( $translations ) {
     316                        $translations = sprintf( "<script%s id='%s-js-translations'>\n%s\n</script>\n", $this->type_attr, esc_attr( $handle ), $translations );
     317                }
     318
    314319                if ( $this->do_concat ) {
    315320                        /**
    316321                         * Filters the script loader source.
    class WP_Scripts extends WP_Dependencies { 
    322327                         */
    323328                        $srce = apply_filters( 'script_loader_src', $src, $handle );
    324329
    325                         if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle ) ) {
     330                        if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations ) ) {
    326331                                $this->do_concat = false;
    327332
    328333                                // Have to print the so-far concatenated scripts right away to maintain the right order.
    class WP_Scripts extends WP_Dependencies { 
    364369                        return true;
    365370                }
    366371
    367                 $translations = $this->print_translations( $handle, false );
    368                 if ( $translations ) {
    369                         $translations = sprintf( "<script%s id='%s-js-translations'>\n%s\n</script>\n", $this->type_attr, esc_attr( $handle ), $translations );
    370                 }
    371 
    372372                if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $this->content_url && 0 === strpos( $src, $this->content_url ) ) ) {
    373373                        $src = $this->base_url . $src;
    374374                }