I18N: Fix script languages path for themes.

Remove hardcoded path added in [57922] which ignored the fact that themes can also use script translations.
They should not be affected even if plugins are installed outside the typical `wp-content/plugins` location. 

Props itapress, swissspidy.
Fixes #62016.

Built from https://develop.svn.wordpress.org/trunk@59126


git-svn-id: http://core.svn.wordpress.org/trunk@58522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2024-09-30 14:59:18 +00:00
parent 251e520c33
commit ed16539779
2 changed files with 10 additions and 2 deletions

View File

@ -1207,7 +1207,15 @@ function load_script_textdomain( $handle, $domain = 'default', $path = '' ) {
$relative = trim( $relative, '/' );
$relative = explode( '/', $relative );
$languages_path = WP_LANG_DIR . '/plugins';
/*
* Ensure correct languages path when using a custom `WP_PLUGIN_DIR` / `WP_PLUGIN_URL` configuration.
* See https://core.trac.wordpress.org/ticket/60891 and https://core.trac.wordpress.org/ticket/62016.
*/
$plugins_dir = array_slice( explode( '/', $plugins_url['path'] ), 2 );
$plugins_dir = trim( $plugins_dir[0], '/' );
$dirname = $plugins_dir === $relative[0] ? 'plugins' : 'themes';
$languages_path = WP_LANG_DIR . '/' . $dirname;
$relative = array_slice( $relative, 2 ); // Remove plugins/<plugin name> or themes/<theme name>.
$relative = implode( '/', $relative );

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7-alpha-59125';
$wp_version = '6.7-alpha-59126';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.