[wp-trac] [WordPress Trac] #45528: load_script_textdomain() doesn't load translations when WP installed in a subdirectory with custom content dir

WordPress Trac noreply at wordpress.org
Sat Dec 8 09:52:53 UTC 2018


#45528: load_script_textdomain() doesn't load translations when WP installed in a
subdirectory with custom content dir
-------------------------------------------------+-------------------------
 Reporter:  fierevere                            |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  5.0.1
Component:  I18N                                 |     Version:  5.0
 Severity:  normal                               |  Resolution:
 Keywords:  has-screenshots needs-unit-tests     |     Focuses:
  has-patch                                      |
-------------------------------------------------+-------------------------

Comment (by fierevere):

 {{{#!php
 <?php
 //      ( ! isset( $src_url['host'] ) || $src_url['host'] !==
 $content_url['host'] )
         ( ! isset( $src_url['host'] ) || $src_url['host'] ===
 $content_url['host'] )
 }}}

 changing this statement does not help

 the piece of debugging code i have:
 {{{#!php
         $site_url    = wp_parse_url( site_url() );
 ob_start(); var_dump($src_url['path']); error_log(ob_get_clean());
 ob_start(); var_dump($content_url['path']); error_log(ob_get_clean());
 ob_start(); var_dump($site_url['path']); error_log(ob_get_clean());
 ob_start(); var_dump($src_url['host']); error_log(ob_get_clean());
 ob_start(); var_dump($content_url['host']); error_log(ob_get_clean());
 ob_start(); var_dump($site_url['host']); error_log(ob_get_clean());
         // If the host is the same or it's a relative URL.
 if (
         strpos( $src_url['path'], $content_url['path'] ) === 0 &&
         ( ! isset( $src_url['host'] ) || $src_url['host'] ===
 $content_url['host'] )
 ) {
 error_log("branch 1");
        // Make the src relative the specific plugin or theme.
         $relative = trim( substr( $src_url['path'], strlen(
 $content_url['path'] ) ), '/' );
                 $relative = explode( '/', $relative );
                 $languages_path = WP_LANG_DIR . '/' . $relative[0];
                 $relative = array_slice( $relative, 2 );
                 $relative = implode( '/', $relative );
         }
           elseif ( ! isset( $src_url['host'] ) || $src_url['host'] !==
 $site_url['host'] ) {
 error_log("branch 2");
                 if ( ! isset( $site_url['path'] ) ) {
 error_log("branch 2a");
                         $relative = trim( $src_url['path'], '/' );
                 } elseif ( ( strpos( $src_url['path'], $site_url['path'] )
 === 0 ) ) {
 error_log("branch 2b");
                         // Make the src relative to the WP root.
                         $relative = substr( $src_url['path'], strlen(
 $site_url['path'] ) );
                         $relative = trim( $relative, '/' );
                 }
         } else error_log("branch neither");

 ob_start(); var_dump($relative); error_log(ob_get_clean());
         // If the source is not from WP.
         if ( false === $relative ) {
                 return false;
         }
 }}}


 variable dumps and branch diagnostics:

 {{{

 [Sat Dec  8 12:47:50 2018] string(44) "/wordpress/wp-
 includes/js/dist/blocks.min.js"

 [Sat Dec  8 12:47:50 2018] string(11) "/wp-content"

 [Sat Dec  8 12:47:50 2018] string(10) "/wordpress"

 [Sat Dec  8 12:47:50 2018] string(9) "localhost"

 [Sat Dec  8 12:47:50 2018] string(9) "localhost"

 [Sat Dec  8 12:47:50 2018] string(9) "localhost"

 [Sat Dec  8 12:47:50 2018] branch neither
 [Sat Dec  8 12:47:50 2018] bool(false)
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45528#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list