[wp-trac] [WordPress Trac] #45528: load_script_textdomain() doesn't load translations when WP installed in a subdirectory with custom content dir (was: Editor JSON translations fail to load if WP_CONTENT_DIR been redefined)

WordPress Trac noreply at wordpress.org
Fri Dec 7 20:02:39 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-patch needs-   |     Focuses:
  unit-tests                                     |
-------------------------------------------------+-------------------------
Changes (by ocean90):

 * keywords:  has-screenshots => has-screenshots needs-patch needs-unit-
               tests
 * severity:  major => normal
 * milestone:  Awaiting Review => 5.0.1


Old description:

> Translation for Gutenberg editor screen is partial when WP_CONTENT_DIR
> been redefined. JSON translations are present in WP_CONTENT_DIR/languages
> but are not used.
>
> Steps to reproduce (fresh WP install):
> https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
> 1. install localized wordpress in subfolder (
> http://localhost:8080/wordpress in my case )
> 2. move installation to root of domain
> create index.php, redefine siteurl
> 3. define new constants
> define( 'WP_CONTENT_DIR', '/siteroot/wp/wp-content' );
> define( 'WP_CONTENT_URL', 'http://localhost:8080/wp-content' );
> define( 'WP_PLUGIN_DIR', '/siteroot/wp/wp-content/plugins' );
> define( 'WP_PLUGIN_URL', 'http://localhost:8080/wp-content/plugins' );
> 4. ensure everything is working. (It is!)
> Try to load editor, (new post/page) - localization is broken.
>
> Expected: geditor-good.jpg
> Got: geditor-bad.jpg

New description:

 Translation for Gutenberg editor screen is partial when WP_CONTENT_DIR
 been redefined. JSON translations are present in WP_CONTENT_DIR/languages
 but are not used.

 Steps to reproduce (fresh WP install):
 https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
 1. install localized wordpress in subfolder (
 http://localhost:8080/wordpress in my case )
 2. move installation to root of domain
 create index.php, redefine siteurl
 3. define new constants

 {{{
 define( 'WP_CONTENT_DIR', '/siteroot/wp/wp-content' );
 define( 'WP_CONTENT_URL', 'http://localhost:8080/wp-content' );
 define( 'WP_PLUGIN_DIR', '/siteroot/wp/wp-content/plugins' );
 define( 'WP_PLUGIN_URL', 'http://localhost:8080/wp-content/plugins' );
 }}}

 4. ensure everything is working. (It is!)
 Try to load editor, (new post/page) - localization is broken.

 Expected: geditor-good.jpg
 Got: geditor-bad.jpg

--

Comment:

 Related issue: When WordPress is installed in a `/wp/` directory,
 [https://core.trac.wordpress.org/browser/tags/5.0/src/wp-
 includes/l10n.php#L931 $relative] becomes
 `-includes/js/dist/editor.min.js`.


 Related: #45488

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


More information about the wp-trac mailing list