diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index fb88ba5e07..915fa72701 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -922,8 +922,13 @@ function load_script_textdomain( $handle, $domain = 'default', $path = null ) { // If a path was given and the handle file exists simply return it. $file_base = $domain === 'default' ? $locale : $domain . '-' . $locale; $handle_filename = $file_base . '-' . $handle . '.json'; - if ( $path && file_exists( $path . '/' . $handle_filename ) ) { - return load_script_translations( $path . '/' . $handle_filename, $handle, $domain ); + + if ( $path ) { + $translations = load_script_translations( $path . '/' . $handle_filename, $handle, $domain ); + + if ( $translations ) { + return $translations; + } } $src = $wp_scripts->registered[ $handle ]->src; @@ -983,11 +988,19 @@ function load_script_textdomain( $handle, $domain = 'default', $path = null ) { } $md5_filename = $file_base . '-' . md5( $relative ) . '.json'; - if ( $path && file_exists( $path . '/' . $md5_filename ) ) { - return load_script_translations( $path . '/' . $md5_filename, $handle, $domain ); + + if ( $path ) { + $translations = load_script_translations( $path . '/' . $md5_filename, $handle, $domain ); + + if ( $translations ) { + return $translations; + } } - if ( file_exists( $languages_path . '/' . $md5_filename ) ) { - return load_script_translations( $languages_path . '/' . $md5_filename, $handle, $domain ); + + $translations = load_script_translations( $languages_path . '/' . $md5_filename, $handle, $domain ); + + if ( $translations ) { + return $translations; } return load_script_translations( false, $handle, $domain ); diff --git a/wp-includes/version.php b/wp-includes/version.php index ebdfa6056a..ad4483b1dc 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-alpha-44417'; +$wp_version = '5.1-alpha-44418'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.